From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1RN9zY-0005Cg-N3 for mharc-grub-devel@gnu.org; Sun, 06 Nov 2011 16:11:00 -0500 Received: from eggs.gnu.org ([140.186.70.92]:54422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN9zU-00058O-Jz for grub-devel@gnu.org; Sun, 06 Nov 2011 16:10:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RN9zT-0007tp-FP for grub-devel@gnu.org; Sun, 06 Nov 2011 16:10:56 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:33298) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN9zT-0007tl-8g for grub-devel@gnu.org; Sun, 06 Nov 2011 16:10:55 -0500 Received: by faaf16 with SMTP id f16so5805535faa.0 for ; Sun, 06 Nov 2011 13:10:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type; bh=R3N672qx//uJ4sLk6jbPEnuEYq9B+VWYIlXKy26KMIw=; b=AlTU34Pbmcbw8mbiyQp0BOubSCUcs1VREd8BFO03GKG+OJiR1uBvFB9uWlzGFHRIw7 5mDfL1tTRVaAZNJcCDTMKWgKxL9U+otu/93tOhvPRzhHglDfCD020EsUTQqL8EFiRGJs SSCNVJBanb704KN7au/3bAyLxonPVlTdwNUCU= Received: by 10.223.62.209 with SMTP id y17mr41487648fah.7.1320613854143; Sun, 06 Nov 2011 13:10:54 -0800 (PST) Received: from debian.x201.phnet (134-129.203-62.cust.bluewin.ch. [62.203.129.134]) by mx.google.com with ESMTPS id k26sm28386703fab.8.2011.11.06.13.10.52 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 06 Nov 2011 13:10:53 -0800 (PST) Message-ID: <4EB6F7DB.30408@gmail.com> Date: Sun, 06 Nov 2011 22:10:51 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20111010 Iceowl/1.0b2 Icedove/3.1.15 MIME-Version: 1.0 To: The development of GRUB 2 Subject: [RFC, RFT] Use ZFS embedding area X-Enigmail-Version: 1.1.2 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigA0294AB9333F9E2378ECD7BD" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.41 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: Sun, 06 Nov 2011 21:10:57 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA0294AB9333F9E2378ECD7BD Content-Type: multipart/mixed; boundary="------------000602030106000701070903" This is a multi-part message in MIME format. --------------000602030106000701070903 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Attached patch makes it possible to install GRUB into ZFS partition or whole-disk ZFS sanely. May be dangerous so I recommend a VM and/or backup= =2E --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------000602030106000701070903 Content-Type: text/x-diff; name="zfsembed.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="zfsembed.diff" =3D=3D=3D modified file 'grub-core/fs/zfs/zfs.c' --- grub-core/fs/zfs/zfs.c 2011-11-06 20:08:32 +0000 +++ grub-core/fs/zfs/zfs.c 2011-11-06 20:56:34 +0000 @@ -3760,6 +3760,35 @@ return grub_errno; } =20 +#ifdef GRUB_UTIL +static grub_err_t +grub_zfs_embed (grub_device_t device __attribute__ ((unused)), + unsigned int *nsectors, + grub_embed_type_t embed_type, + grub_disk_addr_t **sectors) +{ + unsigned i; + + if (embed_type !=3D GRUB_EMBED_PCBIOS) + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, + "ZFS curently supports only PC-BIOS embedding"); + + if ((VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS) < *nsectors) + return grub_error (GRUB_ERR_OUT_OF_RANGE, + "Your core.img is unusually large. " + "It won't fit in the embedding area."); + + *nsectors =3D (VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS); + *sectors =3D grub_malloc (*nsectors * sizeof (**sectors)); + if (!*sectors) + return grub_errno; + for (i =3D 0; i < *nsectors; i++) + (*sectors)[i] =3D i + (VDEV_BOOT_OFFSET >> GRUB_DISK_SECTOR_BITS); + + return GRUB_ERR_NONE; +} +#endif + static struct grub_fs grub_zfs_fs =3D { .name =3D "zfs", .dir =3D grub_zfs_dir, @@ -3769,6 +3798,10 @@ .label =3D zfs_label, .uuid =3D zfs_uuid, .mtime =3D zfs_mtime, +#ifdef GRUB_UTIL + .embed =3D grub_zfs_embed, + .reserved_first_sector =3D 1, +#endif .next =3D 0 }; =20 --------------000602030106000701070903-- --------------enigA0294AB9333F9E2378ECD7BD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAk6299sACgkQNak7dOguQgnaGQEAvvt9rJcHSjkc/fBvCDK5Am3F /h5g6lHG6Q103vvzWtgA/1Z2YHX4mgcv3EuVweEuEsIIO2YT2pIQgNy/ECxrFTeH =MCP9 -----END PGP SIGNATURE----- --------------enigA0294AB9333F9E2378ECD7BD--