From beed753ed802344b3980e2ee21d8158cca201eb4 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Mon, 17 Aug 2020 12:49:51 -0500 Subject: [PATCH] kexec-parse-boot/bls: Strip boot dir from front of grub entries Some grub configs/bls entries contain the full paths to the kernel/initrd files, which the parsers currently fail to handle, causing a failed boot without any useful error being presented to the user. To fix this, strip the bootdir prefix from the menu entries when parsing, should it exist. Test: build/boot Librem 13v2 w/F32 and bls entries containing absolute paths. Signed-off-by: Matt DeVillier --- initrd/bin/kexec-parse-bls | 4 ++-- initrd/bin/kexec-parse-boot | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/initrd/bin/kexec-parse-bls b/initrd/bin/kexec-parse-bls index b70363f42..ee2e08818 100755 --- a/initrd/bin/kexec-parse-bls +++ b/initrd/bin/kexec-parse-bls @@ -67,10 +67,10 @@ bls_entry() { name=$val ;; linux*) - kernel=$val + kernel=${val#"$bootdir"} ;; initrd*) - initrd=$val + initrd=${val#"$bootdir"} ;; options) # default is "options $kernelopts" diff --git a/initrd/bin/kexec-parse-boot b/initrd/bin/kexec-parse-boot index 8dfa648d4..fbe31939a 100755 --- a/initrd/bin/kexec-parse-boot +++ b/initrd/bin/kexec-parse-boot @@ -170,11 +170,11 @@ syslinux_entry() { state="search" ;; *) - kernel="$val" + kernel="${val#"$bootdir"}" esac ;; initrd* | INITRD* ) - initrd="$val" + initrd="${val#"$bootdir"}" ;; append* | APPEND* ) if [ "$kexectype" = "multiboot" -o "$kexectype" = "xen" ]; then