* [RFC, RFT] Use ZFS embedding area
@ 2011-11-06 21:10 Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-06 22:59 ` Seth Goldberg
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-11-06 21:10 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1.1: Type: text/plain, Size: 206 bytes --]
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.
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: zfsembed.diff --]
[-- Type: text/x-diff; name="zfsembed.diff", Size: 1406 bytes --]
=== 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;
}
+#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 != 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 = (VDEV_BOOT_SIZE >> GRUB_DISK_SECTOR_BITS);
+ *sectors = grub_malloc (*nsectors * sizeof (**sectors));
+ if (!*sectors)
+ return grub_errno;
+ for (i = 0; i < *nsectors; i++)
+ (*sectors)[i] = i + (VDEV_BOOT_OFFSET >> GRUB_DISK_SECTOR_BITS);
+
+ return GRUB_ERR_NONE;
+}
+#endif
+
static struct grub_fs grub_zfs_fs = {
.name = "zfs",
.dir = grub_zfs_dir,
@@ -3769,6 +3798,10 @@
.label = zfs_label,
.uuid = zfs_uuid,
.mtime = zfs_mtime,
+#ifdef GRUB_UTIL
+ .embed = grub_zfs_embed,
+ .reserved_first_sector = 1,
+#endif
.next = 0
};
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC, RFT] Use ZFS embedding area
2011-11-06 21:10 [RFC, RFT] Use ZFS embedding area Vladimir 'φ-coder/phcoder' Serbinenko
@ 2011-11-06 22:59 ` Seth Goldberg
2011-11-10 8:33 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 3+ messages in thread
From: Seth Goldberg @ 2011-11-06 22:59 UTC (permalink / raw)
To: The development of GNU GRUB
Hi,
Aside from a typo ("curently" -> "currently"), it looks great! I vote for a commit :).
--S
On Nov 6, 2011, at 1:10 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> 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.
>
> --
> Regards
> Vladimir 'φ-coder/phcoder' Serbinenko
>
> <zfsembed.diff>_______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC, RFT] Use ZFS embedding area
2011-11-06 22:59 ` Seth Goldberg
@ 2011-11-10 8:33 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2011-11-10 8:33 UTC (permalink / raw)
To: The development of GNU GRUB; +Cc: Seth Goldberg
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]
On 06.11.2011 23:59, Seth Goldberg wrote:
> Hi,
>
> Aside from a typo ("curently" -> "currently"), it looks great! I vote for a commit :).
>
Have you tested it?
> --S
>
> On Nov 6, 2011, at 1:10 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>
>> 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.
>>
>> --
>> Regards
>> Vladimir 'φ-coder/phcoder' Serbinenko
>>
>> <zfsembed.diff>_______________________________________________
>> Grub-devel mailing list
>> Grub-devel@gnu.org
>> https://lists.gnu.org/mailman/listinfo/grub-devel
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-11-10 8:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-06 21:10 [RFC, RFT] Use ZFS embedding area Vladimir 'φ-coder/phcoder' Serbinenko
2011-11-06 22:59 ` Seth Goldberg
2011-11-10 8:33 ` Vladimir 'φ-coder/phcoder' Serbinenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).