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

Comments?

-- 
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.

diff -x '*~' -x '*.mk' -Nurp grub2/kern/i386/pc/init.c memdisk/kern/i386/pc/init.c
--- grub2/kern/i386/pc/init.c	2008-01-21 00:41:58.000000000 +0100
+++ memdisk/kern/i386/pc/init.c	2008-01-21 16:54:55.000000000 +0100
@@ -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',
diff -x '*~' -x '*.mk' -Nurp grub2/util/i386/pc/grub-mkrescue.in memdisk/util/i386/pc/grub-mkrescue.in
--- grub2/util/i386/pc/grub-mkrescue.in	2007-07-22 01:32:32.000000000 +0200
+++ memdisk/util/i386/pc/grub-mkrescue.in	2008-01-21 17:46:04.000000000 +0100
@@ -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}
 
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to