Skip to contentSkip to conversation

Memdisk and embedded config options for grub-install

PATCH In review Glenn Washburn 2 participants 2 messages Nov 6, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Memdisk and embedded config options for grub-install

Hi all,

I've attached a patch to grub-install which adds an extra option for specifying a memdisk to install and an option to specify an embedded config which will be appended to the already generated embedded config (written to $prefix as load.cfg). I don't really need the options to be user visible, if that lowers the chance of the patch being included. But its nice to have these options when you want it.

Glenn

=== modified file 'util/grub-install.in'

grub-install.in +19 -0
@@ -54,6 +54,8 @@
 recheck=no
 debug=no
 debug_image=
+extra_config=
+memdisk=
 
 update_nvram=yes
 
@@ -107,6 +109,8 @@
   --no-floppy             do not probe any floppy drive
   --allow-floppy          Make the drive also bootable as floppy 
                           (default for fdX devices). May break on some BIOSes.
+  --extra-config=FILE     Append FILE to generated embedded config
+  --memdisk=FILE          add memdisk FILE to image
   --recheck               probe a device map even if it already exists
   --force                 install even if problems are detected
 EOF
@@ -249,6 +253,12 @@
     -f | --force)
         setup_force="--force" ;;
 
+    -c | --extra-config)
+        extra_config="`argument "$option" "$@"`"; shift;;
+
+    -m | --memdisk)
+        memdisk="`argument "$option" "$@"`"; shift;;
+
     -*)
 	echo "Unrecognized option \`$option'" 1>&2
 	usage
@@ -583,6 +593,15 @@
     prefix_drive=`"$grub_probe" --device-map="${device_map}" --target=drive --device "${grub_device}"` || exit 1
 fi
 
+if [ "x${extra_config}" != x ]; then
+    cat "${extra_config}" >> "${grubdir}/load.cfg"
+    config_opt="-c ${grubdir}/load.cfg "
+fi
+
+if [ "x${memdisk}" != x ]; then
+    config_opt="${config_opt} -m ${memdisk} "
+fi
+
 case "${target_cpu}-${platform}" in
     sparc64-ieee1275) mkimage_target=sparc64-ieee1275-raw ;;
     mipsel-loongson) mkimage_target=mipsel-loongson-elf ;;
#1 lore raw
Quoted 9 lines · Glenn Washburn

Hi all,

I've attached a patch to grub-install which adds an extra option for specifying a memdisk to install and an option to specify an embedded config which will be appended to the already generated embedded config (written to $prefix as load.cfg). I don't really need the options to be user visible, if that lowers the chance of the patch being included. But its nice to have these options when you want it.

What's the use of memdisk if prefix doesn't point to it? As for load.cfg it's use is only to find the prefix. if it doesn't do it correctly, it's a separate issue which must be dealt separately.

Quoted 7 lines

Glenn

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko