Skip to contentSkip to conversation

Fix root device passing

PATCH In review Samuel Thibault 4 participants 8 messages Nov 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix root device passing

Hello,

The patch below fixes passing root device to GNU Mach. With this applied (and some tuning in my hurd /dev/) and my other two patches, I could successfully run grub-install and boot!

Samuel

2009-11-02 Samuel Thibault <[email protected]>

* util/grub.d/10_hurd.in: Drop /dev/ prefix from root device path before giving it to GNU Mach.

grub.d/10_hurd.in +2 -1
Index: util/grub.d/10_hurd.in
===================================================================
@@ -72,8 +72,9 @@
 menuentry "${OS}" {
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
+ROOT_DEVICE=`echo ${GRUB_DEVICE} | sed -e 's:^/dev/::'`
 cat << EOF
-	multiboot ${kernel} root=device:${GRUB_DEVICE}
+	multiboot ${kernel} root=device:${ROOT_DEVICE}
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
 cat << EOF
#1 lore raw
Quoted 16 lines · Samuel Thibault

The patch below fixes passing root device to GNU Mach. With this applied (and some tuning in my hurd /dev/) and my other two patches, I could successfully run grub-install and boot!

Samuel

2009-11-02 Samuel Thibault <[email protected]>

* util/grub.d/10_hurd.in: Drop /dev/ prefix from root device path before giving it to GNU Mach.

Index: util/grub.d/10_hurd.in
===================================================================

grub.d/10_hurd.in line 80

Quoted 10 lines
grub.d/10_hurd.in +2 -1
@@ -72,8 +72,9 @@
 menuentry "${OS}" {
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
+ROOT_DEVICE=`echo ${GRUB_DEVICE} | sed -e 's:^/dev/::'`
 cat << EOF
-	multiboot ${kernel} root=device:${GRUB_DEVICE}
+	multiboot ${kernel} root=device:${ROOT_DEVICE}
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
 cat << EOF

'multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}' would be simpler and quicker.

Signature · 1 line
Colin Watson                                       [[email protected]]
#2 lore raw
Quoted 2 lines · Colin Watson, le Mon 02 Nov 2009 18:50:43 +0000, a écrit :

'multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}' would be simpler and quicker.

And will not work on some systems.

Samuel

#3 lore raw

Am Montag, den 02.11.2009, 19:53 +0100 schrieb Samuel Thibault:

Quoted 7 lines
Quoted 2 lines · Colin Watson, le Mon 02 Nov 2009 18:50:43 +0000, a écrit :

'multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}' would be simpler and quicker.

And will not work on some systems.

Samuel

Why ones?
I just looked in POSIX.1-2008 and it defines it.
Both bash and dash supports it.
Note that 10_hurd only gets installed if the host kernel is HURD. Is there any HURD based distribution avaible besides Debian?

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer
#4 lore raw

Am Montag, den 02.11.2009, 20:06 +0100 schrieb Felix Zielcke:

Quoted 10 lines

Am Montag, den 02.11.2009, 19:53 +0100 schrieb Samuel Thibault:

Quoted 7 lines
Quoted 2 lines · Colin Watson, le Mon 02 Nov 2009 18:50:43 +0000, a écrit :

'multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}' would be simpler and quicker.

And will not work on some systems.

Samuel

Why ones?

Uhm which ones of course.

Quoted 6 lines

I just looked in POSIX.1-2008 and it defines it.
Both bash and dash supports it.
Note that 10_hurd only gets installed if the host kernel is HURD. Is there any HURD based distribution avaible besides Debian?

Signature · 2 lines
Felix Zielcke
Proud Debian Maintainer and GNU GRUB developer
#5 lore raw
In reply to Felix Zielcke
Quoted 10 lines · Felix Zielcke, le Mon 02 Nov 2009 20:06:19 +0100, a écrit :

Am Montag, den 02.11.2009, 19:53 +0100 schrieb Samuel Thibault:

Quoted 7 lines
Quoted 2 lines · Colin Watson, le Mon 02 Nov 2009 18:50:43 +0000, a écrit :

'multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}' would be simpler and quicker.

And will not work on some systems.

Samuel

Which ones?

Solaris for instance.

Quoted 2 lines

I just looked in POSIX.1-2008 and it defines it.
Both bash and dash supports it.

Fortunately, yes.

Quoted 1 line

Note that 10_hurd only gets installed if the host kernel is HURD.

Ah, then ok.

Quoted 1 line

Is there any HURD based distribution avaible besides Debian?

There is the GNU distribution yes. In any case it's probably safe to assume that a GNU system uses at least a POSIX2008-compliant dash or posh. Here is an updated patch.

Samuel

2009-11-02 Samuel Thibault <[email protected]>

* util/grub.d/10_hurd.in: Drop /dev/ prefix from root device path before giving it to GNU Mach.

grub.d/10_hurd.in +1 -1
Index: util/grub.d/10_hurd.in
===================================================================
@@ -73,7 +73,7 @@
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
 cat << EOF
-	multiboot ${kernel} root=device:${GRUB_DEVICE}
+	multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
 cat << EOF
#6 lore raw
In reply to Samuel Thibault
Quoted 5 lines · Samuel Thibault
Quoted 2 lines · Colin Watson, le Mon 02 Nov 2009 18:50:43 +0000, a écrit :

'multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}' would be simpler and quicker.

And will not work on some systems.

I guess at least in the GNU system it's safe to assume that /bin/bash is available? ;-)

Note: we follow the convention of using hi case for global variables and low case for private ones, so at the least I'd s/ROOT_DEVICE/root_device/ here.

Signature · 5 lines
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."
#7 lore raw
Quoted 9 lines · Robert Millan, le Mon 02 Nov 2009 20:11:07 +0100, a écrit :
Quoted 5 lines · Samuel Thibault
Quoted 2 lines · Colin Watson, le Mon 02 Nov 2009 18:50:43 +0000, a écrit :

'multiboot ${kernel} root=device:${GRUB_DEVICE#/dev/}' would be simpler and quicker.

And will not work on some systems.

I guess at least in the GNU system it's safe to assume that /bin/bash is available? ;-)

bash, yes, but remember that /bin/sh could point to something else than bash. I believe we can however assume a /bin/sh that supports such substitution on the GNU system (note that dash used to not support it previously).

Quoted 3 lines

Note: we follow the convention of using hi case for global variables and low case for private ones, so at the least I'd s/ROOT_DEVICE/root_device/ here.

Ok, anyway it disappears.

Samuel