* [PATCH,HURD] Fix GNU/Hurd partition number
@ 2009-11-02 2:33 Samuel Thibault
2009-11-02 2:39 ` [PATCH,HURD] Fix 10_hurd for separate /boot case Samuel Thibault
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Samuel Thibault @ 2009-11-02 2:33 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 75 bytes --]
Hello,
This patch fixes partition number translation on GNU/Hurd.
Samuel
[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 614 bytes --]
2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
* util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from
GNU partition number to get internal grub DOS partition number.
Index: util/hostdisk.c
===================================================================
--- util/hostdisk.c (révision 2666)
+++ util/hostdisk.c (copie de travail)
@@ -1057,7 +1057,7 @@
n = strtol (p, &q, 10);
if (p != q && n != GRUB_LONG_MIN && n != GRUB_LONG_MAX)
{
- dos_part = (int) n;
+ dos_part = (int) n - 1;
if (*q >= 'a' && *q <= 'g')
bsd_part = *q - 'a';
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH,HURD] Fix 10_hurd for separate /boot case. 2009-11-02 2:33 [PATCH,HURD] Fix GNU/Hurd partition number Samuel Thibault @ 2009-11-02 2:39 ` Samuel Thibault 2009-11-02 13:55 ` Robert Millan 2009-11-02 13:52 ` [PATCH,HURD] Fix GNU/Hurd partition number Robert Millan 2009-11-21 14:34 ` [PATCH,HURD] Make grub-probe work on GNU/Hurd Samuel Thibault 2 siblings, 1 reply; 7+ messages in thread From: Samuel Thibault @ 2009-11-02 2:39 UTC (permalink / raw) To: grub-devel [-- Attachment #1: Type: text/plain, Size: 104 bytes --] Hello, This patch fixes the 10_hurd script in the case where /boot is in a separate partition. Samuel [-- Attachment #2: patch --] [-- Type: text/plain, Size: 873 bytes --] 2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org> * util/grub.d/10_hurd.in: Call prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} before loading /boot kernel. Index: util/grub.d/10_hurd.in =================================================================== --- util/grub.d/10_hurd.in (révision 2666) +++ util/grub.d/10_hurd.in (copie de travail) @@ -71,9 +71,12 @@ cat << EOF menuentry "${OS}" { EOF +prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/" +cat << EOF + multiboot ${kernel} root=device:${GRUB_DEVICE} +EOF prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/" cat << EOF - multiboot ${kernel} root=device:${GRUB_DEVICE} module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\ --multiboot-command-line='\${kernel-command-line}' \\ --host-priv-port='\${host-port}' \\ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH,HURD] Fix 10_hurd for separate /boot case. 2009-11-02 2:39 ` [PATCH,HURD] Fix 10_hurd for separate /boot case Samuel Thibault @ 2009-11-02 13:55 ` Robert Millan 0 siblings, 0 replies; 7+ messages in thread From: Robert Millan @ 2009-11-02 13:55 UTC (permalink / raw) To: The development of GRUB 2 On Mon, Nov 02, 2009 at 03:39:40AM +0100, Samuel Thibault wrote: > Hello, > > This patch fixes the 10_hurd script in the case where /boot is in a > separate partition. Committed, thanks. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all." ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH,HURD] Fix GNU/Hurd partition number 2009-11-02 2:33 [PATCH,HURD] Fix GNU/Hurd partition number Samuel Thibault 2009-11-02 2:39 ` [PATCH,HURD] Fix 10_hurd for separate /boot case Samuel Thibault @ 2009-11-02 13:52 ` Robert Millan 2009-11-02 17:28 ` Samuel Thibault 2009-11-21 14:34 ` [PATCH,HURD] Make grub-probe work on GNU/Hurd Samuel Thibault 2 siblings, 1 reply; 7+ messages in thread From: Robert Millan @ 2009-11-02 13:52 UTC (permalink / raw) To: The development of GRUB 2 On Mon, Nov 02, 2009 at 03:33:34AM +0100, Samuel Thibault wrote: > Hello, > > This patch fixes partition number translation on GNU/Hurd. > > Samuel > 2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org> > > * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from > GNU partition number to get internal grub DOS partition number. Are you sure this is needed? We use the same numbering scheme as GNU/Hurd. (hd0,1) means first partition, so does /dev/hd0s1. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all." ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH,HURD] Fix GNU/Hurd partition number 2009-11-02 13:52 ` [PATCH,HURD] Fix GNU/Hurd partition number Robert Millan @ 2009-11-02 17:28 ` Samuel Thibault 2009-11-02 19:14 ` Robert Millan 0 siblings, 1 reply; 7+ messages in thread From: Samuel Thibault @ 2009-11-02 17:28 UTC (permalink / raw) To: The development of GRUB 2 Robert Millan, le Mon 02 Nov 2009 14:52:02 +0100, a écrit : > On Mon, Nov 02, 2009 at 03:33:34AM +0100, Samuel Thibault wrote: > > * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from > > GNU partition number to get internal grub DOS partition number. > > Are you sure this is needed? We use the same numbering scheme as GNU/Hurd. > (hd0,1) means first partition, so does /dev/hd0s1. Externally, yes. Internally, no, cf make_device_name: if (dos_part >= 0) sprintf (p + strlen (p), ",%d", dos_part + 1); so from hd0s1 I need to provide dos_part==0 in order to get (hd0,1). Samuel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH,HURD] Fix GNU/Hurd partition number 2009-11-02 17:28 ` Samuel Thibault @ 2009-11-02 19:14 ` Robert Millan 0 siblings, 0 replies; 7+ messages in thread From: Robert Millan @ 2009-11-02 19:14 UTC (permalink / raw) To: The development of GRUB 2 On Mon, Nov 02, 2009 at 06:28:58PM +0100, Samuel Thibault wrote: > Robert Millan, le Mon 02 Nov 2009 14:52:02 +0100, a écrit : > > On Mon, Nov 02, 2009 at 03:33:34AM +0100, Samuel Thibault wrote: > > > * util/hostdisk.c (grub_util_biosdisk_get_grub_dev): Subtract 1 from > > > GNU partition number to get internal grub DOS partition number. > > > > Are you sure this is needed? We use the same numbering scheme as GNU/Hurd. > > (hd0,1) means first partition, so does /dev/hd0s1. > > Externally, yes. > Internally, no, cf make_device_name: > > if (dos_part >= 0) > sprintf (p + strlen (p), ",%d", dos_part + 1); > > so from hd0s1 I need to provide dos_part==0 in order to get (hd0,1). Oh, ok. -- Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all." ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH,HURD] Make grub-probe work on GNU/Hurd 2009-11-02 2:33 [PATCH,HURD] Fix GNU/Hurd partition number Samuel Thibault 2009-11-02 2:39 ` [PATCH,HURD] Fix 10_hurd for separate /boot case Samuel Thibault 2009-11-02 13:52 ` [PATCH,HURD] Fix GNU/Hurd partition number Robert Millan @ 2009-11-21 14:34 ` Samuel Thibault 2 siblings, 0 replies; 7+ messages in thread From: Samuel Thibault @ 2009-11-21 14:34 UTC (permalink / raw) To: grub-devel Hello, After discussions between Hurd developers, here is a patch to implement grub_guess_root_device() natively by directly asking the fs translator. This is the last bit needed to get grub-install working. Samuel 2009-11-21 Samuel Thibault <samuel.thibault@ens-lyon.org> * util/getroot.c: [__GNU__] Include <hurd.h>, <hurd/lookup.h>, and <hurd/fs.h> (grub_guess_root_device): [__GNU__] Call file_name_lookup and file_get_storage_info to implement grub_guess_root_device. Index: util/getroot.c =================================================================== --- util/getroot.c (révision 2694) +++ util/getroot.c (copie de travail) @@ -30,6 +30,12 @@ # define DEV_CYGDRIVE_MAJOR 98 #endif +#ifdef __GNU__ +#include <hurd.h> +#include <hurd/lookup.h> +#include <hurd/fs.h> +#endif + #include <grub/util/misc.h> #include <grub/util/hostdisk.h> #include <grub/util/getroot.h> @@ -378,9 +384,66 @@ char * grub_guess_root_device (const char *dir) { - struct stat st; char *os_dev; +#ifdef __GNU__ + file_t file; + mach_port_t *ports; + int *ints; + loff_t *offsets; + char *data; + error_t err; + mach_msg_type_number_t num_ports = 0, num_ints = 0, num_offsets = 0, data_len = 0; + size_t name_len; + file = file_name_lookup (dir, 0, 0); + if (file == MACH_PORT_NULL) + return 0; + + err = file_get_storage_info (file, + &ports, &num_ports, + &ints, &num_ints, + &offsets, &num_offsets, + &data, &data_len); + + if (num_ints < 1) + grub_util_error ("Storage info for `%s' does not include type", dir); + if (ints[0] != STORAGE_DEVICE) + grub_util_error ("Filesystem of `%s' is not stored on local disk", dir); + + if (num_ints < 5) + grub_util_error ("Storage info for `%s' does not include name", dir); + name_len = ints[4]; + if (name_len < data_len) + grub_util_error ("Bogus name length for storage info for `%s'", dir); + if (data[name_len - 1] != '\0') + grub_util_error ("Storage name for `%s' not NUL-terminated", dir); + + os_dev = xmalloc (strlen ("/dev/") + data_len); + memcpy (os_dev, "/dev/", strlen ("/dev/")); + memcpy (os_dev + strlen ("/dev/"), data, data_len); + + if (ports && num_ports > 0) + { + mach_msg_type_number_t i; + for (i = 0; i < num_ports; i++) + { + mach_port_t port = ports[i]; + if (port != MACH_PORT_NULL) + mach_port_deallocate (mach_task_self(), port); + } + munmap ((caddr_t) ports, num_ports * sizeof (*ports)); + } + + if (ints && num_ints > 0) + munmap ((caddr_t) ints, num_ints * sizeof (*ints)); + if (offsets && num_offsets > 0) + munmap ((caddr_t) offsets, num_offsets * sizeof (*offsets)); + if (data && data_len > 0) + munmap (data, data_len); + mach_port_deallocate (mach_task_self (), file); +#else /* !__GNU__ */ + struct stat st; + if (stat (dir, &st) < 0) grub_util_error ("Cannot stat `%s'", dir); @@ -393,6 +456,7 @@ /* This might be truly slow, but is there any better way? */ os_dev = find_root_device ("/dev", st.st_dev); #endif +#endif /* !__GNU__ */ return os_dev; } ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-11-21 14:35 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-11-02 2:33 [PATCH,HURD] Fix GNU/Hurd partition number Samuel Thibault 2009-11-02 2:39 ` [PATCH,HURD] Fix 10_hurd for separate /boot case Samuel Thibault 2009-11-02 13:55 ` Robert Millan 2009-11-02 13:52 ` [PATCH,HURD] Fix GNU/Hurd partition number Robert Millan 2009-11-02 17:28 ` Samuel Thibault 2009-11-02 19:14 ` Robert Millan 2009-11-21 14:34 ` [PATCH,HURD] Make grub-probe work on GNU/Hurd Samuel Thibault
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.