From owner-freebsd-embedded@FreeBSD.ORG Mon Jan 27 11:06:44 2014 Return-Path: Delivered-To: freebsd-embedded@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E465FC33 for ; Mon, 27 Jan 2014 11:06:44 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CE5971A7E for ; Mon, 27 Jan 2014 11:06:44 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s0RB6io8012958 for ; Mon, 27 Jan 2014 11:06:44 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s0RB6ivs012956 for freebsd-embedded@FreeBSD.org; Mon, 27 Jan 2014 11:06:44 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 27 Jan 2014 11:06:44 GMT Message-Id: <201401271106.s0RB6ivs012956@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 Subject: Current problem reports assigned to freebsd-embedded@FreeBSD.org X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jan 2014 11:06:45 -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 Tue Jan 28 08:48:32 2014 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6C16A83F for ; Tue, 28 Jan 2014 08:48:32 +0000 (UTC) Received: from valery.van-laarhoven.org (unknown [IPv6:2a02:2308::216:3eff:fe79:3a6c]) by mx1.freebsd.org (Postfix) with ESMTP id C668E1606 for ; Tue, 28 Jan 2014 08:48:31 +0000 (UTC) Received: from hitske.fritz.box (thuis.van-laarhoven.org [80.100.41.4]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by valery.van-laarhoven.org (Postfix) with ESMTPSA id 03FD767ED16; Tue, 28 Jan 2014 09:48:28 +0100 (CET) Content-Type: multipart/signed; boundary="Apple-Mail=_BA1B0337-80AC-40C3-86CD-81FB8AE711A4"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Subject: Re: Creating code slice before disk image in nanobsd From: Nick Hibma In-Reply-To: <20140123120053.GC27181@snail.casa> Date: Tue, 28 Jan 2014 09:48:27 +0100 Message-Id: <69B43B44-C122-4D6E-92AB-7A5480ABFE54@van-laarhoven.org> References: <20120629133759.GA19373@snail.casa> <20140114161533.GB19601@snail.casa> <6027B660-1D2E-4058-B87F-83D8225F0DC3@bsdimp.com> <20140116034220.B43023@sola.nimnet.asn.au> <20140123120053.GC27181@snail.casa> To: Arrigo Marchiori X-Mailer: Apple Mail (2.1827) X-Content-Filtered-By: Mailman/MimeDel 2.1.17 Cc: Ian Smith , =?windows-1252?Q?=93FreeBSD_Embedded_Mailing_List=94?= X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2014 08:48:32 -0000 --Apple-Mail=_BA1B0337-80AC-40C3-86CD-81FB8AE711A4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 >>>> I'll take a look at things... It isn't obvious at first blush this = is >>>> the right thing to do, but I need to think about it a bit... >>>>=20 >>>> Warner >>>=20 >>> Perhaps an aside, but I'm pretty sure Warren (cc'd) has said that = gpart >>> can do anything that fdisk AND bsdlabel can do? >>=20 >> Yes. Although there is an exception: gpart silently forces alignment = to=20 >> CHS values on MBR slices, and fdisk does not. So to get a 4K-aligned=20= >> slice requires fdisk. gpart can align BSD partitions inside a slice = to=20 >> 4K, but that is a workaround. (I believe gpart should default to CHS=20= >> but use -a alignment or -b values when given for MBR slices, = regardless=20 >> of the MBR spec. This becomes increasingly important as 4K drives = and=20 >> SSDs become more common.) >=20 > I didn't take alignment into account; I just adapted the calculations > to match the parameters required by gpart. >=20 >>> If that's so, and the >>> object here is to deprecate fdisk, why not also replace these lines: >>>=20 >>> + >>> + bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD} >>> + bsdlabel ${MD} >>> + >>>=20 >>> with their gpart equivalents? >>>=20 >>> (and no, I don't know what those should be in this context) >>=20 >> To create the initial MBR, probably already done before the code = above: >> gpart create -s mbr ${MD} >=20 > This is done by the patch. >=20 > [...] >> To create a slice and set it active: >> gpart add -s freebsd ${MD} [1] > [...] >> [1] when creating the slice, -a4k or -b1m can be specified but will = be >> silently rounded to CHS values >=20 > The -b parameter is also used, therefore your note [1] applies. >=20 >> gpart set -a active -i1 ${MD} >=20 > This is done by the patch. >=20 >> To create the BSDlabel inside the slice and write the bootcode to it: >> gpart create -s bsd ${MD}s1 >> gpart bootcode -b ${NANO_WORLDDIR}/boot/boot ${MD}s1 >> Then BSD partitions can be added with, for example: >> gpart add -t freebsd-ufs -s2g ${MD}s1 [2] > [...] >> [2] when creating BSD partitions, -a4k can be used and they will be >> created with an offset inside the slice to end up aligned >=20 > These were kept as the original: >=20 > bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD}s1 >=20 >> For reference, see=20 >> = http://www.wonkity.com/~wblock/docs/html/disksetup.html#_the_old_standard_= mbr For reference, I=92ve replaced the disk image build with a simpler disk = image function, and a separate script to generate a full disk image = (used only for new installations. The disk image script is a = simplification of the existing one in nanobsd.sh. The second, separate script does the full initialisation of a disk = depending on what it finds. It also does automatic filling of the disk = with a /data partition (so we can use 2 150MB code partitions, cfg = partition and the rest for storage on any medium). As you can see we = still use the boot0cfg commands here. It can build an MBR style = partitioning, but also a BSD style partitioning (USB drives) (left out = for brevity). (Note: Our scripts can not only generate MBR style partitioning, but = also BSD style partitioning holding 2 code slices. For that to work you = will need to do some fancy twiddling of the partition switching after = update). Maybe this is of use for reference in this discussions. Nick echo "### Creating MBR style layout for HD/CF style image on $CFCARD" = 1>&4 # AWIMGroot1 ada0s1a # AWIMGroot2 ada0s2a # AWIMGcfg ada0s3 # AWIMGdata ada0s4 gpart create -s MBR $CFCARD # We need to increase the size of the root partitions by a small amount = to # make room for the BSD label at the start gpart add -t freebsd -s $(($IMAGE_CODESIZE+1))M $CFCARD gpart create -s BSD ${CFCARD}s1 gpart bootcode -b $NANO_WORLDDIR/boot/boot ${CFCARD}s1 gpart add -i 1 -t freebsd-ufs -s ${IMAGE_CODESIZE}M ${CFCARD}s1 root1=3D${CFCARD}s1a if [ $NANO_IMAGES -gt 1 ]; then gpart add -i 2 -t freebsd -s $(($IMAGE_CODESIZE+1))M $CFCARD gpart create -s BSD ${CFCARD}s2 gpart bootcode -b $NANO_WORLDDIR/boot/boot ${CFCARD}s2 gpart add -t freebsd-ufs -s ${IMAGE_CODESIZE}M ${CFCARD}s2 root2=3D${CFCARD}s2a fi gpart add -i 3 -t freebsd -s ${IMAGE_CFGSIZE}M $CFCARD cfgpart=3D${CFCARD}s3 if [ -z "$IMAGE_DATASIZE" ] || [ "$IMAGE_DATASIZE" -gt 0 ]; then gpart add -i 4 -t freebsd ${IMAGE_DATASIZE:+-s = ${IMAGE_DATASIZE}M} $CFCARD datapart=3D${CFCARD}s4 fi # Mark the first partition bootable gpart bootcode -b $NANO_WORLDDIR/$NANO_BOOTLOADER $CFCARD gpart set -a active -i 1 $CFCARD # Configure boot0 boot0cfg $NANO_BOOT0CFG $CFCARD echo "### Populating root 1 partition" 1>&4 dd if=3D$IMG of=3D/dev/$root1 bs=3D8k skip=3D1 seek=3D1 if [ -n "$root2" ]; then echo "### Leaving empty root 2 partition" 1>&4 echo "### Populating config partition" 1>&4 fi newfs -L ${NANO_LABEL}cfg $cfgpart populate_fs /dev/$cfgpart ./Cfg ${IMAGE_SUBNAME:+./$IMAGE_SUBNAME/Cfg} = $cfgdir if [ -n "$datapart" ]; then echo "### Populating data partition" 1>&4 newfs -L ${NANO_LABEL}data $datapart populate_fs /dev/$datapart ${IMAGE_DEFAULTS}/Data ./Data = ${IMAGE_SUBNAME:+./$IMAGE_SUBNAME/Data} fi --Apple-Mail=_BA1B0337-80AC-40C3-86CD-81FB8AE711A4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlLnbtwACgkQBxE2H56uaYmCPQCfZBpch+L/a47OvnxxRWaSovRH aOYAnj69X6MuuFN2aBIVdHpFfOU4Mv6e =dA2C -----END PGP SIGNATURE----- --Apple-Mail=_BA1B0337-80AC-40C3-86CD-81FB8AE711A4--