Skip to contentSkip to conversation

memdisk + grub-mkrescue

PATCH In review Robert Millan 4 participants 25 messages Jan 21, 2008 – Jan 31, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memdisk + grub-mkrescue

These two were predestined to get together.. attached patch for their wedding.

Comments?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)

* kern/i386/pc/init.c (make_install_device): When memdisk image is present, "(memdisk)/boot/grub" becomes the default prefix.

* util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus a memdisk tarball with all the modules. Add --overlay=DIR option that allows users to overlay additional files into the image.

kern/i386/pc/init.c +6 -1
diff -x '*~' -x '*.mk' -Nurp grub2/kern/i386/pc/init.c memdisk/kern/i386/pc/init.c
@@ -64,7 +64,12 @@ make_install_device (void)
   /* XXX: This should be enough.  */
   char dev[100];
 
-  if (grub_install_dos_part != -2)
+  if (grub_memdisk_image_size)
+    {
+      grub_sprintf (dev, "(memdisk)%s", grub_prefix);
+      grub_strcpy (grub_prefix, dev);
+    }
+  else if (grub_install_dos_part != -2)
     {
       grub_sprintf (dev, "(%cd%u",
 		    (grub_boot_drive & 0x80) ? 'h' : 'f',
util/i386/pc/grub-mkrescue.in +19 -5
diff -x '*~' -x '*.mk' -Nurp grub2/util/i386/pc/grub-mkrescue.in memdisk/util/i386/pc/grub-mkrescue.in
@@ -42,6 +42,7 @@ Make GRUB rescue image.
   -h, --help              print this message and exit
   -v, --version           print the version information and exit
   --modules=MODULES       pre-load specified modules MODULES
+  --overlay=DIR           overlay directory DIR in the memdisk image
   --pkglibdir=DIR         use images from directory DIR instead of ${pkglibdir}
   --grub-mkimage=FILE     use FILE as grub-mkimage
   --image-type=TYPE       select floppy or cdrom (default)
@@ -67,6 +68,8 @@ for option in "$@"; do
 	exit 0 ;;
     --modules=*)
 	modules=`echo "$option" | sed 's/--modules=//'` ;;
+    --overlay=*)
+	overlay=`echo "$option" | sed 's/--overlay=//'` ;;
     --pkglibdir=*)
 	input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
     --grub-mkimage=*)
@@ -99,18 +102,29 @@ if test "x$output_image" = x; then
   exit 1
 fi
 
-if [ "x${modules}" = "x" ] ; then
-  modules=`cd ${input_dir}/ && ls *.mod`
-fi
-
 if [ "x${image_type}" = "xfloppy" ] ; then
   floppy_image=${output_image}
 else
   floppy_image=`mktemp`
 fi
 
+memdisk_dir=`mktemp -d`
+mkdir -p ${memdisk_dir}/boot/grub
+cp ${input_dir}/*.mod \
+  ${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
+  ${memdisk_dir}/boot/grub/
+
+if test "x$overlay" = x ; then : ; else
+  cp -dpR ${overlay}/* ${memdisk_dir}/
+fi
+
+memdisk_img=`mktemp`
+tar -C ${memdisk_dir} -cf ${memdisk_img} boot
+rm -rf ${memdisk_dir}
+
 core_img=`mktemp`
-${grub_mkimage} -d ${input_dir}/ -o ${core_img} ${modules}
+${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk cpio biosdisk ${modules}
+rm -f ${memdisk_img}
 cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > $floppy_image
 rm -f ${core_img}
 
#1 lore raw
Quoted 4 lines · Robert Millan

These two were predestined to get together.. attached patch for their wedding.

Comments?

I really like the ability to add more things than just modules (especially grub.cfg and fonts). Is that the main motivation for your patch? Or you have some other things in mind?

I've tested the patch, and it seems to be OK, although I was surprised to see an empty menu on startup. Perhaps a command line would be more appropriate in absence of grub.cfg?

I don't quite understand why "biosdisk" needs to be mandatory. I guess it's not initialized by default, so that it doesn't conflict with the ata module. But ata can load on top of biosdisk (but not the other way around).

Signature · 2 lines
Regards,
Pavel Roskin
#2 lore raw
Quoted 9 lines · Pavel Roskin
Quoted 4 lines · Robert Millan

These two were predestined to get together.. attached patch for their wedding.

Comments?

I really like the ability to add more things than just modules (especially grub.cfg and fonts). Is that the main motivation for your patch? Or you have some other things in mind?

Yes, that's it. Specially for situations in which there's no other way (like netboot images, or in the future coreboot when it works on ELF).

Quoted 4 lines

I don't quite understand why "biosdisk" needs to be mandatory. I guess it's not initialized by default, so that it doesn't conflict with the ata module. But ata can load on top of biosdisk (but not the other way around).

I just added it because we don't seem to have a way to define which modules should be autoloaded (other than grub.cfg itself). And I'm afraid not loading it by default will confuse users. I don't know how to improve this, but ideas are welcome, of course.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#3 lore raw
Quoted 5 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 3 lines · Robert Millan

These two were predestined to get together.. attached patch for their wedding.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Comments?

I really like the ability to add more things than just modules (especially grub.cfg and fonts). Is that the main motivation for your patch? Or you have some other things in mind?

Yes, that's it. Specially for situations in which there's no other way (like netboot images, or in the future coreboot when it works on ELF).

I wish I could use it on PowerPC to work around the "claim failed" problem, but I'll still need to link "memdisk" and "cpio" with grub-mkimage.

I have a patch for PowerPC, but I think I'll hold it until your patch is committed. I could change my patch to be more in-sync with i386, in particular use /boot/grub as the blessed directory.

Quoted 9 lines
Quoted 4 lines

I don't quite understand why "biosdisk" needs to be mandatory. I guess it's not initialized by default, so that it doesn't conflict with the ata module. But ata can load on top of biosdisk (but not the other way around).

I just added it because we don't seem to have a way to define which modules should be autoloaded (other than grub.cfg itself). And I'm afraid not loading it by default will confuse users. I don't know how to improve this, but ideas are welcome, of course.

Actually, if biosdisk is a part of the core image, other modules are preloaded. I don't quite understand the mechanism. I think it should be OK for now. Then we can refine the loading and the initialization.

Signature · 2 lines
Regards,
Pavel Roskin
#4 lore raw
Quoted 4 lines · Pavel Roskin

I wish I could use it on PowerPC to work around the "claim failed" problem, but I'll still need to link "memdisk" and "cpio" with grub-mkimage.

I don't understand. How would this work around the problem?

Quoted 3 lines

I have a patch for PowerPC, but I think I'll hold it until your patch is committed. I could change my patch to be more in-sync with i386, in particular use /boot/grub as the blessed directory.

Cool! Could you send it to the list? I'd like to see if it'll work on i386-elf targets.

Quoted 7 lines
Quoted 4 lines

I just added it because we don't seem to have a way to define which modules should be autoloaded (other than grub.cfg itself). And I'm afraid not loading it by default will confuse users. I don't know how to improve this, but ideas are welcome, of course.

Actually, if biosdisk is a part of the core image, other modules are preloaded. I don't quite understand the mechanism.

Ah. Could be, yes. The mechanism is basicaly that GRUB checks for an *.lst file (I forgot which) which teaches it which dependencies each module has.

In core.img build time I don't know, but it's probably the same.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#5 lore raw

Quoting Robert Millan <[email protected]>:

Quoted 7 lines · Pavel Roskin
Quoted 4 lines

I wish I could use it on PowerPC to work around the "claim failed" problem, but I'll still need to link "memdisk" and "cpio" with grub-mkimage.

I don't understand. How would this work around the problem?

It would work around the problem if appending modules to kernel.elf with grub-mkimage could be completely avoided.

Quoted 6 lines
Quoted 3 lines

I have a patch for PowerPC, but I think I'll hold it until your patch is committed. I could change my patch to be more in-sync with i386, in particular use /boot/grub as the blessed directory.

Cool! Could you send it to the list? I'd like to see if it'll work on i386-elf targets.

OK, attached. Sorry, this mailer would break the patch otherwise.

Quoted 4 lines

Ah. Could be, yes. The mechanism is basicaly that GRUB checks for an *.lst file (I forgot which) which teaches it which dependencies each module has.

In core.img build time I don't know, but it's probably the same.

That explains why biosdisk is not loaded by itself. No module depends on it (which is correct).

Signature · 2 lines
Regards,
Pavel Roskin

Create mkrescue for PowerPC

From: Pavel Roskin <[email protected]>

---

 DISTLIST                               |    1 
 conf/powerpc-ieee1275.mk               |   10 +++
 conf/powerpc-ieee1275.rmk              |    4 +
 util/powerpc/ieee1275/grub-mkrescue.in |  115 ++++++++++++++++++++++++++++++++
 4 files changed, 130 insertions(+), 0 deletions(-)
 create mode 100644 util/powerpc/ieee1275/grub-mkrescue.in
DISTLIST +1 -0
index c2766b4..bf164b6 100644
@@ -326,6 +326,7 @@ util/i386/pc/misc.c
 util/i386/pc/grub-mkrescue.in
 util/ieee1275/get_disk_name.c
 util/powerpc/ieee1275/grub-install.in
+util/powerpc/ieee1275/grub-mkrescue.in
 util/powerpc/ieee1275/misc.c
 video/bitmap.c
 video/video.c
conf/powerpc-ieee1275.mk +10 -0
index 1dc4b3f..efe912e 100644
@@ -663,6 +663,7 @@ kernel_elf_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
 
 # Scripts.
 sbin_SCRIPTS = grub-install
+bin_SCRIPTS = grub-mkrescue
 
 # For grub-install.
 grub_install_SOURCES = util/powerpc/ieee1275/grub-install.in
@@ -673,6 +674,15 @@ grub-install: util/powerpc/ieee1275/grub-install.in config.status
 	chmod +x $@
 
 
+# For grub-mkrescue.
+grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
+CLEANFILES += grub-mkrescue
+
+grub-mkrescue: util/powerpc/ieee1275/grub-mkrescue.in config.status
+	./config.status --file=grub-mkrescue:util/powerpc/ieee1275/grub-mkrescue.in
+	chmod +x $@
+
+
 # Modules.
 pkglib_MODULES = halt.mod \
 	_linux.mod \
conf/powerpc-ieee1275.rmk +4 -0
index d26bcb5..e05565d 100644
@@ -97,10 +97,14 @@ kernel_elf_LDFLAGS = $(COMMON_LDFLAGS) -static-libgcc -lgcc \
 
 # Scripts.
 sbin_SCRIPTS = grub-install
+bin_SCRIPTS = grub-mkrescue
 
 # For grub-install.
 grub_install_SOURCES = util/powerpc/ieee1275/grub-install.in
 
+# For grub-mkrescue.
+grub_mkrescue_SOURCES = util/powerpc/ieee1275/grub-mkrescue.in
+
 # Modules.
 pkglib_MODULES = halt.mod \
 	_linux.mod \
util/powerpc/ieee1275/grub-mkrescue.in new file +115 -0

115 lines not on this page · raw message

#6 lore raw
Quoted 10 lines · Pavel Roskin
Quoted 7 lines · Pavel Roskin
Quoted 4 lines

I wish I could use it on PowerPC to work around the "claim failed" problem, but I'll still need to link "memdisk" and "cpio" with grub-mkimage.

I don't understand. How would this work around the problem?

It would work around the problem if appending modules to kernel.elf with grub-mkimage could be completely avoided.

Ah, I see. But as you point out, you still need memdisk and cpio. Maybe we could put these two in kernel when we have "grub-mkimage -m" support for ELF, but it looks very ugly to me! :-)

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I have a patch for PowerPC, but I think I'll hold it until your patch is committed. I could change my patch to be more in-sync with i386, in particular use /boot/grub as the blessed directory.

Cool! Could you send it to the list? I'd like to see if it'll work on i386-elf targets.

OK, attached. Sorry, this mailer would break the patch otherwise.

Ah, I think I missunderstood. I thought you implemented "grub-mkimage -m" switch.

util/powerpc/ieee1275/grub-mkrescue.in line 4

Quoted 2 lines
util/powerpc/ieee1275/grub-mkrescue.in new file +2 -0
+# Make GRUB rescue image
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free Software Foundation, Inc.

Missing 2008 here.

util/powerpc/ieee1275/grub-mkrescue.in line 101

Quoted 5 lines
util/powerpc/ieee1275/grub-mkrescue.in new file +5 -0
+map_file=`mktemp`
+cat >${map_file} <<EOF
+# EXTN          XLate   CREATOR   TYPE     Comment
+grub.img        Raw     'UNIX'    'tbxi'   "bootstrap"
+EOF

How standard is this format? Is this targetted only at one OFW vendor?

Quoted 2 lines

+genisoimage -hfs -part -no-desktop -r -J -o ${output_image} \
+ -map ${map_file} -hfs-bless ${boot_dir} ${iso_dir}

Same here.

Perhaps this should be mentioned in --help or something?

In the future we could add --image-type= options for other platforms like i386-pc does with floppy/cdrom ?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#7 lore raw

Quoting Robert Millan <[email protected]>:

Quoted 7 lines · Pavel Roskin
Quoted 6 lines
Quoted 6 lines · Pavel Roskin
Quoted 4 lines

I wish I could use it on PowerPC to work around the "claim failed" problem, but I'll still need to link "memdisk" and "cpio" with grub-mkimage.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I don't understand. How would this work around the problem?

It would work around the problem if appending modules to kernel.elf with grub-mkimage could be completely avoided.

Ah, I see. But as you point out, you still need memdisk and cpio. Maybe we could put these two in kernel when we have "grub-mkimage -m" support for ELF, but it looks very ugly to me! :-)

I think I'll submit a patch that introduces the gap between the core end and the modules. It's better that nothing. There was a gap before, just much bigger.

Quoted 11 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

I have a patch for PowerPC, but I think I'll hold it until your patch is committed. I could change my patch to be more in-sync with i386, in particular use /boot/grub as the blessed directory.

Cool! Could you send it to the list? I'd like to see if it'll work on i386-elf targets.

OK, attached. Sorry, this mailer would break the patch otherwise.

Ah, I think I missunderstood. I thought you implemented "grub-mkimage -m" switch.

Sorry, not yet.

Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+# Make GRUB rescue image
+# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007  Free  
 Software Foundation, Inc.

Missing 2008 here.

Quoted 7 lines

util/powerpc/ieee1275/grub-mkrescue.in line 101

Quoted 5 lines
util/powerpc/ieee1275/grub-mkrescue.in new file +5 -0
+map_file=`mktemp`
+cat >${map_file} <<EOF
+# EXTN          XLate   CREATOR   TYPE     Comment
+grub.img        Raw     'UNIX'    'tbxi'   "bootstrap"
+EOF

How standard is this format? Is this targetted only at one OFW vendor?

The text format is probably specific to genisoimage. But the attributes themselves are used by PowerPC based Apple machines. Macs look for bootloader in the "blessed" directory. The bootloader should have "tbxi" type.

I haven't tried to emulate CHRP and PREP yet. I know that Fedora LiveCD generator uses additional tricks for both. I think it's possible to support them.

Quoted 4 lines
Quoted 2 lines

+genisoimage -hfs -part -no-desktop -r -J -o ${output_image} \
+ -map ${map_file} -hfs-bless ${boot_dir} ${iso_dir}

Same here.

It's all hfs specific.

Quoted 1 line

Perhaps this should be mentioned in --help or something?

Maybe.

Quoted 2 lines

In the future we could add --image-type= options for other platforms like i386-pc does with floppy/cdrom ?

My Mac has no floppy, but if qemu emulates it correctly, I could try it.

I understand that PREP need some "boot image" that needs to be put on the CD, so that's another possible image type.

Signature · 2 lines
Regards,
Pavel Roskin
#8 lore raw
Quoted 4 lines · Pavel Roskin

I think I'll submit a patch that introduces the gap between the core end and the modules. It's better that nothing. There was a gap before, just much bigger.

Ah, we had this before? You mean before Hollis removed it, right?

Quoted 7 lines
Quoted 2 lines

In the future we could add --image-type= options for other platforms like i386-pc does with floppy/cdrom ?

My Mac has no floppy, but if qemu emulates it correctly, I could try it.

I understand that PREP need some "boot image" that needs to be put on the CD, so that's another possible image type.

What I mean is that we have things like --image-type=prep|whatever. Although maybe it is confusing..

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#9 lore raw

Quoting Robert Millan <[email protected]>:

Quoted 7 lines · Pavel Roskin
Quoted 4 lines

I think I'll submit a patch that introduces the gap between the core end and the modules. It's better that nothing. There was a gap before, just much bigger.

Ah, we had this before? You mean before Hollis removed it, right?

Yes. That's it:

-/* Where grub-mkimage places the core modules in memory. */ -#define GRUB_IEEE1275_MODULE_BASE 0x00300000

It's not exactly a gap per se, but if the modules are placed at 3 Mb, there would be a gap.

Quoted 2 lines

What I mean is that we have things like --image-type=prep|whatever. Although maybe it is confusing..

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

Signature · 2 lines
Regards,
Pavel Roskin
#10 lore raw
Quoted 15 lines · Pavel Roskin

Quoting Robert Millan <[email protected]>:

Quoted 7 lines · Pavel Roskin
Quoted 4 lines

I think I'll submit a patch that introduces the gap between the core end and the modules. It's better that nothing. There was a gap before, just much bigger.

Ah, we had this before? You mean before Hollis removed it, right?

Yes. That's it:

(quoted diff) +0 -2
-/* Where grub-mkimage places the core modules in memory.  */
-#define GRUB_IEEE1275_MODULE_BASE 0x00300000
Quoted 8 lines

It's not exactly a gap per se, but if the modules are placed at 3 Mb, there would be a gap.

Quoted 2 lines

What I mean is that we have things like --image-type=prep|whatever. Although maybe it is confusing..

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

If you mean UDF, it is not supported (yet).

--
Marco

#11 lore raw
Quoted 4 lines · Marco Gerards
Quoted 2 lines

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

If you mean UDF, it is not supported (yet).

I mean Apple/CHRP/PREP.

Signature · 2 lines
Regards,
Pavel Roskin
#12 lore raw
Quoted 7 lines · Pavel Roskin
Quoted 4 lines · Marco Gerards
Quoted 2 lines

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

If you mean UDF, it is not supported (yet).

I mean Apple/CHRP/PREP.

Were you going to check this in? I didn't see any problems with it, IIRC.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#13 lore raw
Quoted 10 lines · Robert Millan
Quoted 7 lines · Pavel Roskin
Quoted 4 lines · Marco Gerards
Quoted 2 lines

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

If you mean UDF, it is not supported (yet).

I mean Apple/CHRP/PREP.

Were you going to check this in? I didn't see any problems with it, IIRC.

Checked in with ChangeLog fixes suggested by Marco.

Signature · 2 lines
Regards,
Pavel Roskin
#14 lore raw
Quoted 6 lines · Pavel Roskin
Quoted 5 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 3 lines · Marco Gerards
Quoted 2 lines

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

If you mean UDF, it is not supported (yet).

I mean Apple/CHRP/PREP.

Were you going to check this in? I didn't see any problems with it, IIRC.

Checked in with ChangeLog fixes suggested by Marco.

Not entirely, you missed this one:

"> * conf/powerpc-ieee1275.mk: Add grub-mkrescue support.

I guess you mean .rmk? Please mention the changes you made."

--
Marco

#15 lore raw
Quoted 14 lines · Marco Gerards
Quoted 12 lines · Pavel Roskin
Quoted 10 lines · Robert Millan
Quoted 7 lines · Pavel Roskin
Quoted 4 lines · Marco Gerards
Quoted 2 lines

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

If you mean UDF, it is not supported (yet).

I mean Apple/CHRP/PREP.

Were you going to check this in? I didn't see any problems with it, IIRC.

Quoted 7 lines
Quoted 1 line

Checked in with ChangeLog fixes suggested by Marco.

Not entirely, you missed this one:

"> * conf/powerpc-ieee1275.mk: Add grub-mkrescue support.

I guess you mean .rmk? Please mention the changes you made."

I fixed that part. It's "rmk" now. And I don't understand what kind of changes you want me to describe. I don't see long descriptions for changes in *.rmk files.

Signature · 2 lines
Regards,
Pavel Roskin
#16 lore raw
Quoted 19 lines · Pavel Roskin
Quoted 18 lines · Marco Gerards
Quoted 6 lines · Pavel Roskin
Quoted 5 lines · Robert Millan
Quoted 4 lines · Pavel Roskin
Quoted 3 lines · Marco Gerards
Quoted 2 lines

I see. Considering that there is enough space on a CD, I'd go with universal images, if at all possible.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

If you mean UDF, it is not supported (yet).

I mean Apple/CHRP/PREP.

Were you going to check this in? I didn't see any problems with it, IIRC.

Checked in with ChangeLog fixes suggested by Marco.

Not entirely, you missed this one:

Quoted 7 lines
Quoted 3 lines

"> * conf/powerpc-ieee1275.mk: Add grub-mkrescue support.

I guess you mean .rmk? Please mention the changes you made."

I fixed that part. It's "rmk" now. And I don't understand what kind of changes you want me to describe. I don't see long descriptions for changes in *.rmk files.

What do you mean? Please check the latest changelog entries. Changes are described in detail. Like when you add a variable, which is what you did twice. Can you please correct this, so the history is complete? :-)

--
Marco

#17 lore raw
Quoted 4 lines · Marco Gerards

What do you mean? Please check the latest changelog entries. Changes are described in detail. Like when you add a variable, which is what you did twice. Can you please correct this, so the history is complete? :-)

Done.

Signature · 2 lines
Regards,
Pavel Roskin
#18 lore raw

grub_cpio_find_file() finds unexisting files (Re: [PATCH] memdisk + grub-mkrescue)

In reply to Pavel Roskin
Quoted 4 lines · Pavel Roskin

I've tested the patch, and it seems to be OK, although I was surprised to see an empty menu on startup. Perhaps a command line would be more appropriate in absence of grub.cfg?

I wanted to send a new mail about this, and then forgot.

This is because of a bug in cpio.mod. The menu code thinks grub.cfg is present due to grub_cpio_find_file() returning here:

      if (!hd.name[0])
        {
          *ofs = 0;
          return GRUB_ERR_NONE;
        }

but I'm too clueless about tar format to figure this out.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#19 lore raw

Re: grub_cpio_find_file() finds unexisting files (Re: [PATCH] memdisk + grub-mkrescue)

Quoted 11 lines · Robert Millan
Quoted 4 lines · Pavel Roskin

I've tested the patch, and it seems to be OK, although I was surprised to see an empty menu on startup. Perhaps a command line would be more appropriate in absence of grub.cfg?

I wanted to send a new mail about this, and then forgot.

This is because of a bug in cpio.mod. The menu code thinks grub.cfg is present due to grub_cpio_find_file() returning here:

Quoted 7 lines
      if (!hd.name[0])
        {
          *ofs = 0;
          return GRUB_ERR_NONE;
        }

but I'm too clueless about tar format to figure this out.

I guess the meaning of GRUB_ERR_NONE is confusing (no file vs. no error), and the return value of grub_cpio_find_file() is not well defined.

Perhaps it should be GRUB_ERR_FILE_NOT_FOUND instead.

Signature · 2 lines
Regards,
Pavel Roskin
#20 lore raw

Re: grub_cpio_find_file() finds unexisting files (Re: [PATCH] memdisk + grub-mkrescue)

Quoted 19 lines · Pavel Roskin
Quoted 17 lines · Robert Millan
Quoted 4 lines · Pavel Roskin

I've tested the patch, and it seems to be OK, although I was surprised to see an empty menu on startup. Perhaps a command line would be more appropriate in absence of grub.cfg?

I wanted to send a new mail about this, and then forgot.

This is because of a bug in cpio.mod. The menu code thinks grub.cfg is present due to grub_cpio_find_file() returning here:

      if (!hd.name[0])
        {
          *ofs = 0;
          return GRUB_ERR_NONE;
        }
Quoted 7 lines
Quoted 1 line

but I'm too clueless about tar format to figure this out.

I guess the meaning of GRUB_ERR_NONE is confusing (no file vs. no error), and the return value of grub_cpio_find_file() is not well defined.

Perhaps it should be GRUB_ERR_FILE_NOT_FOUND instead.

you're right, i didn't notice this previously.

Signature · 1 line
Bean
#21 lore raw
In reply to Robert Millan
Quoted 15 lines · Robert Millan

These two were predestined to get together.. attached patch for their wedding.

Comments?

Signature · 9 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)


	* kern/i386/pc/init.c (make_install_device): When memdisk image is
	present, "(memdisk)/boot/grub" becomes the default prefix.

Sounds sane to me.

Quoted 3 lines

* util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus a memdisk tarball with all the modules. Add --overlay=DIR option that allows users to overlay additional files into the image.

Overlay means that I can add a grub.cfg easily?

This patch helps me a lot :-)

--
Marco

#22 lore raw
Quoted 18 lines · Marco Gerards
Quoted 15 lines · Robert Millan

These two were predestined to get together.. attached patch for their wedding.

Comments?

Signature · 9 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)


	* kern/i386/pc/init.c (make_install_device): When memdisk image is
	present, "(memdisk)/boot/grub" becomes the default prefix.
Quoted 7 lines

Sounds sane to me.

Quoted 3 lines

* util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus a memdisk tarball with all the modules. Add --overlay=DIR option that allows users to overlay additional files into the image.

Overlay means that I can add a grub.cfg easily?

It means you can do:

mkdir -p boot/grub
zile boot/grub/grub.cfg
grub-mkrescue --overlay=boot

Of course, it'd be easier if you could just add it directly, but I really think having this in a separate directory is a good idea (in case user wants to add random stuff to her memdisk).

So I'm not sure if it can be improved. Does it seem fine as-is ?

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
#23 lore raw

Robert Millan <[email protected]> writes:

[...]

Quoted 8 lines
Quoted 1 line

Overlay means that I can add a grub.cfg easily?

It means you can do:

mkdir -p boot/grub
zile boot/grub/grub.cfg
grub-mkrescue --overlay=boot

Quoted 5 lines

Of course, it'd be easier if you could just add it directly, but I really think having this in a separate directory is a good idea (in case user wants to add random stuff to her memdisk).

So I'm not sure if it can be improved. Does it seem fine as-is ?

Seems good to me :-)

--
Marco

#24 lore raw
Quoted 12 lines · Marco Gerards

Robert Millan <[email protected]> writes:

[...]

Quoted 8 lines
Quoted 1 line

Overlay means that I can add a grub.cfg easily?

It means you can do:

mkdir -p boot/grub
zile boot/grub/grub.cfg
grub-mkrescue --overlay=boot

Quoted 7 lines
Quoted 5 lines

Of course, it'd be easier if you could just add it directly, but I really think having this in a separate directory is a good idea (in case user wants to add random stuff to her memdisk).

So I'm not sure if it can be improved. Does it seem fine as-is ?

Seems good to me :-)

Ok, committed.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)