From owner-freebsd-current@freebsd.org Mon May 8 19:06:21 2017 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63392D63A01 for ; Mon, 8 May 2017 19:06:21 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3FB9174E; Mon, 8 May 2017 19:06:20 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B0E2410A82D; Mon, 8 May 2017 15:06:19 -0400 (EDT) From: John Baldwin To: freebsd-current@freebsd.org Cc: Toomas Soome , Julian Elischer , Toomas Soome Subject: Re: bootcode capable of booting both UFS and ZFS? Date: Mon, 08 May 2017 11:10:50 -0700 Message-ID: <2078108.OFyxUdmrtS@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-STABLE; KDE/4.14.10; amd64; ; ) In-Reply-To: <053354DF-651F-423C-8057-494496DA3B91@me.com> References: <963c5c97-2f92-9983-cf90-ec9d59d87bba@freebsd.org> <053354DF-651F-423C-8057-494496DA3B91@me.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 08 May 2017 15:06:19 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 May 2017 19:06:21 -0000 On Friday, May 05, 2017 11:01:03 PM Toomas Soome wrote: >=20 > > On 5. mai 2017, at 22:07, Julian Elischer wrot= e: > >=20 > > Subject says it all really, is this an option at this time? > >=20 > > we'd like to try boot the main zfs root partition and then fall bac= k to a small UFS based recovery partition.. is that possible? > >=20 > > I know we could use grub but I'd prefer keep it in the family. > >=20 > >=20 > >=20 >=20 >=20 > it is, sure. but there is an compromise to be made for it. >=20 > Lets start with what I have done in illumos port, as the idea there i= s exactly about having as =E2=80=9Cuniversal=E2=80=9D binaries as possi= ble (just the binaries are listed below to get the size): >=20 > -r-xr-xr-x 1 root sys 171008 apr 30 19:55 bootia32.efi > -r-xr-xr-x 1 root sys 148992 apr 30 19:55 bootx64.efi > -r--r--r-- 1 root sys 1255 okt 25 2015 cdboot > -r--r--r-- 1 root sys 154112 apr 30 19:55 gptzfsboot > -r-xr-xr-x 1 root sys 482293 mai 2 21:10 loader32.efi > -r-xr-xr-x 1 root sys 499218 mai 2 21:10 loader64.efi > -r--r--r-- 1 root sys 512 okt 15 2015 pmbr > -r--r--r-- 1 root sys 377344 mai 2 21:10 pxeboot > -r--r--r-- 1 root sys 376832 mai 2 21:10 zfsloader >=20 > the loader (bios/efi) is built with full complement - zfs, ufs, dosfs= , cd9660, nfs, tftp + gzipfs. The cdboot is starting zfsloader (thats t= rivial string change). >=20 > The gptzfsboot in illumos case is only built with zfs, dosfs and ufs = - as it has to support only disk based media to read out the loader. Al= so I am building gptzfsboot with libstand and libi386 to get as much sh= ared code as possible - which has both good and bad sides, as usual;) >=20 > The gptzfsboot size means that with ufs the dedicated boot partition = is needed (freebsd-boot), with zfs the illumos port is always using the= 3.5MB boot area after first 2 labels (as there is no geli, the illumos= does not need dedicated boot partition with zfs). >=20 > As the freebsd-boot is currently created 512k, the size is not an iss= ue. Also using common code does allow the generic partition code to be = used, so GPT/MBR/BSD (VTOC in illumos case) labels are not problem. The intention btw of the larger size for gptboot is so we could have a = merged gptboot / gptzfsboot. I don't think ZFS was in FreeBSD when gptboot wa= s first written, but I would much rather have a merged gptboot binary that supp= orts both. It just needs some logic for what to pick if it sees both. (It = would also be nice to axe zfsloader and just pass a different KARGS_FLAG_FOO = in to select ZFS as the default boot device to /boot/loader, but zfsloader is= probably too baked into the system at this point.) > Also note that we can still build the smaller dedicated blocks like b= oot2, just that we can not use those blocks for more universal cases an= d eventually those special cases will diminish. Yes, the BSD label stuff is stuck with a smaller size, but GPT should s= upport unified bootstraps. --=20 John Baldwin