diff --git a/features.in/grub/cfg.in/00defaults.cfg b/features.in/grub/cfg.in/00defaults.cfg index 9165d0ba..23c8b87d 100644 --- a/features.in/grub/cfg.in/00defaults.cfg +++ b/features.in/grub/cfg.in/00defaults.cfg @@ -4,6 +4,7 @@ insmod minicmd insmod normal insmod test set timeout=@timeout@ +if [ "$grub_platform" = "efi" ]; then set EFI_BOOTARGS='@efi_bootargs@'; fi if [ "$grub_platform" = "efi" -a "$grub_cpu" = "x86_64" ]; then set linux_suffix='efi' fi diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg index 81ce5257..c863e863 100644 --- a/features.in/grub/cfg.in/20install2.cfg +++ b/features.in/grub/cfg.in/20install2.cfg @@ -3,7 +3,7 @@ default='linux' menuentry $"Install "'@distro@' --hotkey 'i' --id 'linux' { echo $"Loading Linux vmlinuz$KFLAVOUR ..." - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ @efi_bootargs@ lang=$lang + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ vga=@bootvga@ @bootargs@ $EFI_BOOTARGS lang=$lang echo $"Loading initial ramdisk ..." initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/25install-vnc-connect.cfg b/features.in/grub/cfg.in/25install-vnc-connect.cfg index 6b5bd954..256b5836 100644 --- a/features.in/grub/cfg.in/25install-vnc-connect.cfg +++ b/features.in/grub/cfg.in/25install-vnc-connect.cfg @@ -1,5 +1,5 @@ menuentry $"VNC install "'@distro@'$" (edit to set server IP address)" --id 'vncconnect' { - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ @efi_bootargs@ headless no_alt_virt_keyboard vncconnect=IP lang=$lang + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ $EFI_BOOTARGS headless no_alt_virt_keyboard vncconnect=IP lang=$lang initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/25install-vnc-listen.cfg b/features.in/grub/cfg.in/25install-vnc-listen.cfg index 38568fd4..27c4fa06 100644 --- a/features.in/grub/cfg.in/25install-vnc-listen.cfg +++ b/features.in/grub/cfg.in/25install-vnc-listen.cfg @@ -1,6 +1,6 @@ menuentry $"VNC install "'@distro@'$" (edit to set password and connect here)" --id 'vncpasswd' { - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ @efi_bootargs@ headless no_alt_virt_keyboard vncpassword=VNCPWD lang=$lang + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot automatic=method:cdrom ramdisk_size=@altinst_size@ showopts @bootargs@ $EFI_BOOTARGS headless no_alt_virt_keyboard vncpassword=VNCPWD lang=$lang initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/30live.cfg b/features.in/grub/cfg.in/30live.cfg index 2d683dae..905b896d 100644 --- a/features.in/grub/cfg.in/30live.cfg +++ b/features.in/grub/cfg.in/30live.cfg @@ -1,6 +1,6 @@ menuentry $"LiveCD (no hard disk needed)" --id 'live' { echo $"Loading Linux vmlinuz$KFLAVOUR ..." - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ @efi_bootargs@ lang=$lang + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts lowmem vga=@bootvga@ @bootargs@ $EFI_BOOTARGS lang=$lang echo $"Loading initial ramdisk ..." initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/32live_rw.cfg b/features.in/grub/cfg.in/32live_rw.cfg index 07101478..45fb0617 100644 --- a/features.in/grub/cfg.in/32live_rw.cfg +++ b/features.in/grub/cfg.in/32live_rw.cfg @@ -1,6 +1,6 @@ menuentry $"LiveCD with sessions support" --id 'session' { echo $"Loading Linux vmlinuz$KFLAVOUR ..." - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@ @efi_bootargs@ lang=$lang + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@live_size@ stagename=live showopts live_rw vga=@bootvga@ @bootargs@ $EFI_BOOTARGS lang=$lang echo $"Loading initial ramdisk ..." initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/80rescue.cfg b/features.in/grub/cfg.in/80rescue.cfg index 5deaba11..95810e55 100644 --- a/features.in/grub/cfg.in/80rescue.cfg +++ b/features.in/grub/cfg.in/80rescue.cfg @@ -1,6 +1,6 @@ menuentry $"Rescue LiveCD" --id 'rescue' { echo $"Loading Linux vmlinuz$KFLAVOUR ..." - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ @efi_bootargs@ + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ $EFI_BOOTARGS echo $"Loading initial ramdisk ..." initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/82rescue_rw.cfg b/features.in/grub/cfg.in/82rescue_rw.cfg index efd36cb4..b8c3fc53 100644 --- a/features.in/grub/cfg.in/82rescue_rw.cfg +++ b/features.in/grub/cfg.in/82rescue_rw.cfg @@ -1,6 +1,6 @@ menuentry $"Rescue with sessions support" --id 'rescue_session' { echo $"Loading Linux vmlinuz$KFLAVOUR ..." - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom,label:ALT* ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ @efi_bootargs@ live_rw + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom,label:ALT* ramdisk_size=@rescue_size@ stagename=rescue splash=0 showopts @rescue_bootargs@ $EFI_BOOTARGS live_rw echo $"Loading initial ramdisk ..." initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/83rescue_fm.cfg b/features.in/grub/cfg.in/83rescue_fm.cfg index 9103803d..224d50f3 100644 --- a/features.in/grub/cfg.in/83rescue_fm.cfg +++ b/features.in/grub/cfg.in/83rescue_fm.cfg @@ -1,6 +1,6 @@ menuentry $"Forensic mode (leave disks alone)" --id 'rescue_forensic' { echo $"Loading Linux vmlinuz$KFLAVOUR ..." - linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ @efi_bootargs@ max_loop=16 forensic hash=@rescue_hash@ + linux$linux_suffix @boot_path@/vmlinuz changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ $EFI_BOOTARGS max_loop=16 forensic hash=@rescue_hash@ echo $"Loading initial ramdisk ..." initrd$linux_suffix @boot_path@/full.cz } diff --git a/features.in/grub/cfg.in/84rescue_remote.cfg b/features.in/grub/cfg.in/84rescue_remote.cfg index df15547b..21bf00d2 100644 --- a/features.in/grub/cfg.in/84rescue_remote.cfg +++ b/features.in/grub/cfg.in/84rescue_remote.cfg @@ -1,5 +1,5 @@ menuentry $"Rescue with remote SSH access (DHCP)" --id 'rescue_remote' { - linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ @efi_bootargs@ max_loop=16 ip=dhcp port=22 rootpw=AUTO hash=@rescue_hash@ + linux$linux_suffix @boot_path@/vmlinuz$KFLAVOUR changedisk fastboot live automatic=method:cdrom ramdisk_size=@rescue_size@ splash=0 showopts stagename=rescue @rescue_bootargs@ $EFI_BOOTARGS max_loop=16 ip=dhcp port=22 rootpw=AUTO hash=@rescue_hash@ echo $"Loading initial ramdisk ..." initrd$linux_suffix @boot_path@/full$KFLAVOUR.cz } diff --git a/features.in/grub/cfg.in/85mediacheck.cfg b/features.in/grub/cfg.in/85mediacheck.cfg index aae1dde4..11d8ea4e 100644 --- a/features.in/grub/cfg.in/85mediacheck.cfg +++ b/features.in/grub/cfg.in/85mediacheck.cfg @@ -1,4 +1,4 @@ menuentry $"Check this media for defects" --id 'mediachk' { - linux$linux_suffix @boot_path@/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@ @efi_bootargs@ + linux$linux_suffix @boot_path@/vmlinuz changedisk live quiet lowmem automatic=method:cdrom mediacheck=1 stagename=mediacheck showopts @bootargs@ $EFI_BOOTARGS initrd$linux_suffix @boot_path@/full.cz } diff --git a/features.in/grub/cfg.in/91shell_efi.cfg b/features.in/grub/cfg.in/91shell_efi.cfg new file mode 100644 index 00000000..22a60cd2 --- /dev/null +++ b/features.in/grub/cfg.in/91shell_efi.cfg @@ -0,0 +1,5 @@ +if [ "$grub_platform" = "efi" ]; then + menuentry $"Memory Test" --id 'memtest' { + chainloader /EFI/tools/efi-shell.efi + } +fi diff --git a/features.in/grub/config.mk b/features.in/grub/config.mk index addfd7fc..44ce4f95 100644 --- a/features.in/grub/config.mk +++ b/features.in/grub/config.mk @@ -16,6 +16,7 @@ use/grub/ui/%: use/grub @$(call set,GRUB_UI,$*) @if [ "$*" == gfxboot ]; then \ $(call add,STAGE1_BRANDING,bootloader); \ + $(call add,STAGE1_PACKAGES,grub-common); \ fi use/grub/%.cfg: use/grub diff --git a/features.in/grub/generate.mk b/features.in/grub/generate.mk index b9a1711b..a9b22bd9 100644 --- a/features.in/grub/generate.mk +++ b/features.in/grub/generate.mk @@ -73,12 +73,12 @@ distro: bootargs # pass over additional parameters, if any bootargs: clean @if [ -n "$(EFI_BOOTARGS)" ]; then \ - echo "$(EFI_BOOTARGS)" > $(DSTDIR)/EFI_BOOTARGS; \ - fi + sed -i "s,@efi_bootargs@,$(EFI_BOOTARGS)," $(DSTCFGS); \ + fi; \ + sed -i "s,@efi_bootargs@,," $(DSTCFGS) @if [ -n "$(STAGE2_BOOTARGS)" ]; then \ + sed -i "s,$(STAGE2_BOOTARGS),," $(DSTCFGS); \ sed -i "s,@bootargs@,$(STAGE2_BOOTARGS)," $(DSTCFGS); \ - [ -f $(DSTDIR)/EFI_BOOTARGS ] && \ - sed -i "s/$(STAGE2_BOOTARGS)//" $(DSTDIR)/EFI_BOOTARGS; \ fi; \ sed -i "s,@bootargs@,," $(DSTCFGS) @if [ -n "$(RESCUE_BOOTARGS)" ]; then \ diff --git a/features.in/grub/scripts.d/20-propagator-ramdisk-grub b/features.in/grub/scripts.d/20-propagator-ramdisk-grub index 04470b6c..569c5049 100755 --- a/features.in/grub/scripts.d/20-propagator-ramdisk-grub +++ b/features.in/grub/scripts.d/20-propagator-ramdisk-grub @@ -1,20 +1,17 @@ #!/bin/sh -# postprocess isolinux configuration +# postprocess grub configuration # when the image sizes are finally known # NB: install2_size, live_size, rescue_size get defined here cd "$WORKDIR" +cfg='boot/grub/grub.cfg' -[ -f boot/grub/grub.cfg -o -f EFI/BOOT/grub.cfg ] || exit 0 - -cfgs= -[ ! -f boot/grub/grub.cfg ] || cfgs+='boot/grub/grub.cfg ' -[ ! -f EFI/BOOT/grub.cfg ] || cfgs+='EFI/BOOT/grub.cfg' +[ -f "$cfg" ] || exit 0 # apply size census while looking for potential squashfs images find -maxdepth 1 -type f -size +1M \ | sed 's,^\./,,' \ | while read image; do size="$[ $(stat -c%s "$image") / 1024 + 1 ]" - sed -i "s,@${image}_size@,$size," $cfgs + sed -i "s,@${image}_size@,$size," $cfg done diff --git a/features.in/grub/scripts.d/20-propagator-rescue-hash-grub b/features.in/grub/scripts.d/20-propagator-rescue-hash-grub index 3ca61591..7cb034c4 100755 --- a/features.in/grub/scripts.d/20-propagator-rescue-hash-grub +++ b/features.in/grub/scripts.d/20-propagator-rescue-hash-grub @@ -1,18 +1,15 @@ #!/bin/sh -# postprocess isolinux configuration +# postprocess grub configuration # to add rescue image hash, if any # (for propagator in forensic mode) cd "$WORKDIR" +cfg='boot/grub/grub.cfg' -[ -f boot/grub/grub.cfg -o -f EFI/BOOT/grub.cfg ] || exit 0 - -cfgs= -[ ! -f boot/grub/grub.cfg ] || cfgs+='boot/grub/grub.cfg ' -[ ! -f EFI/BOOT/grub.cfg ] || cfgs+='EFI/BOOT/grub.cfg' +[ -f "$cfg" ] || exit 0 find -maxdepth 1 -type f -name rescue \ | while read image; do rescue_hash="$(sha256sum -b "$image" | cut -f1 -d' ')" - sed -i "s,@rescue_hash@,$rescue_hash," $cfgs + sed -i "s,@rescue_hash@,$rescue_hash," $cfg done diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub index a895458f..e61d747f 100755 --- a/features.in/grub/stage1/scripts.d/01-grub +++ b/features.in/grub/stage1/scripts.d/01-grub @@ -3,16 +3,8 @@ # copy modules; see also this feature's generate.mk CFG="$WORKDIR/boot/grub/grub.cfg" -CFG_EFI="$WORKDIR/EFI/BOOT/grub.cfg" - - -if [ -n "$GLOBAL_EFI_BOOTLOADER" -a ! "$GLOBAL_EFI_BOOTLOADER" = "grub-efi" ]; then - rm -fr "$WORKDIR/boot" - exit 0 -fi - -if [ -z "$GLOBAL_EFI_BOOTLOADER" ]; then +if [ "$GLOBAL_EFI_BOOTLOADER" != 'grub-efi' ]; then case "$GLOBAL_BOOTLOADER" in ieee1275boot|grubpcboot) ;; *) rm -fr "$WORKDIR/boot" @@ -29,17 +21,7 @@ if [ -n "${GRUB_FILES% }" ]; then fi # number ordering sponsored by shell's pathname expansion -case "$GLOBAL_BOOTLOADER" in - ieee1275boot) - grep -hv '^#' $(find .in/*.cfg -not -name *_efi.cfg -not -name *_bios.cfg) > "$CFG" ;; - grubpcboot) - grep -hv '^#' $(find .in/*.cfg -not -name *_efi.cfg) > "$CFG" ;; -esac - -if [ "$GLOBAL_EFI_BOOTLOADER" = "grub-efi" ]; then - mkdir -p "$WORKDIR/EFI/BOOT" - grep -hv '^#' $(find .in/*.cfg -not -name *_bios.cfg) > "$CFG_EFI" -fi +grep -hv '^#' $(find .in/*.cfg) > "$CFG" # there should be DEFAULT directive there (at least for alterator-netinst) default_change() { @@ -65,30 +47,20 @@ if ! grep -i '^default' "$CFG"; then fi } -if [ -f "$CFG" ]; then - default_change "$CFG" - sed -i 's,@boot_path@,/boot,g' "$CFG" - sed -i 's,@efi_bootargs@,,g' "$CFG" -fi +default_change "$CFG" -if [ -f .in/EFI_BOOTARGS ]; then - EFI_BOOTARGS=$(cat .in/EFI_BOOTARGS) -fi +case "$GLOBAL_BOOTLOADER" in + ieee1275boot|grubpcboot) + BOOT_PATH=/boot;; + *) + BOOT_PATH=/EFI/BOOT;; +esac -if [ -f "$CFG_EFI" ]; then - default_change "$CFG_EFI" - sed -i 's,@boot_path@,/EFI/BOOT,g' "$CFG_EFI" - [ -n "$EFI_BOOTARGS" ] && - sed -i "s,@efi_bootargs@,$EFI_BOOTARGS,g" "$CFG_EFI" - sed -i "s, @efi_bootargs@,,g" "$CFG_EFI" -fi +sed -i "s,@boot_path@,$BOOT_PATH,g" "$CFG" # snippets are not going into the actual image if [ "$DEBUG" != 2 ]; then rm -r .in/ - cd $WORKDIR - [ -f "$CFG" ] || rm -r boot/grub - [ ! $(ls -A boot/ | wc -l) -eq 0 ] || rm -r boot/ fi # NB: there will be final macro expansion based on actual image sizes