All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] memdisk + grub-mkrescue
Date: Mon, 21 Jan 2008 17:52:09 +0100	[thread overview]
Message-ID: <20080121165209.GA2557@thorin> (raw)

[-- Attachment #1: Type: text/plain, Size: 238 bytes --]


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

[-- Attachment #2: memdisk_and_mkrescue_marriage.diff --]
[-- Type: text/x-diff, Size: 2945 bytes --]


	* 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}
 

             reply	other threads:[~2008-01-21 16:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 16:52 Robert Millan [this message]
2008-01-21 17:47 ` [PATCH] memdisk + grub-mkrescue Pavel Roskin
2008-01-21 21:06   ` Robert Millan
2008-01-22  2:11     ` Pavel Roskin
2008-01-22 14:02       ` Robert Millan
2008-01-22 14:55         ` Pavel Roskin
2008-01-22 15:17           ` Robert Millan
2008-01-23  7:51             ` Pavel Roskin
2008-01-23  9:15               ` Robert Millan
2008-01-23 15:22                 ` Pavel Roskin
2008-01-23 19:03                   ` Marco Gerards
2008-01-23 19:28                     ` Pavel Roskin
2008-01-31 14:35                       ` Robert Millan
2008-01-31 17:12                         ` Pavel Roskin
2008-01-31 17:35                           ` Marco Gerards
2008-01-31 18:00                             ` Pavel Roskin
2008-01-31 18:50                               ` Marco Gerards
2008-01-31 20:13                                 ` Pavel Roskin
2008-01-21 21:09   ` grub_cpio_find_file() finds unexisting files (Re: [PATCH] memdisk + grub-mkrescue) Robert Millan
2008-01-22  2:01     ` Pavel Roskin
2008-01-22 10:12       ` Bean
2008-01-23 10:45 ` [PATCH] memdisk + grub-mkrescue Marco Gerards
2008-01-23 11:01   ` Robert Millan
2008-01-23 11:20     ` Marco Gerards
2008-01-23 11:25       ` Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080121165209.GA2557@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.