From e0aa88b7b14f08904f12cc5d44f1a736baa71655 Mon Sep 17 00:00:00 2001 From: Anton Midyukov Date: Fri, 4 Dec 2020 00:52:11 +0700 Subject: [PATCH] grub: Add EFI_BOOTARGS into BOOT/EFI/grub.cfg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pay attention to what you are adding to the variable. No need to add language and live_rw there! Они нужны только для refind. --- features.in/grub/cfg.in/20install2.cfg | 2 +- features.in/grub/cfg.in/25install-vnc-connect.cfg | 2 +- features.in/grub/cfg.in/25install-vnc-listen.cfg | 2 +- features.in/grub/cfg.in/30live.cfg | 2 +- features.in/grub/cfg.in/32live_rw.cfg | 2 +- features.in/grub/cfg.in/80rescue.cfg | 2 +- features.in/grub/cfg.in/82rescue_rw.cfg | 2 +- features.in/grub/cfg.in/83rescue_fm.cfg | 2 +- features.in/grub/cfg.in/84rescue_remote.cfg | 2 +- features.in/grub/cfg.in/85mediacheck.cfg | 2 +- features.in/grub/generate.mk | 5 +++++ features.in/grub/stage1/scripts.d/01-grub | 10 ++++++++++ 12 files changed, 25 insertions(+), 10 deletions(-) diff --git a/features.in/grub/cfg.in/20install2.cfg b/features.in/grub/cfg.in/20install2.cfg index d15cd680..e88c5f7a 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 @relname@' --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@ 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 d5a6f9e0..21560ee9 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 @relname@ (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@ 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 1e825cac..d27f70be 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 @relname@ (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@ 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 fe2481c7..aec8a3fd 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@ 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 c049d4b1..e84b241c 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@ 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 d3b11812..e5922a4c 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@ + 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 343e0d0b..5dc318bb 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@ 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 477d36ff..ae711de2 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@ 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 70cc4c05..49370ecf 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@ 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 918f074d..4da34ca3 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@ + 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/generate.mk b/features.in/grub/generate.mk index f3faf1eb..72e57d0c 100644 --- a/features.in/grub/generate.mk +++ b/features.in/grub/generate.mk @@ -73,8 +73,13 @@ distro: bootargs # pass over additional parameters, if any bootargs: clean + @if [ -n "$(EFI_BOOTARGS)" ]; then \ + echo "$(EFI_BOOTARGS)" > $(DSTDIR)/EFI_BOOTARGS; \ + fi @if [ -n "$(STAGE2_BOOTARGS)" ]; then \ 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/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub index c24eb7b6..4f765dce 100755 --- a/features.in/grub/stage1/scripts.d/01-grub +++ b/features.in/grub/stage1/scripts.d/01-grub @@ -5,6 +5,8 @@ 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 @@ -64,11 +66,19 @@ fi if [ -f "$CFG" ]; then default_change "$CFG" sed -i 's,@boot_path@,/boot,g' "$CFG" + sed -i 's,@efi_bootargs@,,g' "$CFG" +fi + +if [ -f .in/EFI_BOOTARGS ]; then + EFI_BOOTARGS=$(cat .in/EFI_BOOTARGS) fi 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 # change @linux_suffix@