Skip to contentSkip to conversation

Fix GNU/Hurd boot

PATCH In review Samuel Thibault 2 participants 7 messages Oct 21, 2009 – Oct 26, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix GNU/Hurd boot

Hello,

The patch compensates the behavior change in the module command: it repeats the module name since GNU Mach expects it in the command line.

Samuel

grub.cfg +2 -2
Index: docs/grub.cfg
===================================================================
@@ -15,13 +15,13 @@
 menuentry "GNU (aka GNU/Hurd)" {
 	set root=(hd0,1)
 	multiboot /boot/gnumach.gz root=device:hd0s1
-	module /hurd/ext2fs.static --readonly \
+	module /hurd/ext2fs.static ext2fs --readonly \
 			--multiboot-command-line='${kernel-command-line}' \
 			--host-priv-port='${host-port}' \
 			--device-master-port='${device-port}' \
 			--exec-server-task='${exec-task}' -T typed '${root}' \
 			'$(task-create)' '$(task-resume)'
-	module /lib/ld.so.1 /hurd/exec '$(exec-task=task-create)'
+	module /lib/ld.so.1 exec /hurd/exec '$(exec-task=task-create)'
 }
 
 # For booting GNU/Linux
grub.d/10_hurd.in +2 -2
Index: util/grub.d/10_hurd.in
===================================================================
@@ -74,12 +74,12 @@
 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
 cat << EOF
 	multiboot ${kernel} root=device:${GRUB_DEVICE}
-	module /hurd/${hurd_fs}.static --readonly \\
+	module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
 			--multiboot-command-line='\${kernel-command-line}' \\
 			--host-priv-port='\${host-port}' \\
 			--device-master-port='\${device-port}' \\
 			--exec-server-task='\${exec-task}' -T typed '\${root}' \\
 			'\$(task-create)' '\$(task-resume)'
-	module /lib/ld.so.1 /hurd/exec '\$(exec-task=task-create)'
+	module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
 }
 EOF
#1 lore raw
Quoted 4 lines · Samuel Thibault

Hello,

The patch compensates the behavior change in the module command: it repeats the module name since GNU Mach expects it in the command line.

Committed, thanks. Btw please include a ChangeLog entry next time.

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."
#2 lore raw

PATCH 1/1 Fix GNU/Hurd menu entry generation

In reply to Samuel Thibault

Hello,

The patch below fixes menu entry generation for GNU/Hurd.

Samuel

2009-20-26 Samuel Thibault <[email protected]>

* util/grub.d/30_os-prober.in: Add GNU/Hurd support
* util/grub.d/10_hurd.in: Translate grub device name into mach device name.

grub.d/30_os-prober.in +22 -1
Index: util/grub.d/30_os-prober.in
===================================================================
@@ -155,7 +155,28 @@
 EOF
     ;;
     hurd|*)
-      echo "  ${LONGNAME} is not yet supported by grub-mkconfig." >&2
+      cat << EOF
+menuentry "${LONGNAME} (on ${DEVICE})" {
+EOF
+      prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
+      GRUB_DEVICE="`${grub_probe} --device ${DEVICE} --target=drive`"
+      mach_device="`echo "${GRUB_DEVICE}" | tr -d '()' | tr , s`"
+      HURD_FS="`${grub_probe} --device ${DEVICE} --target=fs`"
+      case "${GRUB_FS}" in
+	*fs)	hurd_fs="${GRUB_FS}" ;;
+	*)	hurd_fs="${GRUB_FS}fs" ;;
+      esac
+      cat << EOF
+	multiboot /boot/gnumach.gz root=device:${mach_device}
+	module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
+			--multiboot-command-line='\${kernel-command-line}' \\
+			--host-priv-port='\${host-port}' \\
+			--device-master-port='\${device-port}' \\
+			--exec-server-task='\${exec-task}' -T typed '\${root}' \\
+			'\$(task-create)' '\$(task-resume)'
+	module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
+}
+EOF
     ;;
   esac
 done
grub.d/10_hurd.in +2 -1
Index: util/grub.d/10_hurd.in
===================================================================
@@ -48,6 +48,7 @@
   *fs)	hurd_fs="${GRUB_FS}" ;;
   *)	hurd_fs="${GRUB_FS}fs" ;;
 esac
+mach_device="`echo "${GRUB_DEVICE}" | tr -d '()' | tr , s`"
 
 for i in /hurd/${hurd_fs}.static /hurd/exec ; do
   if test -e "$i" ; then
@@ -73,7 +74,7 @@
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
 cat << EOF
-	multiboot ${kernel} root=device:${GRUB_DEVICE}
+	multiboot ${kernel} root=device:${mach_device}
 	module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
 			--multiboot-command-line='\${kernel-command-line}' \\
 			--host-priv-port='\${host-port}' \\
#3 lore raw

Re: [PATCH,HURD] Fix GNU/Hurd menu entry generation

grub.d/10_hurd.in line 77

Quoted 12 lines · Samuel Thibault
grub.d/10_hurd.in +3 -1
+      mach_device="`echo "${GRUB_DEVICE}" | tr -d '()' | tr , s`"
[...]
+mach_device="`echo "${GRUB_DEVICE}" | tr -d '()' | tr , s`"
 
 for i in /hurd/${hurd_fs}.static /hurd/exec ; do
   if test -e "$i" ; then
@@ -73,7 +74,7 @@
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
 cat << EOF
-	multiboot ${kernel} root=device:${GRUB_DEVICE}
+	multiboot ${kernel} root=device:${mach_device}

I think you missunderstand what GRUB_DEVICE is (not surprising, because the variable name is quite misleading). Did you observe wrong entry generation in grub-mkconfig?

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."
#4 lore raw

Re: [PATCH,HURD] Fix GNU/Hurd menu entry generation

Quoted 9 lines · Robert Millan, le Mon 26 Oct 2009 02:48:48 +0100, a écrit :

grub.d/10_hurd.in line 77

Quoted 6 lines
grub.d/10_hurd.in +1 -1
@@ -73,7 +74,7 @@
 EOF
 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
 cat << EOF
-	multiboot ${kernel} root=device:${GRUB_DEVICE}
+	multiboot ${kernel} root=device:${mach_device}

I think you missunderstand what GRUB_DEVICE is (not surprising, because the variable name is quite misleading).

Ah, that's possible, is it actually DEVICE? If so, then you can probably skip that part of the patch indeed.

Quoted 1 line

Did you observe wrong entry generation in grub-mkconfig?

I didn't try that part of my patch as there are other things that prevent grub2 from working from inside GNU/Hurd itself.

Samuel

#5 lore raw

Re: [PATCH,HURD] Fix GNU/Hurd menu entry generation

Quoted 4 lines · Samuel Thibault
Quoted 1 line

Did you observe wrong entry generation in grub-mkconfig?

I didn't try that part of my patch as there are other things that prevent grub2 from working from inside GNU/Hurd itself.

Which are these? It's unfortunate that nobody reported this before 1.97 was released. Perhaps I should test GRUB on GNU/Hurd before doing a release.

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."
#6 lore raw

Re: [PATCH,HURD] Fix GNU/Hurd menu entry generation

Quoted 7 lines · Robert Millan, le Mon 26 Oct 2009 13:36:13 +0100, a écrit :
Quoted 4 lines · Samuel Thibault
Quoted 1 line

Did you observe wrong entry generation in grub-mkconfig?

I didn't try that part of my patch as there are other things that prevent grub2 from working from inside GNU/Hurd itself.

Which are these?

Various things that we never took the time to implement, like discovering disks & such.

Samuel