From a9f099a853e5c4c02cdb031ed43c9633a69b6c08 Mon Sep 17 00:00:00 2001 From: Ulrich Dangel Date: Fri, 16 Dec 2011 14:20:48 +0100 Subject: [PATCH] Introduce new config files for grub bootloader. grub.cfg automatically loads all *_default and *_options.cfg files. This requires the regexp module for grub. Thanks to Jordan Uggla for his input. --- etc/grml/fai/config/scripts/GRMLBASE/45-efi | 2 +- templates/boot/grub/%SHORT_NAME%_default.cfg | 5 ++ templates/boot/grub/%SHORT_NAME%_options.cfg | 55 +++++++++++++ templates/boot/grub/addons.cfg | 58 +++++++++++++ templates/boot/grub/grub.cfg | 119 +-------------------------- 5 files changed, 123 insertions(+), 116 deletions(-) create mode 100644 templates/boot/grub/%SHORT_NAME%_default.cfg create mode 100644 templates/boot/grub/%SHORT_NAME%_options.cfg create mode 100644 templates/boot/grub/addons.cfg diff --git a/etc/grml/fai/config/scripts/GRMLBASE/45-efi b/etc/grml/fai/config/scripts/GRMLBASE/45-efi index eef55da..23ae3c6 100755 --- a/etc/grml/fai/config/scripts/GRMLBASE/45-efi +++ b/etc/grml/fai/config/scripts/GRMLBASE/45-efi @@ -45,7 +45,7 @@ $ROOTCMD grub-mkimage -O x86_64-efi -o "$GRUB_EFI_IMAGE" --prefix=/boot/grub/ -- bitmap boot btrfs cat chain cmp configfile cpio echo efi_gop \ efi_uga elf ext2 fat gfxmenu gfxterm gzio help iso9660 jpeg linux \ loopback lvm minicmd multiboot normal part_gpt part_msdos png \ - probe raid reiserfs search search_fs_file search_fs_uuid \ + probe raid regexp reiserfs search search_fs_file search_fs_uuid \ search_label squash4 terminal test video videoinfo xfs if ! [ -r "${target}/${GRUB_EFI_IMAGE}" ] ; then diff --git a/templates/boot/grub/%SHORT_NAME%_default.cfg b/templates/boot/grub/%SHORT_NAME%_default.cfg new file mode 100644 index 0000000..8d798f5 --- /dev/null +++ b/templates/boot/grub/%SHORT_NAME%_default.cfg @@ -0,0 +1,5 @@ +menuentry "%GRML_NAME% - release %VERSION% (default)" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce + initrd /boot/%SHORT_NAME%/initrd.img +} diff --git a/templates/boot/grub/%SHORT_NAME%_options.cfg b/templates/boot/grub/%SHORT_NAME%_options.cfg new file mode 100644 index 0000000..db1d24f --- /dev/null +++ b/templates/boot/grub/%SHORT_NAME%_options.cfg @@ -0,0 +1,55 @@ +submenu "%GRML_NAME% - advanced options ->" --class=submenu { +menuentry "%GRML_NAME% - enable persistent mode" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" persistent=nofiles + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - copy Grml to RAM" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" toram=%GRML_NAME%.squashfs + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - copy whole medium to RAM" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" toram + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - start X by default" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" startx + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - disable framebuffer" { + set gfxpayload=text + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" video=ofonly radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 nomodeset + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - disable Kernel Mode-Setting" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 nomodeset + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - forensic mode" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" readonly nofstab noraid nodmraid nolvm noautoconfig noswap raid=noautodetect + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - debug mode" { + set gfxpayload=keep + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" initcall verbose debug=vc + initrd /boot/%SHORT_NAME%/initrd.img +} + +menuentry "%GRML_NAME% - serial mode" { + set gfxpayload=text + linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" video=vesafb:off console=tty1 console=ttyS0,9600n8 + initrd /boot/%SHORT_NAME%/initrd.img +} +} diff --git a/templates/boot/grub/addons.cfg b/templates/boot/grub/addons.cfg new file mode 100644 index 0000000..b25b1e1 --- /dev/null +++ b/templates/boot/grub/addons.cfg @@ -0,0 +1,58 @@ +submenu "Addons ->" --class=submenu { +menuentry "Memory test (memtest86+)" { + linux16 /boot/addons/memtest +} + +menuentry "iPXE - boot via network/PXE" { + linux16 /boot/addons/ipxe.lkrn +} + +menuentry "GRUB - all in one image" { + linux16 /boot/addons/memdisk + initrd16 /boot/addons/allinone.img +} + +menuentry "FreeDOS" { + linux16 /boot/addons/memdisk + initrd16 /boot/addons/balder10.imz +} + +if [ ${iso_path} ] ; then + # assume loopback.cfg boot + menuentry "MirOS bsd4grml (via loopback)" { + multiboot /boot/addons/bsd4grml/ldbsd.com + module /boot/addons/bsd4grml/bsd.rd bsd + module /boot/addons/bsd4grml/loopback.0 boot.cfg + module /boot/addons/bsd4grml/loopback.1 boot.1 + module /boot/addons/bsd4grml/loopback.2 boot.2 + module /boot/addons/bsd4grml/loopback.3 boot.3 + module /boot/addons/bsd4grml/loopback.4 boot.4 + module /boot/addons/bsd4grml/loopback.5 boot.5 + module /boot/addons/bsd4grml/loopback.6 boot.6 + } +else + # assume grub.cfg boot + menuentry "MirOS bsd4grml (regular method)" { + multiboot /boot/addons/bsd4grml/ldbsd.com + } + + menuentry "MirOS bsd4grml (fallback method)" { + multiboot /boot/addons/bsd4grml/ldbsd.com + module /boot/addons/bsd4grml/bsd.rd bsd.rd + module /boot/addons/bsd4grml/boot.1 boot.1 + module /boot/addons/bsd4grml/boot.2 boot.2 + module /boot/addons/bsd4grml/boot.3 boot.3 + module /boot/addons/bsd4grml/boot.4 boot.4 + module /boot/addons/bsd4grml/boot.5 boot.5 + module /boot/addons/bsd4grml/boot.6 boot.6 + module /boot/addons/bsd4grml/boot.cfg boot.cfg + module /boot/grub/core.img core.img + } +fi + +} + +menuentry "Boot OS of first partition on first disk" { + set root=(hd0,1) + chainloader +1 +} diff --git a/templates/boot/grub/grub.cfg b/templates/boot/grub/grub.cfg index bb814b9..71f7e31 100644 --- a/templates/boot/grub/grub.cfg +++ b/templates/boot/grub/grub.cfg @@ -24,120 +24,9 @@ if [ ${iso_path} ] ; then set loopback="findiso=${iso_path}" fi -menuentry "%GRML_NAME% - release %VERSION% (default)" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% "${loopback}" "${kernelopts}" nomce - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "Memory test (memtest86+)" { - linux16 /boot/addons/memtest -} - -menuentry "iPXE - boot via network/PXE" { - linux16 /boot/addons/ipxe.lkrn -} - -menuentry "GRUB - all in one image" { - linux16 /boot/addons/memdisk - initrd16 /boot/addons/allinone.img -} - -menuentry "FreeDOS" { - linux16 /boot/addons/memdisk - initrd16 /boot/addons/balder10.imz -} - -if [ ${iso_path} ] ; then - # assume loopback.cfg boot - menuentry "MirOS bsd4grml (via loopback)" { - multiboot /boot/addons/bsd4grml/ldbsd.com - module /boot/addons/bsd4grml/bsd.rd bsd - module /boot/addons/bsd4grml/loopback.0 boot.cfg - module /boot/addons/bsd4grml/loopback.1 boot.1 - module /boot/addons/bsd4grml/loopback.2 boot.2 - module /boot/addons/bsd4grml/loopback.3 boot.3 - module /boot/addons/bsd4grml/loopback.4 boot.4 - module /boot/addons/bsd4grml/loopback.5 boot.5 - module /boot/addons/bsd4grml/loopback.6 boot.6 - } -else - # assume grub.cfg boot - menuentry "MirOS bsd4grml (regular method)" { - multiboot /boot/addons/bsd4grml/ldbsd.com - } - - menuentry "MirOS bsd4grml (fallback method)" { - multiboot /boot/addons/bsd4grml/ldbsd.com - module /boot/addons/bsd4grml/bsd.rd bsd.rd - module /boot/addons/bsd4grml/boot.1 boot.1 - module /boot/addons/bsd4grml/boot.2 boot.2 - module /boot/addons/bsd4grml/boot.3 boot.3 - module /boot/addons/bsd4grml/boot.4 boot.4 - module /boot/addons/bsd4grml/boot.5 boot.5 - module /boot/addons/bsd4grml/boot.6 boot.6 - module /boot/addons/bsd4grml/boot.cfg boot.cfg - module /boot/grub/core.img core.img - } -fi - -menuentry "Boot OS of first partition on first disk" { - set root=(hd0,1) - chainloader +1 -} - -menuentry "%GRML_NAME% - enable persistent mode" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" persistent=nofiles - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - copy Grml to RAM" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" toram=%GRML_NAME%.squashfs - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - copy whole medium to RAM" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" toram - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - start X by default" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" startx - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - disable framebuffer" { - set gfxpayload=text - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" video=ofonly radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 nomodeset - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - disable Kernel Mode-Setting" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" radeon.modeset=0 i915.modeset=0 nouveau.modeset=0 nomodeset - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - forensic mode" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" readonly nofstab noraid nodmraid nolvm noautoconfig noswap raid=noautodetect - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - debug mode" { - set gfxpayload=keep - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" initcall verbose debug=vc - initrd /boot/%SHORT_NAME%/initrd.img -} - -menuentry "%GRML_NAME% - serial mode" { - set gfxpayload=text - linux /boot/%SHORT_NAME%/vmlinuz apm=power-off boot=live bootid=%BOOTID% nomce "${loopback}" "${kernelopts}" video=vesafb:off console=tty1 console=ttyS0,9600n8 - initrd /boot/%SHORT_NAME%/initrd.img -} +for config in /boot/grub/*_default.cfg ; do source "$config" ; done +for config in /boot/grub/*_options.cfg ; do source "$config" ; done +source /boot/grub/addons.cfg +source /boot/grub/footer.cfg # EOF -- 2.1.4