From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YikGR-0007aG-2x for mharc-grub-devel@gnu.org; Thu, 16 Apr 2015 09:55:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YibZA-0002me-68 for grub-devel@gnu.org; Thu, 16 Apr 2015 00:38:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YibZ6-0002QM-W4 for grub-devel@gnu.org; Thu, 16 Apr 2015 00:38:16 -0400 Received: from mail-lb0-x22d.google.com ([2a00:1450:4010:c04::22d]:36451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YibZ6-0002Q1-H3 for grub-devel@gnu.org; Thu, 16 Apr 2015 00:38:12 -0400 Received: by lbbqq2 with SMTP id qq2so49502705lbb.3 for ; Wed, 15 Apr 2015 21:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=K9L5NWWAr/RnujmBhlCZrZt0Gt/UCKSJ6UfuNp1/gPM=; b=fWaLkn8evM6NQIAm7mt3OzwBsoJIz+XKm36lE11ODF3wmY4ybDST7DRdPKUMNvyZX0 80vmp+PAF2eHfIexHe8mNvlNUX32JbUZf5JumdPjJ41XxWQDVg8e6e/snLhiuyQVGuHd AYMC3AYKIwYOx6Gpo0jqE3YB3yfDBe4KCqmamXFj77+gj3Vtv2K3J28kdyt5Ree0QNHD dARpn/hMG2YwHU5M60AjafdQZyy4Y6uEuTSDLMrax78ysRuHknZwfKlzVtEB6ro3OPxS 4X4LkzD4n2po4itwZ5DlU/Xh/Z1wUaGOzHs+mLUVd1QaKAW4C3fPwa47EGuyRbafF47M /NIw== X-Received: by 10.112.146.41 with SMTP id sz9mr27382615lbb.77.1429159091601; Wed, 15 Apr 2015 21:38:11 -0700 (PDT) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id ds8sm1382708lbb.18.2015.04.15.21.38.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 21:38:10 -0700 (PDT) Date: Thu, 16 Apr 2015 07:38:09 +0300 From: Andrei Borzenkov To: Toomas Soome Subject: Re: [PATCH] added support for whole disk zfs embedding Message-ID: <20150416073809.2e44ea8b@opensuse.site> In-Reply-To: <05C74058-90D9-4E68-A29A-7E4C1C906F2E@me.com> References: <05C74058-90D9-4E68-A29A-7E4C1C906F2E@me.com> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.27; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::22d Cc: The development of GNU GRUB X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Apr 2015 04:38:17 -0000 =D0=92 Wed, 15 Apr 2015 23:00:11 +0300 Toomas Soome =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > hi! >=20 > well, scratch please the previous zfs related updates, sorry for confusio= n:) >=20 > anyhow, next small chunk adds support for "whole disk" (GPT partitioned) = zpool embedding. if the disk already got BIOS boot partition, it will be us= ed, if there is none, zfs partition is used and grub is embedded to zpool b= ootblock area. No. Linux never paid any attention to partition types (neither MBR nor GPT) and we have no idea how partition is used. That is why grub-bios-setup actually checks that we *do* know what is on this partition and ensures there is reserved space for embedding. bios_grub is different - here we explicitly declare this partition type as reserved for GRUB. The right thing to do is to decouple boot code from core.img on install similar to grub-(install|buis-setup) --embed /dev/sda1 /dev/sda which will embed into reserved area on /dev/sda1 and write boot code into MBR pointing at /dev/sda1.=20 I'm fine with making it --boot-code /dev/sda /dev/sda1 :) >=20 > rgds, > toomas >=20 > --- > grub-core/fs/zfs/zfs.c | 2 +- > grub-core/partmap/gpt.c | 9 +++++++++ > include/grub/gpt_partition.h | 7 +++++++ > 3 files changed, 17 insertions(+), 1 deletion(-) >=20 > diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c > index 0cbb84b..2689986 100644 > --- a/grub-core/fs/zfs/zfs.c > +++ b/grub-core/fs/zfs/zfs.c > @@ -4291,7 +4291,7 @@ static struct grub_fs grub_zfs_fs =3D { > #ifdef GRUB_UTIL > .embed =3D grub_zfs_embed, > .reserved_first_sector =3D 1, > - .blocklist_install =3D 0, > + .blocklist_install =3D 1, Why? Nothing in your patch enables blocklists support on ZFS nor is it even remotely possible for all I can tell. > #endif > .next =3D 0 > }; > diff --git a/grub-core/partmap/gpt.c b/grub-core/partmap/gpt.c > index 83bcba7..cacc8e8 100644 > --- a/grub-core/partmap/gpt.c > +++ b/grub-core/partmap/gpt.c > @@ -24,6 +24,8 @@ > #include > #include > #include > +#include > +#include > #include > =20 > GRUB_MOD_LICENSE ("GPLv3+"); > @@ -37,6 +39,7 @@ static const grub_gpt_part_type_t grub_gpt_partition_ty= pe_empty =3D GRUB_GPT_PARTI > =20 > #ifdef GRUB_UTIL > static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot =3D = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT; > +static const grub_gpt_part_type_t grub_gpt_partition_type_zfs =3D GRUB_G= PT_PARTITION_TYPE_ZFS; > #endif > =20 > /* 512 << 7 =3D 65536 byte sectors. */ > @@ -162,6 +165,12 @@ find_usable_region (grub_disk_t disk __attribute__ (= (unused)), > return 1; > } > =20 > + if (! grub_memcmp (&gptdata.type, &grub_gpt_partition_type_zfs, 16)) > + { > + ctx->start =3D p->start + (VDEV_BOOT_OFFSET >> GRUB_DISK_SECTOR_BI= TS); > + ctx->len =3D (VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS); > + return 1; > + } > return 0; > } > =20 > diff --git a/include/grub/gpt_partition.h b/include/grub/gpt_partition.h > index 1b32f67..04c9f97 100644 > --- a/include/grub/gpt_partition.h > +++ b/include/grub/gpt_partition.h > @@ -50,6 +50,13 @@ typedef struct grub_gpt_part_type grub_gpt_part_type_t; > { 0x85, 0xD2, 0xE1, 0xE9, 0x04, 0x34, 0xCF, 0xB3 } \ > } > =20 > +#define GRUB_GPT_PARTITION_TYPE_ZFS \ > + { grub_cpu_to_le32_compile_time (0x6A898CC3U),\ > + grub_cpu_to_le16_compile_time (0x1DD2), \ > + grub_cpu_to_le16_compile_time (0x11B2), \ > + { 0x99, 0xA6, 0x08, 0x00, 0x20, 0x73, 0x66, 0x31 } \ > + } > + > struct grub_gpt_header > { > grub_uint8_t magic[8];