From owner-freebsd-embedded@FreeBSD.ORG Thu Jan 23 12:00:58 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 4F4F0AE6 for ; Thu, 23 Jan 2014 12:00:58 +0000 (UTC) Received: from nm9-vm0.bullet.mail.ird.yahoo.com (nm9-vm0.bullet.mail.ird.yahoo.com [77.238.189.197]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B86B415BF for ; Thu, 23 Jan 2014 12:00:57 +0000 (UTC) Received: from [77.238.189.239] by nm9.bullet.mail.ird.yahoo.com with NNFMP; 23 Jan 2014 12:00:54 -0000 Received: from [46.228.39.68] by tm20.bullet.mail.ird.yahoo.com with NNFMP; 23 Jan 2014 12:00:54 -0000 Received: from [127.0.0.1] by smtp105.mail.ir2.yahoo.com with NNFMP; 23 Jan 2014 12:00:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.it; s=s1024; t=1390478454; bh=IlsPTszrlFxnkBiY4cuggDmv6IhN2R+PxTOXQFixycE=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:User-Agent; b=a0UW9QyKHBiYdvkdeazmufy7l/vQ+h3Mk09lk2OEVgYW2NJq52Lqej36rvyJ2FeD5Ji/7+aCJ0iGjO041y71t16oHJobnqqp2wOkFoG9wzMF62Yd/utjpgE0JmfH+8KZnvkZC6pZQMi+R1g9Eok8VJaOoGGPqs00W0VdHXiAQJA= X-Yahoo-Newman-Id: 442125.79911.bm@smtp105.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: HADkfvIVM1lFqGlC7JULdzdF61Nt7KBKeCOznAJtsO2sNg4 33t4.8zpbW9tcYmSZh3QAaweCTN7S.9htxplqeasQBFFHkbPO8Pg6ptpapQk BPqFLxCxlJzK5iGar.NZnzWqiYn6Jn5FS3rbEwawRCpFfh0vwioIz26kJiOG kUQA6AIuSB2la7YGt5bfsLhHGL0ynbYlOm.14F_u7.VdBH_VvHN4cDC9onFx _peAM1py9GxsZ8edKHMdFp0rdnTl38z3PzS1a0Dfgev3Q9.Ea.GMsgUC3wGk NcWvh7.8gVWkZALln1V7yqoe62zATync_BMtzC.qJg4Zi.Zrnx9Xio_wKuza aa9CnfZZamE5vNsrWXZ8gjLj0ampUpD4ujd0Y9jfc4l.uA.Snkg9T2jXnBS1 46SokNJ5SoDn1Vm4O75w6WerEgt0z0pZ5DpmKt7h_Pdxjqcy.k0fj9DiGdjL A71v72MRiBwqdmZXZ3EjDMkUydECqZd.nf8tmBeYgvFOeeTZKnvyxFzADzDh LZRYKSDnwSjwBHdYPnaMN70K.B16U_TjYaDU227WULCkJVaeRqj7VC_QfIj7 iVjIdekb9qjt9kseUCmpa0hykiIuH5XSkM9vcCyyWmKgo4.UOtWIVqrjYiji JAzN6dxNcqvCegDV0efF0oHvqHGqwgQ62lOaYSFQK_OHshYsxV5lzAKY8OSh 89R1kPxr0M_oo X-Yahoo-SMTP: WU.IBxeswBAAnLcBZV3tEZIK0A-- X-Rocket-Received: from flea (ardovm@93.145.108.123 with plain [188.125.69.59]) by smtp105.mail.ir2.yahoo.com with SMTP; 23 Jan 2014 12:00:54 +0000 UTC Received: by flea (Postfix, from userid 1000) id 407EEC00094; Thu, 23 Jan 2014 13:00:53 +0100 (CET) Date: Thu, 23 Jan 2014 13:00:53 +0100 From: Arrigo Marchiori To: Warren Block Subject: Re: Creating code slice before disk image in nanobsd Message-ID: <20140123120053.GC27181@snail.casa> References: <20120629133759.GA19373@snail.casa> <20140114161533.GB19601@snail.casa> <6027B660-1D2E-4058-B87F-83D8225F0DC3@bsdimp.com> <20140116034220.B43023@sola.nimnet.asn.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Ian Smith , "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: Thu, 23 Jan 2014 12:00:58 -0000 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