All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub + FreeBSD's loader(8) + ZFS root
@ 2010-02-22 23:40 Navdeep Parhar
  2010-02-23  3:06 ` Warning messages Seth Goldberg
  2010-04-07 10:28 ` [PATCH] grub + FreeBSD's loader(8) + ZFS root Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 8+ messages in thread
From: Navdeep Parhar @ 2010-02-22 23:40 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

Hello grub-devel,

Right now it's not possible to boot using FreeBSD's loader(8) from a ZFS
root filesystem.  Grub doesn't indicate to the loader that there is a
ZFS root involved and consequently the loader fails to find the kernel.
The attached patch fixes this.  It does not affect those that boot the
kernel directly.  This is only for users that want to boot using
FreeBSD's loader.

Why would you want to?  IMHO it is much simpler to boot indirectly using
the loader because in that case grub does not have to deal with
device.hints, kernel modules, kFreeBSD.xxx style variables,
/boot/zfs/zpool.cache, etc.  As a FreeBSD user, I'm used to putting this
information in the "normal" config files (/boot/loader.conf, device.hints,
etc.) and not in a grub.cfg file. Grub only needs to know where the loader
is, nothing else:

menuentry "FreeBSD 8" {
       search -s -l fbsd8
       kfreebsd -D /@/boot/zfsloader
}
(fbsd8 is the name of the ZFS root pool)

Let me know if you have any questions.  Once again, if you load the
kernel directly and want to load modules and set kFreeBSD.foo.bar=...
yourself, all that will continue to work.

Regards,
Navdeep

[-- Attachment #2: grub+zfsloader.diff --]
[-- Type: application/octet-stream, Size: 1560 bytes --]

diff -r 59814c4fed40 -r 21692a51cebb loader/i386/bsd.c
--- a/loader/i386/bsd.c	Thu Feb 18 13:44:25 2010 -0800
+++ b/loader/i386/bsd.c	Sun Feb 21 16:34:39 2010 -0800
@@ -54,6 +54,7 @@
 static grub_dl_t my_mod;
 static grub_addr_t entry, entry_hi, kern_start, kern_end;
 static grub_uint32_t bootflags;
+static grub_uint64_t zpool_guid = 0;
 static char *mod_buf;
 static grub_uint32_t mod_buf_len, mod_buf_max, kern_end_mdofs;
 static int is_elf_kernel, is_64bit;
@@ -559,7 +560,7 @@
     }
   else
     grub_unix_real_boot (entry, bootflags | FREEBSD_RB_BOOTINFO, bootdev,
-			 0, 0, 0, &bi, bi.tags, kern_end);
+			 zpool_guid ? 4 : 0, zpool_guid, &bi, bi.tags, kern_end);
 
   /* Not reached.  */
   return GRUB_ERR_NONE;
@@ -742,6 +743,7 @@
 
   grub_free (netbsd_root);
   netbsd_root = NULL;
+  zpool_guid = 0;
 
   return GRUB_ERR_NONE;
 }
@@ -954,6 +956,30 @@
   return result;
 }
 
+static void
+grub_fetch_zpool_guid(void)
+{
+  grub_device_t dev;
+  grub_fs_t fs;
+  char *uuid = NULL;
+
+  dev = grub_device_open (NULL);
+  if (! dev)
+    return;
+
+  fs = grub_fs_probe (dev);
+  if (! fs)
+    return;
+
+  if (grub_strcmp(fs->name, "zfs") != 0 ||
+      ! fs->uuid || fs->uuid (dev, &uuid) || !uuid)
+    return;
+
+  zpool_guid = grub_strtoull(uuid, NULL, 16);
+
+  grub_free (uuid);
+}
+
 static grub_err_t
 grub_cmd_freebsd (grub_extcmd_t cmd, int argc, char *argv[])
 {
@@ -1012,6 +1038,7 @@
 	    return err;
 	}
       grub_loader_set (grub_freebsd_boot, grub_bsd_unload, 1);
+      grub_fetch_zpool_guid();
     }
 
   return grub_errno;

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Warning messages
@ 2004-05-01 21:55 
  2004-05-03  9:33 ` Jörn Engel
  0 siblings, 1 reply; 8+ messages in thread
From:  @ 2004-05-01 21:55 UTC (permalink / raw)
  To: linux-kernel

Hello all,

    Everytime I compile the 2.6.5 Linux kernel I get these warning messages:

  AS	arch/i386/boot/setup.o
/usr/src/linux-2.6.5/arch/i386/boot/setup.S: Assembler messages:
/usr/src/linux-2.6.5/arch/i386/boot/setup.S:159: Warning: value 0x37ffffff truncated to 0x37ffffff

    What does it mean?

Thanks in advance.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-27  1:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-22 23:40 [PATCH] grub + FreeBSD's loader(8) + ZFS root Navdeep Parhar
2010-02-23  3:06 ` Warning messages Seth Goldberg
2010-02-23  8:05   ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-04-07 10:28 ` [PATCH] grub + FreeBSD's loader(8) + ZFS root Vladimir 'φ-coder/phcoder' Serbinenko
2010-04-07 20:21   ` Navdeep Parhar
2012-02-27  0:58     ` Vladimir 'φ-coder/phcoder' Serbinenko
  -- strict thread matches above, loose matches on Subject: below --
2004-05-01 21:55 Warning messages 
2004-05-03  9:33 ` Jörn Engel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.