From 9c18962f41b62a72249daabaf1dd7c85f9ebe098 Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 29 Apr 2019 15:36:25 +0100 Subject: [PATCH 1/2] Enable busybox loadkmap command --- config/busybox.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/busybox.config b/config/busybox.config index 3cf4ef5a..e7ef9aaa 100644 --- a/config/busybox.config +++ b/config/busybox.config @@ -361,7 +361,7 @@ CONFIG_FEATURE_HUMAN_READABLE=y CONFIG_DEFAULT_SETFONT_DIR="" # CONFIG_FEATURE_LOADFONT_PSF2 is not set # CONFIG_FEATURE_LOADFONT_RAW is not set -# CONFIG_LOADKMAP is not set +CONFIG_LOADKMAP=y # CONFIG_OPENVT is not set # CONFIG_RESET is not set # CONFIG_RESIZE is not set From bc5343c626fed8dd43b512f2a2cedcfddfcfe7c8 Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 30 Apr 2019 12:32:30 +0100 Subject: [PATCH 2/2] Support Fedora 30 boot configuration --- initrd/bin/kexec-parse-bls | 94 ++++++++++++++++++++++++++++++++++++ initrd/bin/kexec-select-boot | 5 ++ 2 files changed, 99 insertions(+) create mode 100755 initrd/bin/kexec-parse-bls diff --git a/initrd/bin/kexec-parse-bls b/initrd/bin/kexec-parse-bls new file mode 100755 index 00000000..70a071a2 --- /dev/null +++ b/initrd/bin/kexec-parse-bls @@ -0,0 +1,94 @@ +#!/bin/sh +set -e -o pipefail +bootdir="$1" +file="$2" +blsdir="$3" + +if [ -z "$bootdir" -o -z "$file" ]; then + die "Usage: $0 /boot /boot/grub/grub.cfg blsdir" +fi + +reset_entry() { + name="" + kexectype="elf" + kernel="" + initrd="" + modules="" + append="$dfltappend" +} + +filedir=`dirname $file` +bootdir="${bootdir%%/}" +bootlen="${#bootdir}" +appenddir="${filedir:$bootlen}" +# assumption. grubenv is in same location as config file +# ignored if doesn't exist +grubenv="$filedir/grubenv" + +fix_path() { + path="$@" + if [ "${path:0:1}" != "/" ]; then + path="$appenddir/$path" + fi +} + +echo_entry() { + if [ "$kexectype" = "elf" ]; then + if [ -z "$kernel" ]; then return; fi + + fix_path $kernel + entry="$name|$kexectype|kernel $path" + if [ -n "$initrd" ]; then + fix_path $initrd + entry="$entry|initrd $path" + fi + if [ -n "$append" ]; then + entry="$entry|append $append" + fi + + echo $(eval "echo \"$entry\"") + fi + if [ "$kexectype" = "multiboot" -o "$kexectype" = "xen" ]; then + if [ -z "$kernel" ]; then return; fi + + fix_path $kernel + echo $(eval "echo \"$name|$kexectype|kernel $path$modules\"") + fi +} + +bls_entry() { + # add info to menuentry + trimcmd=`echo $line | tr '\t ' ' ' | tr -s ' '` + cmd=`echo $trimcmd | cut -d\ -f1` + val=`echo $trimcmd | cut -d\ -f2-` + case $cmd in + title) + name=$val + ;; + linux*) + kernel=$val + ;; + initrd*) + initrd=$val + ;; + options) + # default is "options $kernelopts", so need to substitute that variable set from grubenv + append=`echo "$val" | sed "s@\$kernelopts@$kernelopts@"` + ;; + esac +} + +# This is the default append value if no options field in bls entry +kernelopts=`grep "set default_kernelopts" "$file" | tr "'" "\"" | cut -d\" -f 2` +[ -f "$grubenv" ] && kernelopts=`grep "^kernelopts" "$grubenv" | tr '@' '_' | cut -d= -f 2-` +reset_entry +find $blsdir -type f -name \*.conf | +while read f +do + while read line + do + bls_entry + done < "$f" + echo_entry + reset_entry +done diff --git a/initrd/bin/kexec-select-boot b/initrd/bin/kexec-select-boot index ab8002fe..82c7e326 100755 --- a/initrd/bin/kexec-select-boot +++ b/initrd/bin/kexec-select-boot @@ -162,6 +162,11 @@ scan_options() { if [ -r $option_file ]; then rm $option_file; fi for i in `find $bootdir -name "$config"`; do kexec-parse-boot "$bootdir" "$i" >> $option_file + # FC29/30+ may use BLS format grub config files + # https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault + if [ -d "$bootdir/loader/entries" ]; then + kexec-parse-bls "$bootdir" "$i" "$bootdir/loader/entries" >> $option_file + fi done if [ ! -r $option_file ]; then die "Failed to parse any boot options"