From owner-freebsd-fs@FreeBSD.ORG Wed Oct 19 06:21:45 2011 Return-Path: Delivered-To: freebsd-fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B4B41065673 for ; Wed, 19 Oct 2011 06:21:45 +0000 (UTC) (envelope-from florian@wagner-flo.net) Received: from umbracor.wagner-flo.net (umbracor.wagner-flo.net [213.165.81.202]) by mx1.freebsd.org (Postfix) with ESMTP id 09A8D8FC08 for ; Wed, 19 Oct 2011 06:21:44 +0000 (UTC) Received: from auedv3.syscomp.de (umbracor.wagner-flo.net [127.0.0.1]) by umbracor.wagner-flo.net (Postfix) with ESMTPSA id D6B373C06C30; Wed, 19 Oct 2011 08:21:46 +0200 (CEST) Date: Wed, 19 Oct 2011 08:21:39 +0200 From: Florian Wagner To: Andriy Gapon Message-ID: <20111019082139.1661868e@auedv3.syscomp.de> In-Reply-To: <4E9ACA9F.5090308@FreeBSD.org> References: <20111015214347.09f68e4e@naclador.mos32.de> <4E9ACA9F.5090308@FreeBSD.org> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/MqGgbxzbrnCGjY92aocJCb="; protocol="application/pgp-signature" Cc: freebsd-fs@FreeBSD.org Subject: Re: Extending zfsboot.c to allow selecting filesystem from boot.config X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2011 06:21:45 -0000 --Sig_/MqGgbxzbrnCGjY92aocJCb= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable > on 15/10/2011 22:43 Florian Wagner said the following: > > Hi, > >=20 > > from looking at the code in sys/boot/i386/zfsboot/zfsboot.c the ZFS > > aware boot block already allows to select pool to load the kernel > > from by adding : to the boot.config. As this > > code calls the zfs_mount_pool function it will look for the bootfs > > property on the new pool or use its root dataset to get the file > > from there. > >=20 > > How much work would it be to extend the loader to also allow > > selecting a ZFS filesystem? > >=20 > > What I'd like to do is place a boot.config on the (otherwise empty) > > root of my system pool and then tell it to get the loader from > > another filesystem by putting > > "rpool/root/stable-8-r226381:/boot/zfsloader" in there. >=20 > Please check out the following changes: > https://gitorious.org/~avg/freebsd/avgbsd/commit/8c3808c4bb2a2cd746db3e9c= 46871c9bdf943ef6 > https://gitorious.org/~avg/freebsd/avgbsd/commit/0b4279c0d366d9f2b5bb9d4c= 0dd3229d8936d92b > https://gitorious.org/~avg/freebsd/avgbsd/commit/b29ab78b079f27918de1683e= 88bcb1817a0e5969 > https://gitorious.org/~avg/freebsd/avgbsd/commit/f49add15516dfd582258b682= 0b8f0254cf9419a3 > https://gitorious.org/~avg/freebsd/avgbsd/commit/e072b443b0f59fe1ff54a70d= 2437d63698bbf597 > https://gitorious.org/~avg/freebsd/avgbsd/commit/f701760c10812c5b6925352f= b003408c19170063 Looks great! I've applied the patches to my checkout of Stable 8 and gave the resulting gptzfsboot and zfsloader a cursory try in a virtual machine. Commit f701760c10812c5b6925352fb003408c19170063 breaks the build of the non-ZFS-enabled bootcode. The syntax is wrong in the following snippet if LOADER_ZFS_SUPPORT is not defined. Moving the closing bracket ("};") right after the second #endif into the preprocessor conditional fixes that. @@ -52,14 +52,21 @@ u_int32_t howto; u_int32_t bootdev; u_int32_t bootflags; +#ifdef LOADER_ZFS_SUPPORT union { +#endif struct { u_int32_t pxeinfo; u_int32_t res2; }; +#ifdef LOADER_ZFS_SUPPORT uint64_t zfspool; +#endif }; u_int32_t bootinfo; +#ifdef LOADER_ZFS_SUPPORT + uint64_t zfsroot; +#endif } *kargs; The only thing I was a bit confused by is that on the boot prompt only the pool and filename to be booted are printed. Apart from that it worked as expected. Not having to set vfs.root.mountfrom in the loader is nice. Regards and thanks Florian Wagner --Sig_/MqGgbxzbrnCGjY92aocJCb= Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk6ebHMACgkQLvW/2gp2pPw0rQCeN81YhLpkyZtw+KyMScOOSl1s bxgAoILoMmdsz1lWUC9ex6wunDl+rPRA =F9Av -----END PGP SIGNATURE----- --Sig_/MqGgbxzbrnCGjY92aocJCb=--