Date: Thu, 23 Jan 2014 13:00:53 +0100 From: Arrigo Marchiori <ardovm@yahoo.it> To: Warren Block <wblock@wonkity.com> Cc: Ian Smith <smithi@nimnet.asn.au>, "freebsd-embedded@freebsd.org" <freebsd-embedded@freebsd.org> Subject: Re: Creating code slice before disk image in nanobsd Message-ID: <20140123120053.GC27181@snail.casa> In-Reply-To: <alpine.BSF.2.00.1401151214480.83038@wonkity.com> References: <20120629133759.GA19373@snail.casa> <20140114161533.GB19601@snail.casa> <CAJ-VmonKFEvPRimEmA8vnAbXVCYQ16yOftYhq03VJBYB5knotA@mail.gmail.com> <6027B660-1D2E-4058-B87F-83D8225F0DC3@bsdimp.com> <20140116034220.B43023@sola.nimnet.asn.au> <alpine.BSF.2.00.1401151214480.83038@wonkity.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hello list, to answer some of Warren's questions, I will describe what the patch currently does. I am not a gpart expert, so you can propose your own considerations and fixes if you know the subject. On Wed, Jan 15, 2014 at 12:50:33PM -0700, Warren Block wrote: > On Thu, 16 Jan 2014, Ian Smith wrote: > > > On Wed, 15 Jan 2014 07:53:08 -0700, Warner Losh wrote: > > > > > 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... > > > > > > Warner > > > > Perhaps an aside, but I'm pretty sure Warren (cc'd) has said that gpart > > can do anything that fdisk AND bsdlabel can do? > > Yes. Although there is an exception: gpart silently forces alignment to > CHS values on MBR slices, and fdisk does not. So to get a 4K-aligned > slice requires fdisk. gpart can align BSD partitions inside a slice to > 4K, but that is a workaround. (I believe gpart should default to CHS > but use -a alignment or -b values when given for MBR slices, regardless > of the MBR spec. This becomes increasingly important as 4K drives and > SSDs become more common.) I didn't take alignment into account; I just adapted the calculations to match the parameters required by gpart. > > If that's so, and the > > object here is to deprecate fdisk, why not also replace these lines: > > > > + > > + bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD} > > + bsdlabel ${MD} > > + > > > > with their gpart equivalents? > > > > (and no, I don't know what those should be in this context) > > To create the initial MBR, probably already done before the code above: > gpart create -s mbr ${MD} This is done by the patch. [...] > 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 The -b parameter is also used, therefore your note [1] applies. > gpart set -a active -i1 ${MD} This is done by the patch. > 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 These were kept as the original: bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD}s1 > For reference, see > http://www.wonkity.com/~wblock/docs/html/disksetup.html#_the_old_standard_mbr Regards, -- rigo http://rigo.altervista.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140123120053.GC27181>