From owner-freebsd-embedded@FreeBSD.ORG Mon Apr 9 11:07:09 2012 Return-Path: Delivered-To: freebsd-embedded@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 578F010656AA for ; Mon, 9 Apr 2012 11:07:09 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 279F18FC20 for ; Mon, 9 Apr 2012 11:07:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q39B79DJ039563 for ; Mon, 9 Apr 2012 11:07:09 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q39B78To039561 for freebsd-embedded@FreeBSD.org; Mon, 9 Apr 2012 11:07:08 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 9 Apr 2012 11:07:08 GMT Message-Id: <201204091107.q39B78To039561@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-embedded@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-embedded@FreeBSD.org X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Apr 2012 11:07:09 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o misc/52256 embedded [picobsd] picobsd build script does not read in user/s o kern/42728 embedded [picobsd] many problems in src/usr.sbin/ppp/* after c 2 problems total. From owner-freebsd-embedded@FreeBSD.ORG Wed Apr 11 08:11:29 2012 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 440AE1065670 for ; Wed, 11 Apr 2012 08:11:29 +0000 (UTC) (envelope-from ardovm@yahoo.it) Received: from nm3-vm0.bullet.mail.ukl.yahoo.com (nm3-vm0.bullet.mail.ukl.yahoo.com [217.146.183.228]) by mx1.freebsd.org (Postfix) with SMTP id 91FD88FC12 for ; Wed, 11 Apr 2012 08:11:28 +0000 (UTC) Received: from [217.146.183.181] by nm3.bullet.mail.ukl.yahoo.com with NNFMP; 11 Apr 2012 08:11:22 -0000 Received: from [77.238.184.79] by tm12.bullet.mail.ukl.yahoo.com with NNFMP; 11 Apr 2012 08:11:22 -0000 Received: from [127.0.0.1] by smtp148.mail.ukl.yahoo.com with NNFMP; 11 Apr 2012 08:11:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.it; s=s1024; t=1334131882; bh=RlGb4B621JQ/GM/h5sFQBqzWyJlAiKov4M6RiPyyKe8=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent; b=5tRShcGzQf72EEMm4lsMLkOKAyQsw5MY9s4HeKnFfjI22kE/UdVMymS3yzatomWY6rZMnCkzgknugFzoYmiO2o7p1jV44n/LlTv8wqTxUHXXwyklD496jl6JmMwwiIvA9OAs3YPHOtUDhctjhj6OEIHxVyn3kXBqXU2urA26jxM= X-Yahoo-Newman-Id: 662627.46297.bm@smtp148.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 82JFDX0VM1mlJzvJQ9vqBgEVk8Qx89I5bGqlClzauLuLIzd 20.1VYoC2hXWwgfTIail4j3gWDTZuApk8FljD0QZI1zZyH8RPT76S3TrStxg ytu3wwQUNy208cDVZHJ62Z4Hsm21.FEEp9bnB6bc7e.gqjCKRsz0RCB4n8wy Npcd62_DdAmj53IQ5tQWOQkQSsRwSZDzH7oNcg90w9_rBNOv_fe66mRk_kEX nK.L1Tl0ildP30gtNBgG5OZg1sxzFj8nrmmG4m9iGhqJHeK_PGzZtki2ClIT otACKpnevtyAIRV9s7zYPqKXqTOBJDwJFogBn9joWoyV2Jpn5uP7_RPMIoyD yZmbF_BJWS7cqn4rUX3Li3qAy3HAgEtwBopsRu40pCMMIX5nW2nVutQgANhI u6R3SRQWOUvQC2jDI2XtTcekYeFWJwEbunIOmkELbh02rpW0aMNSgIgVGhi3 gzqwMMTNZ7KAu2wIzljcAGl1LOrA9pEsxJiDZikG5zoTkSopFsg-- X-Yahoo-SMTP: WU.IBxeswBAAnLcBZV3tEZIK0A-- Received: from snail (ardovm@93.145.68.221 with login) by smtp148.mail.ukl.yahoo.com with SMTP; 11 Apr 2012 01:11:22 -0700 PDT Received: by snail (Postfix, from userid 1000) id F19F4516B26; Wed, 11 Apr 2012 10:11:18 +0200 (CEST) Date: Wed, 11 Apr 2012 10:11:18 +0200 From: Arrigo Marchiori To: freebsd-embedded@freebsd.org Message-ID: <20120411081118.GA9734@snail.casa> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="OgqxwSJOaUobr8KG" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [PATCH] Using gpart instead of fdisk in nanobsd X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2012 08:11:29 -0000 --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Dear List, after I bumped into some problems with fdisk in 8-STABLE, I was suggested to use gpart instead. If I understood correctly, fdisk will be deprecated in favor of gpart; that is why I thought of patching nanobsd.sh to use this newer system. This is the first time I "put my hands into" the nanobsd script; please help me check if I respected all coding standards and good practices. These are the modifications brought by the attached patch, that applies to the current version in 8-STABLE. - the big awk script that generated the _.fdisk file now generates a script named _.gpart. That script is executed right after creation. I didn't look too much into the detail of that script; what I did, was to "reformat" the results of its calculations into gpart invocations. - assignment of the variables IMG, MNT and MD are moved before the script, because they are needed there. - after the script, 'gpart show' is called before 'fdisk', so that the output log contains both dumps of the partition table. Regards, -- rigo http://rigo.altervista.org --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="nanobsd_gpart.patch" --- nanobsd.sh.originale 2012-04-10 12:41:31.000000000 +0200 +++ nanobsd.sh 2012-04-11 12:04:57.000000000 +0200 @@ -436,9 +436,24 @@ pprint 3 "log: ${NANO_OBJ}/_.di" ( + IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} + MNT=${NANO_OBJ}/_.mnt + mkdir -p ${MNT} + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + else + echo "Creating md backing file..." + rm -f ${IMG} + dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0 + MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + fi + echo $NANO_MEDIASIZE $NANO_IMAGES \ $NANO_SECTS $NANO_HEADS \ - $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | + $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE $MD | awk ' { printf "# %s\n", $0 @@ -449,12 +464,6 @@ # number of full cylinders on media cyl = int ($1 / cs) - # output fdisk geometry spec, truncate cyls to 1023 - if (cyl <= 1023) - print "g c" cyl " h" $4 " s" $3 - else - print "g c" 1023 " h" $4 " s" $3 - if ($7 > 0) { # size of data partition in full cylinders dsl = int (($7 + cs - 1) / cs) @@ -472,26 +481,33 @@ isl = int (($5 + cs - 1) / cs) } + # Create MBR partition table + print "gpart create -s mbr ", $8 + # First image partition start at second track - print "p 1 165 " $3, isl * cs - $3 + print "gpart add -t freebsd -b ", $3, " -s ", \ + isl * cs - $3, $8 c = isl * cs; # Second image partition (if any) also starts offset one # track to keep them identical. if ($2 > 1) { - print "p 2 165 " $3 + c, isl * cs - $3 + print "gpart add -t freebsd -b ", $3 + c, \ + " -s ", isl * cs - $3, $8 c += isl * cs; } # Config partition starts at cylinder boundary. - print "p 3 165 " c, csl * cs + print "gpart add -t freebsd -b ", c, " -s ", csl * cs, $8 c += csl * cs # Data partition (if any) starts at cylinder boundary. if ($7 > 0) { - print "p 4 165 " c, dsl * cs + print "gpart add -t freebsd -b ", c, \ + " -s ", dsl * cs, $8 } else if ($7 < 0 && $1 > c) { - print "p 4 165 " c, $1 - c + print "gpart add -t freebsd -b ", c, \ + " -s ", $1 - c, $8 } else if ($1 < c) { print "Disk space overcommitted by", \ c - $1, "sectors" > "/dev/stderr" @@ -500,28 +516,14 @@ # Force slice 1 to be marked active. This is necessary # for booting the image from a USB device to work. - print "a 1" + print "gpart set -a active -i 1 ", $8 } - ' > ${NANO_OBJ}/_.fdisk - - IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} - MNT=${NANO_OBJ}/_.mnt - mkdir -p ${MNT} - - if [ "${NANO_MD_BACKING}" = "swap" ] ; then - MD=`mdconfig -a -t swap -s ${NANO_MEDIASIZE} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - else - echo "Creating md backing file..." - rm -f ${IMG} - dd if=/dev/zero of=${IMG} seek=${NANO_MEDIASIZE} count=0 - MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ - -y ${NANO_HEADS}` - fi + ' > ${NANO_OBJ}/_.gpart trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT - fdisk -i -f ${NANO_OBJ}/_.fdisk ${MD} + sh ${NANO_OBJ}/_.gpart + gpart show ${MD} fdisk ${MD} # XXX: params # XXX: pick up cached boot* files, they may not be in image anymore. --OgqxwSJOaUobr8KG--