[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

customizing grub-mkrecue images

From: Neal H. Walfield
Subject: customizing grub-mkrecue images
Date: Sat, 17 Jan 2009 04:14:45 +0100
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.7 Emacs/22.2 (i486-pc-linux-gnu) MULE/5.0 (SAKAKI)


grub-mkrescue is quite useful, however, I'd like to be able to
customize the image it creates a bit more than it currently supports.
In particular, I'd like to load another config file at boot time.  The
attached patch enables this by way of a new option, --configfile.

A more general solution to the customization problem would be to load
a config file at image compilation time.  This could be used to solve
my problem.  However, as it is an additional level of indirection,
perhaps both options would be useful.



2009-01-17  Neal H. Walfield  <address@hidden>

        * util/i386/pc/ Add new option --configfile.  If
        not the set and not the empty string, load it from the generated
        config file on boot.

Index: util/i386/pc/
--- util/i386/pc/       (revision 1946)
+++ util/i386/pc/       (working copy)
@@ -49,6 +49,7 @@
   --image-type=TYPE       select floppy or cdrom (default)
   --emulation=TYPE        select El Torito boot emulation type floppy
                           or none (default) (cdrom only)
+  --configfile=FILE       config file to load (default: none)
 grub-mkimage generates a bootable rescue image of the specified type.
@@ -93,6 +94,9 @@
             echo "Unknown emulation type \`$emulation'" 1>&2
             exit 1 ;;
         esac ;;
+    --configfile=*)
+       configfile=`echo "$option" | sed 's/--configfile=//'`
+        ;;
        echo "Unrecognized option \`$option'" 1>&2
@@ -121,9 +125,15 @@
 modules="biosdisk `cat ${input_dir}/partmap.lst` ${modules}"
-for i in ${modules} ; do
-  echo "insmod $i"
-done > ${aux_dir}/boot/grub/grub.cfg
+  for i in ${modules} ; do
+    echo "insmod $i"
+  done
+  if test x$configfile != x
+  then
+    echo "configfile $configfile"
+  fi
+} > ${aux_dir}/boot/grub/grub.cfg
 for d in ${overlay}; do
   echo "Overlaying $d"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]