diff --git a/.gitignore b/.gitignore index e2e3e12..0449688 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ -grubby-*.tar.bz2 +*.tar.bz2 +*.tar.gz clog *.rpm +.build*log +*/ diff --git a/0001-Don-t-go-past-the-last-element-of-indexVars-in-findE.patch b/0001-Don-t-go-past-the-last-element-of-indexVars-in-findE.patch deleted file mode 100644 index 616371c..0000000 --- a/0001-Don-t-go-past-the-last-element-of-indexVars-in-findE.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 639b9ab2462d4dddd8b8cff04e8db352cb6dc5d5 Mon Sep 17 00:00:00 2001 -From: Yannick Brosseau -Date: Thu, 3 Jul 2014 13:55:19 -0700 -Subject: [PATCH 01/10] Don't go past the last element of indexVars in - findEntryByPath - -We add a chance of creating an infinite loop, because we -were reading memory past the last element of indexVars set to -1. - -This issue was only apparent with -O2, probably because the way the -memory was initialized. - -Signed-off-by: Yannick Brosseau ---- - grubby.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/grubby.c b/grubby.c -index 88a1f08..db91364 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -1959,11 +1959,13 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, - } - - indexVars[i + 1] = -1; -- -+ - i = 0; - if (index) { -- while (i < *index) i++; -- if (indexVars[i] == -1) return NULL; -+ while (i < *index) { -+ i++; -+ if (indexVars[i] == -1) return NULL; -+ } - } - - entry = findEntryByIndex(config, indexVars[i]); --- -1.9.3 - diff --git a/0001-Treat-kernel-and-kernel-core-as-identical-in-terms-o.patch b/0001-Treat-kernel-and-kernel-core-as-identical-in-terms-o.patch deleted file mode 100644 index e959dd4..0000000 --- a/0001-Treat-kernel-and-kernel-core-as-identical-in-terms-o.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 15d36a8f27c5b14b290da99c4be8880bc35dc41b Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 27 Oct 2014 18:10:00 -0400 -Subject: [PATCH] Treat kernel and kernel-core as identical in terms of - --make-default - -Depending on which kernel version, we'll either get kernel or -kernel-core as --package. Since we're unlikely to call something -kernel-core-core, just treat them the same. - -Resolves: rhbz#1141414 - -Signed-off-by: Peter Jones ---- - new-kernel-pkg | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/new-kernel-pkg b/new-kernel-pkg -index 70f6118..9f3b192 100755 ---- a/new-kernel-pkg -+++ b/new-kernel-pkg -@@ -797,9 +797,11 @@ if [ -n "$dracut" -o -n "$adddracutargs" ]; then - fi - - # set this as the default if we have the package and it matches --if [ "$mode" == "--install" -a "$UPDATEDEFAULT" == "yes" -a -n "$package" -a -n "$DEFAULTKERNEL" -a "$package" == "$DEFAULTKERNEL" ]; then -- makedefault="--make-default" -- [ -n "$verbose" ] && echo "making it the default based on config" -+if [ "$mode" == "--install" -a "$UPDATEDEFAULT" == "yes" -a -n "$package" -a -n "$DEFAULTKERNEL" ]; then -+ if [ "$package" == "$DEFAULTKERNEL" -o "${package}-core" == "$DEFAULTKERNEL" ]; then -+ makedefault="--make-default" -+ [ -n "$verbose" ] && echo "making it the default based on config" -+ fi - fi - - if [ "$moddep" == "make" ]; then --- -1.9.3 - diff --git a/0002-Add-bls-test-harness-bits.patch b/0002-Add-bls-test-harness-bits.patch deleted file mode 100644 index e129e93..0000000 --- a/0002-Add-bls-test-harness-bits.patch +++ /dev/null @@ -1,452 +0,0 @@ -From 0e5c50b8dff5208b915391e3b592790bdf174cf4 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Tue, 8 Jul 2014 14:37:21 -0400 -Subject: [PATCH 02/10] Add bls test harness bits. - -This expects that there are bls config files and that grubby knows how -to deal with them, which isn't at all true, and so the test case -currently fails because test/grub2.15 doesn't provide any kernel stanzas -whatsoever. - -Maybe I should add a dummy there, but... I'd rather leave this failing -here. - -Signed-off-by: Peter Jones ---- - test.sh | 105 +++++++++++++++++++ - ...724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf | 8 ++ - ...724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf | 8 ++ - ...981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf | 10 ++ - ...981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf | 10 ++ - test/grub2.15 | 112 +++++++++++++++++++++ - test/results/grub2.15 | 112 +++++++++++++++++++++ - 7 files changed, 365 insertions(+) - create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf - create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf - create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf - create mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf - create mode 100644 test/grub2.15 - create mode 100644 test/results/grub2.15 - -diff --git a/test.sh b/test.sh -index 864a8ce..e7be15f 100755 ---- a/test.sh -+++ b/test.sh -@@ -163,6 +163,102 @@ for b in $(./grubby --help | \ - eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }" - done - -+grub2BlsTest() { -+ declare blsdir=$(mktemp -d) cmpdir=$(mktemp -d) -+ -+ declare blspairs="" -+ while [ -n "$1" ]; do -+ if [ "$1" == "--blspair" ]; then -+ blsin=$(echo $2 | sed 's/\(.*\),.*/\1/') -+ blsout=$(echo $2 | sed 's/[^,]*,\(.*\)/\1/') -+ [ -n "$blsin" ] && cp "test/grub2-support_files/$blsin" ${blsdir}/ -+ [ -n "$blsout" ] && cp "test/grub2-support_files/$blsout" ${cmpdir}/ -+ blspairs="${blspairs} $2" -+ shift 2 -+ else -+ break -+ fi -+ done -+ -+ typeset mode=$1 cfg=test/$2 correct=test/results/$3 -+ shift 3 -+ -+ local ENV_FILE="" -+ if [ "$mode" == "--grub2" ]; then -+ ENV_FILE="test/grub2-support_files/env_temp" -+ if [ "$1" == "--env" ]; then -+ cp "test/grub2-support_files/$2" "$ENV_FILE" -+ shift 2 -+ else -+ cp "test/grub2-support_files/grubenv.0" "$ENV_FILE" -+ fi -+ ENV_FILE="--env=$ENV_FILE" -+ fi -+ -+ declare outfile=$(mktemp) -+ echo "$testing ... $mode bls $cfg $correct" -+ runme=( ./grubby "$mode" --bad-image-okay $ENV_FILE -c "$cfg" -o - --blsdir="${blsdir}" "$@" ) -+ declare -i old_fail=$fail -+ if "${runme[@]}" 2>&1 | cmp "$correct" > /dev/null; then -+ (( pass++ )) -+ if $opt_verbose; then -+ echo ------------------------------------------------------------- -+ echo -n "PASS: " -+ printf "%q " "${runme[@]}"; echo -+ "${runme[@]}" 2>&1 | diff -U30 "$cfg" - -+ echo -+ fi -+ else -+ (( fail++ )) -+ echo ------------------------------------------------------------- -+ echo -n "FAIL: " -+ printf "%q " "${runme[@]}"; echo -+ "${runme[@]}" 2>&1 | diff -U30 "$correct" - -+ echo -+ fi -+ -+ for pair in ${blspairs} ; do -+ blsin=$(echo $pair | sed 's/\(.*\),.*/\1/') -+ blsout=$(echo $pair | sed 's/[^,]*,\(.*\)/\1/') -+ -+ if [ -z "${blsout}" -a -f ${blsdir}/${blsin} ]; then -+ (( fail++ )) -+ echo ------------------------------------------------------------- -+ echo -n "FAIL: " -+ printf "%q " "${runme[@]}"; echo -+ diff -U30 /dev/null ${blsdir}/${blsin} -+ elif [ -n "${blsout}" ] && ! cmp ${blsdir}/${blsout} ${cmpdir}/${blsout} >/dev/null ; then -+ (( fail++ )) -+ echo ------------------------------------------------------------- -+ echo -n "FAIL: " -+ printf "%q " "${runme[@]}"; echo -+ diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}" -+ else -+ (( pass++ )) -+ if $opt_verbose; then -+ echo ------------------------------------------------------------- -+ echo -n "PASS: " -+ printf "%q " "${runme[@]}"; echo -+ diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}" -+ fi -+ fi -+ done -+ -+ if [ $old_fail -eq $fail ]; then -+ (( pass++ )) -+ if $opt_verbose; then -+ echo ------------------------------------------------------------- -+ echo -n "PASS: " -+ printf "%q " "${runme[@]}"; echo -+ "${runme[@]}" 2>&1 | diff -U30 "$cfg" - -+ echo -+ fi -+ fi -+ -+ rm -rvf ${blsdir}/ ${cmpdir}/ -+} -+ -+ - #---------------------------------------------------------------------- - # Main - #---------------------------------------------------------------------- -@@ -533,6 +629,15 @@ if [ "$testgrub2" == "y" ]; then - grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \ - --initrd=/boot/new-initrd --boot-filesystem=/boot/ - -+ testing="GRUB2 add bls kernel+initrd" -+ grub2BlsTest \ -+ --blspair 6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf,6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf \ -+ --blspair ,6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf \ -+ --grub2 grub2.15 grub2.15 \ -+ --add-kernel=/boot/new-kernel.img \ -+ --title=title --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ -+ --copy-default -+ - testing="GRUB2 display default index" - grub2DisplayTest grub2.1 defaultindex/0 --default-index - grub2DisplayTest grub2.2 defaultindex/0 --default-index -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf -new file mode 100644 -index 0000000..84b2bdf ---- /dev/null -+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf -@@ -0,0 +1,8 @@ -+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf -+title Fedora 19 (Rawhide) -+version 3.8.0-2.fc19.x86_64 -+machine-id 6a9857a393724b7a981ebb5b8495b9ea -+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 -+linux /boot/vmlinux-3.8.0-2.fc19.x86_64 -+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 -+initrd /boot/initrd-3.8.0-2.fc19.x86_64 -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf -new file mode 100644 -index 0000000..e1c61a8 ---- /dev/null -+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf -@@ -0,0 +1,8 @@ -+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf -+title Fedora 19 (Rawhide) -+version 3.8.1-2.fc19.x86_64 -+machine-id 6a9857a393724b7a981ebb5b8495b9ea -+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 -+linux /boot/vmlinux-3.8.1-2.fc19.x86_64 -+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 -+initrd /boot/initrd-3.8.1-2.fc19.x86_64 -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf -new file mode 100644 -index 0000000..4a60fbc ---- /dev/null -+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf -@@ -0,0 +1,10 @@ -+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf -+title Fedora 19 (tboot) (Rawhide) -+version 3.8.0-2.fc19.x86_64 -+machine-id 6a9857a393724b7a981ebb5b8495b9ea -+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 -+multiboot /boot/tboot.gz -+ options logging=serial,vga,memory -+linux /boot/vmlinux-3.8.0-2.fc19.x86_64 -+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 -+initrd /boot/initrd-3.8.0-2.fc19.x86_64 -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf -new file mode 100644 -index 0000000..34c0e09 ---- /dev/null -+++ b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf -@@ -0,0 +1,10 @@ -+# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf -+title Fedora 19 (tboot) (Rawhide) -+version 3.8.1-2.fc19.x86_64 -+machine-id 6a9857a393724b7a981ebb5b8495b9ea -+filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 -+multiboot /boot/tboot.gz -+ options logging=serial,vga,memory -+linux /boot/vmlinux-3.8.1-2.fc19.x86_64 -+options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 -+initrd /boot/initrd-3.8.1-2.fc19.x86_64 -diff --git a/test/grub2.15 b/test/grub2.15 -new file mode 100644 -index 0000000..0be2d74 ---- /dev/null -+++ b/test/grub2.15 -@@ -0,0 +1,112 @@ -+# -+# DO NOT EDIT THIS FILE -+# -+# It is automatically generated by grub2-mkconfig using templates -+# from /etc/grub.d and settings from /etc/default/grub -+# -+ -+### BEGIN /etc/grub.d/00_header ### -+if [ -s $prefix/grubenv ]; then -+ load_env -+fi -+if [ "${next_entry}" ] ; then -+ set default="${next_entry}" -+ set next_entry= -+ save_env next_entry -+ set boot_once=true -+else -+ set default="${saved_entry}" -+fi -+ -+if [ x"${feature_menuentry_id}" = xy ]; then -+ menuentry_id_option="--id" -+else -+ menuentry_id_option="" -+fi -+ -+export menuentry_id_option -+ -+if [ "${prev_saved_entry}" ]; then -+ set saved_entry="${prev_saved_entry}" -+ save_env saved_entry -+ set prev_saved_entry= -+ save_env prev_saved_entry -+ set boot_once=true -+fi -+ -+function savedefault { -+ if [ -z "${boot_once}" ]; then -+ saved_entry="${chosen}" -+ save_env saved_entry -+ fi -+} -+ -+function load_video { -+ if [ x$feature_all_video_module = xy ]; then -+ insmod all_video -+ else -+ insmod efi_gop -+ insmod efi_uga -+ insmod ieee1275_fb -+ insmod vbe -+ insmod vga -+ insmod video_bochs -+ insmod video_cirrus -+ fi -+} -+ -+if [ x$feature_default_font_path = xy ] ; then -+ font=unicode -+else -+insmod part_gpt -+insmod btrfs -+set root='hd0,gpt4' -+if [ x$feature_platform_search_hint = xy ]; then -+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 -+else -+ search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 -+fi -+ font="/root/usr/share/grub/unicode.pf2" -+fi -+ -+if loadfont $font ; then -+ set gfxmode=auto -+ load_video -+ insmod gfxterm -+ set locale_dir=$prefix/locale -+ set lang=en_US -+ insmod gettext -+fi -+terminal_output gfxterm -+set timeout=5 -+### END /etc/grub.d/00_header ### -+ -+### BEGIN /etc/grub.d/10_blscfg ### -+ -+bls_import -+ -+### END /etc/grub.d/10_blscfg ### -+ -+### BEGIN /etc/grub.d/20_linux_xen ### -+ -+### END /etc/grub.d/20_linux_xen ### -+ -+### BEGIN /etc/grub.d/20_ppc_terminfo ### -+### END /etc/grub.d/20_ppc_terminfo ### -+ -+### BEGIN /etc/grub.d/30_os-prober ### -+### END /etc/grub.d/30_os-prober ### -+ -+### BEGIN /etc/grub.d/40_custom ### -+# This file provides an easy way to add custom menu entries. Simply type the -+# menu entries you want to add after this comment. Be careful not to change -+# the 'exec tail' line above. -+### END /etc/grub.d/40_custom ### -+ -+### BEGIN /etc/grub.d/41_custom ### -+if [ -f ${config_directory}/custom.cfg ]; then -+ source ${config_directory}/custom.cfg -+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then -+ source $prefix/custom.cfg; -+fi -+### END /etc/grub.d/41_custom ### -diff --git a/test/results/grub2.15 b/test/results/grub2.15 -new file mode 100644 -index 0000000..0be2d74 ---- /dev/null -+++ b/test/results/grub2.15 -@@ -0,0 +1,112 @@ -+# -+# DO NOT EDIT THIS FILE -+# -+# It is automatically generated by grub2-mkconfig using templates -+# from /etc/grub.d and settings from /etc/default/grub -+# -+ -+### BEGIN /etc/grub.d/00_header ### -+if [ -s $prefix/grubenv ]; then -+ load_env -+fi -+if [ "${next_entry}" ] ; then -+ set default="${next_entry}" -+ set next_entry= -+ save_env next_entry -+ set boot_once=true -+else -+ set default="${saved_entry}" -+fi -+ -+if [ x"${feature_menuentry_id}" = xy ]; then -+ menuentry_id_option="--id" -+else -+ menuentry_id_option="" -+fi -+ -+export menuentry_id_option -+ -+if [ "${prev_saved_entry}" ]; then -+ set saved_entry="${prev_saved_entry}" -+ save_env saved_entry -+ set prev_saved_entry= -+ save_env prev_saved_entry -+ set boot_once=true -+fi -+ -+function savedefault { -+ if [ -z "${boot_once}" ]; then -+ saved_entry="${chosen}" -+ save_env saved_entry -+ fi -+} -+ -+function load_video { -+ if [ x$feature_all_video_module = xy ]; then -+ insmod all_video -+ else -+ insmod efi_gop -+ insmod efi_uga -+ insmod ieee1275_fb -+ insmod vbe -+ insmod vga -+ insmod video_bochs -+ insmod video_cirrus -+ fi -+} -+ -+if [ x$feature_default_font_path = xy ] ; then -+ font=unicode -+else -+insmod part_gpt -+insmod btrfs -+set root='hd0,gpt4' -+if [ x$feature_platform_search_hint = xy ]; then -+ search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 -+else -+ search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 -+fi -+ font="/root/usr/share/grub/unicode.pf2" -+fi -+ -+if loadfont $font ; then -+ set gfxmode=auto -+ load_video -+ insmod gfxterm -+ set locale_dir=$prefix/locale -+ set lang=en_US -+ insmod gettext -+fi -+terminal_output gfxterm -+set timeout=5 -+### END /etc/grub.d/00_header ### -+ -+### BEGIN /etc/grub.d/10_blscfg ### -+ -+bls_import -+ -+### END /etc/grub.d/10_blscfg ### -+ -+### BEGIN /etc/grub.d/20_linux_xen ### -+ -+### END /etc/grub.d/20_linux_xen ### -+ -+### BEGIN /etc/grub.d/20_ppc_terminfo ### -+### END /etc/grub.d/20_ppc_terminfo ### -+ -+### BEGIN /etc/grub.d/30_os-prober ### -+### END /etc/grub.d/30_os-prober ### -+ -+### BEGIN /etc/grub.d/40_custom ### -+# This file provides an easy way to add custom menu entries. Simply type the -+# menu entries you want to add after this comment. Be careful not to change -+# the 'exec tail' line above. -+### END /etc/grub.d/40_custom ### -+ -+### BEGIN /etc/grub.d/41_custom ### -+if [ -f ${config_directory}/custom.cfg ]; then -+ source ${config_directory}/custom.cfg -+elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then -+ source $prefix/custom.cfg; -+fi -+### END /etc/grub.d/41_custom ### --- -1.9.3 - diff --git a/0003-grubby-fix-initrd-updating-when-multiboot-exist.patch b/0003-grubby-fix-initrd-updating-when-multiboot-exist.patch deleted file mode 100644 index 2560743..0000000 --- a/0003-grubby-fix-initrd-updating-when-multiboot-exist.patch +++ /dev/null @@ -1,37 +0,0 @@ -From e91855ce14df65d12f681c15dfba5b22a2b4a061 Mon Sep 17 00:00:00 2001 -From: Junxiao Bi -Date: Wed, 14 May 2014 16:44:21 +0800 -Subject: [PATCH 03/10] grubby: fix initrd updating when multiboot exist - -When using the following command to add an initrd for the kernel. -grubby --update-kernel=/boot/vmlinuz-2.6.32-431.17.1.el6.x86_64.debug - --initrd /boot/initramfs-2.6.32-431.17.1.el6.x86_64.debug.img - --add-multiboot=/boot/tboot.gz -The multiboot image /boot/tboot.gz is used as the key to search the -configure entry in grub.conf, this is wrong. There may be other kernels -also configure multiboot with the same name tboot.gz, if there index are -smaller than the target one, then that will make the initrd added to the -wrong kernel. Fix it to use kernel name as the search key. - -Signed-off-by: Junxiao Bi -Reviewed-by: John Haxby ---- - grubby.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grubby.c b/grubby.c -index db91364..118cb84 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -3311,7 +3311,7 @@ int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel, - - if (!image) return 0; - -- for (; (entry = findEntryByPath(cfg, newMBKernel, prefix, &index)); index++) { -+ for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) { - kernelLine = getLineByType(LT_MBMODULE, entry->lines); - if (!kernelLine) continue; - --- -1.9.3 - diff --git a/0004-Tell-a-slightly-better-fib-about-default-bootloader-.patch b/0004-Tell-a-slightly-better-fib-about-default-bootloader-.patch deleted file mode 100644 index 6c0e91f..0000000 --- a/0004-Tell-a-slightly-better-fib-about-default-bootloader-.patch +++ /dev/null @@ -1,46 +0,0 @@ -From dbd5b06ce590ca638e3c44746183f6f2379e820f Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Fri, 12 Sep 2014 15:50:05 -0400 -Subject: [PATCH 04/10] Tell a slightly better fib about default bootloader - config paths. - -It's not going to be right everywhere, but... whatever. - -Resolves: rhbz#1001664 -Signed-off-by: Peter Jones ---- - grubby.8 | 14 ++++++++------ - 1 file changed, 8 insertions(+), 6 deletions(-) - -diff --git a/grubby.8 b/grubby.8 -index c2b0155..bd5ccb8 100644 ---- a/grubby.8 -+++ b/grubby.8 -@@ -19,16 +19,18 @@ grubby \- command line tool for configuring grub, lilo, elilo, yaboot and zipl - - .SH DESCRIPTION - \fBgrubby\fR is a command line tool for updating and displaying information --about the configuration files for the \fBgrub\fR, \fBlilo\fR, \fBelilo\fR -+about the configuration files for the \fBgrub\fR, \fBlilo\fR, \fBelilo\fR - (ia64), \fByaboot\fR (powerpc) and \fBzipl\fR (s390) boot loaders. It - is primarily designed to be used from scripts which install new - kernels and need to find information about the current boot environment. - --On Intel x86 platforms, \fBgrub\fR is the default bootloader and the --configuration file is in \fB/boot/grub/grub.conf\fR. On Intel ia64 platforms, --\fBelilo\fR mode is used and the default location for the configuration file --is \fB/boot/grub/grub.conf\fR. On PowerPC platforms, \fByaboot\fR parsing --is used and the configuration file should be in \fB/etc/yaboot.conf\fR. -+On BIOS-based Intel x86 platforms, \fBgrub2\fR is the default bootloader and -+the configuration file is in \fB/boot/grub2/grub.cfg\fR. On UEFI-based Intel -+x86 platforms, \fBgrub2\fR is the default bootloader, and the configuration -+file is in \fB/boot/efi/EFI/redhat/grub.cfg\fR. On Intel ia64 platforms, -+\fBelilo\fR mode is used and the default location for the configuration file -+is \fB/boot/efi/EFI/redhat/elilo.conf\fR. On PowerPC platforms, \fByaboot\fR -+parsing is used and the configuration file should be in \fB/etc/yaboot.conf\fR. - - There are a number of ways to specify the kernel used for \fB-\-info\fR, - \fB-\-remove-kernel\fR, and \fB-\-update-kernel\fR. Specificying \fBDEFAULT\fR --- -1.9.3 - diff --git a/0005-Make-findTemplate-actually-return-the-saved-default.patch b/0005-Make-findTemplate-actually-return-the-saved-default.patch deleted file mode 100644 index ffa23c1..0000000 --- a/0005-Make-findTemplate-actually-return-the-saved-default.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 629922b6dc32e4209980d7198b7d2aabb722033a Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 15 Sep 2014 14:31:01 -0400 -Subject: [PATCH 05/10] Make findTemplate actually return the saved default. - -Really not sure why this wasn't returning here before; going into the -loop below is just going to clobber all that it's done. - -Related: rhbz#957681 -Signed-off-by: Peter Jones ---- - grubby.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/grubby.c b/grubby.c -index 118cb84..baf646b 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -2119,8 +2119,12 @@ struct singleEntry * findTemplate(struct grubConfig * cfg, const char * prefix, - } else { - entry = findEntryByTitle(cfg, defTitle, &index); - } -- if (entry) -+ if (entry && suitableImage(entry, prefix, skipRemoved, flags)) { - cfg->defaultImage = index; -+ if (indexPtr) -+ *indexPtr = index; -+ return entry; -+ } - } - } - } else if (cfg->defaultImage > -1) { --- -1.9.3 - diff --git a/0006-Revert-Add-bls-test-harness-bits.patch b/0006-Revert-Add-bls-test-harness-bits.patch deleted file mode 100644 index 57aa733..0000000 --- a/0006-Revert-Add-bls-test-harness-bits.patch +++ /dev/null @@ -1,446 +0,0 @@ -From 0950d2e8693339a36f59c966dc8558263331665c Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 15 Sep 2014 16:49:26 -0400 -Subject: [PATCH 06/10] Revert "Add bls test harness bits." - -This wasn't supposed to be pushed to master yet. woops. - -This reverts commit 98cab84501f86bd98f12653c11f4ecc632139399. ---- - test.sh | 105 ------------------- - ...724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf | 8 -- - ...724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf | 8 -- - ...981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf | 10 -- - ...981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf | 10 -- - test/grub2.15 | 112 --------------------- - test/results/grub2.15 | 112 --------------------- - 7 files changed, 365 deletions(-) - delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf - delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf - delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf - delete mode 100644 test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf - delete mode 100644 test/grub2.15 - delete mode 100644 test/results/grub2.15 - -diff --git a/test.sh b/test.sh -index e7be15f..864a8ce 100755 ---- a/test.sh -+++ b/test.sh -@@ -163,102 +163,6 @@ for b in $(./grubby --help | \ - eval "${b}DisplayTest() { [[ \"$b\" == \$opt_bootloader ]] && oneDisplayTest --$b \"\$@\"; }" - done - --grub2BlsTest() { -- declare blsdir=$(mktemp -d) cmpdir=$(mktemp -d) -- -- declare blspairs="" -- while [ -n "$1" ]; do -- if [ "$1" == "--blspair" ]; then -- blsin=$(echo $2 | sed 's/\(.*\),.*/\1/') -- blsout=$(echo $2 | sed 's/[^,]*,\(.*\)/\1/') -- [ -n "$blsin" ] && cp "test/grub2-support_files/$blsin" ${blsdir}/ -- [ -n "$blsout" ] && cp "test/grub2-support_files/$blsout" ${cmpdir}/ -- blspairs="${blspairs} $2" -- shift 2 -- else -- break -- fi -- done -- -- typeset mode=$1 cfg=test/$2 correct=test/results/$3 -- shift 3 -- -- local ENV_FILE="" -- if [ "$mode" == "--grub2" ]; then -- ENV_FILE="test/grub2-support_files/env_temp" -- if [ "$1" == "--env" ]; then -- cp "test/grub2-support_files/$2" "$ENV_FILE" -- shift 2 -- else -- cp "test/grub2-support_files/grubenv.0" "$ENV_FILE" -- fi -- ENV_FILE="--env=$ENV_FILE" -- fi -- -- declare outfile=$(mktemp) -- echo "$testing ... $mode bls $cfg $correct" -- runme=( ./grubby "$mode" --bad-image-okay $ENV_FILE -c "$cfg" -o - --blsdir="${blsdir}" "$@" ) -- declare -i old_fail=$fail -- if "${runme[@]}" 2>&1 | cmp "$correct" > /dev/null; then -- (( pass++ )) -- if $opt_verbose; then -- echo ------------------------------------------------------------- -- echo -n "PASS: " -- printf "%q " "${runme[@]}"; echo -- "${runme[@]}" 2>&1 | diff -U30 "$cfg" - -- echo -- fi -- else -- (( fail++ )) -- echo ------------------------------------------------------------- -- echo -n "FAIL: " -- printf "%q " "${runme[@]}"; echo -- "${runme[@]}" 2>&1 | diff -U30 "$correct" - -- echo -- fi -- -- for pair in ${blspairs} ; do -- blsin=$(echo $pair | sed 's/\(.*\),.*/\1/') -- blsout=$(echo $pair | sed 's/[^,]*,\(.*\)/\1/') -- -- if [ -z "${blsout}" -a -f ${blsdir}/${blsin} ]; then -- (( fail++ )) -- echo ------------------------------------------------------------- -- echo -n "FAIL: " -- printf "%q " "${runme[@]}"; echo -- diff -U30 /dev/null ${blsdir}/${blsin} -- elif [ -n "${blsout}" ] && ! cmp ${blsdir}/${blsout} ${cmpdir}/${blsout} >/dev/null ; then -- (( fail++ )) -- echo ------------------------------------------------------------- -- echo -n "FAIL: " -- printf "%q " "${runme[@]}"; echo -- diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}" -- else -- (( pass++ )) -- if $opt_verbose; then -- echo ------------------------------------------------------------- -- echo -n "PASS: " -- printf "%q " "${runme[@]}"; echo -- diff -U30 "${cmpdir}/${blsout}" "${blsdir}/${blsout}" -- fi -- fi -- done -- -- if [ $old_fail -eq $fail ]; then -- (( pass++ )) -- if $opt_verbose; then -- echo ------------------------------------------------------------- -- echo -n "PASS: " -- printf "%q " "${runme[@]}"; echo -- "${runme[@]}" 2>&1 | diff -U30 "$cfg" - -- echo -- fi -- fi -- -- rm -rvf ${blsdir}/ ${cmpdir}/ --} -- -- - #---------------------------------------------------------------------- - # Main - #---------------------------------------------------------------------- -@@ -629,15 +533,6 @@ if [ "$testgrub2" == "y" ]; then - grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \ - --initrd=/boot/new-initrd --boot-filesystem=/boot/ - -- testing="GRUB2 add bls kernel+initrd" -- grub2BlsTest \ -- --blspair 6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf,6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf \ -- --blspair ,6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf \ -- --grub2 grub2.15 grub2.15 \ -- --add-kernel=/boot/new-kernel.img \ -- --title=title --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ -- --copy-default -- - testing="GRUB2 display default index" - grub2DisplayTest grub2.1 defaultindex/0 --default-index - grub2DisplayTest grub2.2 defaultindex/0 --default-index -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf -deleted file mode 100644 -index 84b2bdf..0000000 ---- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf -+++ /dev/null -@@ -1,8 +0,0 @@ --# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.0-2.fc19.x86_64.conf --title Fedora 19 (Rawhide) --version 3.8.0-2.fc19.x86_64 --machine-id 6a9857a393724b7a981ebb5b8495b9ea --filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 --linux /boot/vmlinux-3.8.0-2.fc19.x86_64 --options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 --initrd /boot/initrd-3.8.0-2.fc19.x86_64 -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf -deleted file mode 100644 -index e1c61a8..0000000 ---- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf -+++ /dev/null -@@ -1,8 +0,0 @@ --# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-3.8.1-2.fc19.x86_64.conf --title Fedora 19 (Rawhide) --version 3.8.1-2.fc19.x86_64 --machine-id 6a9857a393724b7a981ebb5b8495b9ea --filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 --linux /boot/vmlinux-3.8.1-2.fc19.x86_64 --options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 --initrd /boot/initrd-3.8.1-2.fc19.x86_64 -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf -deleted file mode 100644 -index 4a60fbc..0000000 ---- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf -+++ /dev/null -@@ -1,10 +0,0 @@ --# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.0-2.fc19.x86_64.conf --title Fedora 19 (tboot) (Rawhide) --version 3.8.0-2.fc19.x86_64 --machine-id 6a9857a393724b7a981ebb5b8495b9ea --filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 --multiboot /boot/tboot.gz -- options logging=serial,vga,memory --linux /boot/vmlinux-3.8.0-2.fc19.x86_64 --options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 --initrd /boot/initrd-3.8.0-2.fc19.x86_64 -diff --git a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf b/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf -deleted file mode 100644 -index 34c0e09..0000000 ---- a/test/grub2-support_files/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf -+++ /dev/null -@@ -1,10 +0,0 @@ --# /boot/org/freedesktop/bls/entries/6a9857a393724b7a981ebb5b8495b9ea-tboot-3.8.1-2.fc19.x86_64.conf --title Fedora 19 (tboot) (Rawhide) --version 3.8.1-2.fc19.x86_64 --machine-id 6a9857a393724b7a981ebb5b8495b9ea --filesystem 6d3376e4-fc93-4509-95ec-a21d68011da2 --multiboot /boot/tboot.gz -- options logging=serial,vga,memory --linux /boot/vmlinux-3.8.1-2.fc19.x86_64 --options root=UUID=6d3376e4-fc93-4509-95ec-a21d68011da2 --initrd /boot/initrd-3.8.1-2.fc19.x86_64 -diff --git a/test/grub2.15 b/test/grub2.15 -deleted file mode 100644 -index 0be2d74..0000000 ---- a/test/grub2.15 -+++ /dev/null -@@ -1,112 +0,0 @@ --# --# DO NOT EDIT THIS FILE --# --# It is automatically generated by grub2-mkconfig using templates --# from /etc/grub.d and settings from /etc/default/grub --# -- --### BEGIN /etc/grub.d/00_header ### --if [ -s $prefix/grubenv ]; then -- load_env --fi --if [ "${next_entry}" ] ; then -- set default="${next_entry}" -- set next_entry= -- save_env next_entry -- set boot_once=true --else -- set default="${saved_entry}" --fi -- --if [ x"${feature_menuentry_id}" = xy ]; then -- menuentry_id_option="--id" --else -- menuentry_id_option="" --fi -- --export menuentry_id_option -- --if [ "${prev_saved_entry}" ]; then -- set saved_entry="${prev_saved_entry}" -- save_env saved_entry -- set prev_saved_entry= -- save_env prev_saved_entry -- set boot_once=true --fi -- --function savedefault { -- if [ -z "${boot_once}" ]; then -- saved_entry="${chosen}" -- save_env saved_entry -- fi --} -- --function load_video { -- if [ x$feature_all_video_module = xy ]; then -- insmod all_video -- else -- insmod efi_gop -- insmod efi_uga -- insmod ieee1275_fb -- insmod vbe -- insmod vga -- insmod video_bochs -- insmod video_cirrus -- fi --} -- --if [ x$feature_default_font_path = xy ] ; then -- font=unicode --else --insmod part_gpt --insmod btrfs --set root='hd0,gpt4' --if [ x$feature_platform_search_hint = xy ]; then -- search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 --else -- search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 --fi -- font="/root/usr/share/grub/unicode.pf2" --fi -- --if loadfont $font ; then -- set gfxmode=auto -- load_video -- insmod gfxterm -- set locale_dir=$prefix/locale -- set lang=en_US -- insmod gettext --fi --terminal_output gfxterm --set timeout=5 --### END /etc/grub.d/00_header ### -- --### BEGIN /etc/grub.d/10_blscfg ### -- --bls_import -- --### END /etc/grub.d/10_blscfg ### -- --### BEGIN /etc/grub.d/20_linux_xen ### -- --### END /etc/grub.d/20_linux_xen ### -- --### BEGIN /etc/grub.d/20_ppc_terminfo ### --### END /etc/grub.d/20_ppc_terminfo ### -- --### BEGIN /etc/grub.d/30_os-prober ### --### END /etc/grub.d/30_os-prober ### -- --### BEGIN /etc/grub.d/40_custom ### --# This file provides an easy way to add custom menu entries. Simply type the --# menu entries you want to add after this comment. Be careful not to change --# the 'exec tail' line above. --### END /etc/grub.d/40_custom ### -- --### BEGIN /etc/grub.d/41_custom ### --if [ -f ${config_directory}/custom.cfg ]; then -- source ${config_directory}/custom.cfg --elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then -- source $prefix/custom.cfg; --fi --### END /etc/grub.d/41_custom ### -diff --git a/test/results/grub2.15 b/test/results/grub2.15 -deleted file mode 100644 -index 0be2d74..0000000 ---- a/test/results/grub2.15 -+++ /dev/null -@@ -1,112 +0,0 @@ --# --# DO NOT EDIT THIS FILE --# --# It is automatically generated by grub2-mkconfig using templates --# from /etc/grub.d and settings from /etc/default/grub --# -- --### BEGIN /etc/grub.d/00_header ### --if [ -s $prefix/grubenv ]; then -- load_env --fi --if [ "${next_entry}" ] ; then -- set default="${next_entry}" -- set next_entry= -- save_env next_entry -- set boot_once=true --else -- set default="${saved_entry}" --fi -- --if [ x"${feature_menuentry_id}" = xy ]; then -- menuentry_id_option="--id" --else -- menuentry_id_option="" --fi -- --export menuentry_id_option -- --if [ "${prev_saved_entry}" ]; then -- set saved_entry="${prev_saved_entry}" -- save_env saved_entry -- set prev_saved_entry= -- save_env prev_saved_entry -- set boot_once=true --fi -- --function savedefault { -- if [ -z "${boot_once}" ]; then -- saved_entry="${chosen}" -- save_env saved_entry -- fi --} -- --function load_video { -- if [ x$feature_all_video_module = xy ]; then -- insmod all_video -- else -- insmod efi_gop -- insmod efi_uga -- insmod ieee1275_fb -- insmod vbe -- insmod vga -- insmod video_bochs -- insmod video_cirrus -- fi --} -- --if [ x$feature_default_font_path = xy ] ; then -- font=unicode --else --insmod part_gpt --insmod btrfs --set root='hd0,gpt4' --if [ x$feature_platform_search_hint = xy ]; then -- search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 --else -- search --no-floppy --fs-uuid --set=root 5a2ca487-30f7-4fa5-96bd-abe38b68ceb3 --fi -- font="/root/usr/share/grub/unicode.pf2" --fi -- --if loadfont $font ; then -- set gfxmode=auto -- load_video -- insmod gfxterm -- set locale_dir=$prefix/locale -- set lang=en_US -- insmod gettext --fi --terminal_output gfxterm --set timeout=5 --### END /etc/grub.d/00_header ### -- --### BEGIN /etc/grub.d/10_blscfg ### -- --bls_import -- --### END /etc/grub.d/10_blscfg ### -- --### BEGIN /etc/grub.d/20_linux_xen ### -- --### END /etc/grub.d/20_linux_xen ### -- --### BEGIN /etc/grub.d/20_ppc_terminfo ### --### END /etc/grub.d/20_ppc_terminfo ### -- --### BEGIN /etc/grub.d/30_os-prober ### --### END /etc/grub.d/30_os-prober ### -- --### BEGIN /etc/grub.d/40_custom ### --# This file provides an easy way to add custom menu entries. Simply type the --# menu entries you want to add after this comment. Be careful not to change --# the 'exec tail' line above. --### END /etc/grub.d/40_custom ### -- --### BEGIN /etc/grub.d/41_custom ### --if [ -f ${config_directory}/custom.cfg ]; then -- source ${config_directory}/custom.cfg --elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then -- source $prefix/custom.cfg; --fi --### END /etc/grub.d/41_custom ### --- -1.9.3 - diff --git a/0007-Always-error-check-getLineByType.patch b/0007-Always-error-check-getLineByType.patch deleted file mode 100644 index 2ca4f7a..0000000 --- a/0007-Always-error-check-getLineByType.patch +++ /dev/null @@ -1,32 +0,0 @@ -From e3a293332591f44a190775a3b4dceefe2e5118a1 Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Thu, 25 Sep 2014 13:24:15 -0400 -Subject: [PATCH 07/10] Always error check getLineByType() - -Signed-off-by: Peter Jones ---- - grubby.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/grubby.c b/grubby.c -index baf646b..b202b6e 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -2369,9 +2369,11 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) { - } else { - char * title; - line = getLineByType(LT_MENUENTRY, entry->lines); -- title = grub2ExtractTitle(line); -- if (title) -- printf("title=%s\n", title); -+ if (line) { -+ title = grub2ExtractTitle(line); -+ if (title) -+ printf("title=%s\n", title); -+ } - } - - for (j = 0, line = entry->lines; line; line = line->next) { --- -1.9.3 - diff --git a/0008-Add-devtree-support-to-extlinux-1088933.patch b/0008-Add-devtree-support-to-extlinux-1088933.patch deleted file mode 100644 index 1dd7ed3..0000000 --- a/0008-Add-devtree-support-to-extlinux-1088933.patch +++ /dev/null @@ -1,155 +0,0 @@ -From eb141563832f803abdfc1fde83fbfcc9031794b3 Mon Sep 17 00:00:00 2001 -From: Dennis Gilmore -Date: Fri, 10 Oct 2014 02:06:52 -0500 -Subject: [PATCH 08/10] Add --devtree support to extlinux (#1088933) - -On 32 bit arm it needs the path to the dtb. This adds support for the -fdt command to the extlinux handling. If --devtree /path/to/dtb/file.dtb -is passed grubby will add or updated it. ---- - grubby.c | 1 + - new-kernel-pkg | 20 ++++++++++++++++++-- - test.sh | 5 +++++ - test/extlinux.5 | 21 +++++++++++++++++++++ - test/results/add/extlinux5.1 | 21 +++++++++++++++++++++ - 5 files changed, 66 insertions(+), 2 deletions(-) - create mode 100644 test/extlinux.5 - create mode 100644 test/results/add/extlinux5.1 - -diff --git a/grubby.c b/grubby.c -index b202b6e..cbb1cca 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -581,6 +581,7 @@ struct keywordTypes extlinuxKeywords[] = { - { "initrd", LT_INITRD, ' ', ',' }, - { "append", LT_KERNELARGS, ' ' }, - { "prompt", LT_UNKNOWN, ' ' }, -+ { "fdt", LT_DEVTREE, ' ' }, - { NULL, 0, 0 }, - }; - int useextlinuxmenu; -diff --git a/new-kernel-pkg b/new-kernel-pkg -index d9a9b67..0f21e39 100755 ---- a/new-kernel-pkg -+++ b/new-kernel-pkg -@@ -265,7 +265,7 @@ install() { - - $grubby --extlinux -c $extlinuxConfig \ - --add-kernel=$kernelImage \ -- $INITRD --copy-default $makedefault --title "$title" \ -+ $DEVTREE $INITRD --copy-default $makedefault --title "$title" \ - ${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ - --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title" - else -@@ -411,6 +411,12 @@ update() { - fi - fi - -+ DEVTREE="" -+ if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then -+ [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" -+ DEVTREE="--devtree $devtreefile" -+ fi -+ - if [ -n "$cfgGrub" ]; then - [ -n "$verbose" ] && echo "updating $version from $grubConfig" - $grubby --grub -c $grubConfig \ -@@ -499,7 +505,7 @@ update() { - [ -n "$verbose" ] && echo "updating $version from $extlinuxConfig" - $grubby --extlinux -c $extlinuxConfig \ - --update-kernel=$kernelImage \ -- $INITRD \ -+ $DEVTREE $INITRD \ - ${kernargs:+--args="$kernargs"} \ - ${removeargs:+--remove-args="$removeargs"} - else -@@ -724,6 +730,16 @@ if [ -z "$initrdfile" ]; then - fi - [ -n "$verbose" ] && echo "initrdfile is $initrdfile" - -+if [[ ${ARCH} =~ armv[5|7].*l ]]; then -+ if [ -d "$bootPrefix/dtb-$version/" ]; then -+ devtreedir="$bootPrefix/dtb-$version/" -+ if [ -n "$dtbfile" -a -f "$devtreedir/$dtbfile" ]; then -+ devtreefile="$devtreedir/$dtbfile" -+ fi -+ fi -+fi -+[ -n "$verbose" ] && echo "devtreedir is $devtreedir" -+ - # add dracut i18n, keyboard and plymouth kernel args if requested - if [ -n "$dracut" -o -n "$adddracutargs" ]; then - if [ -r /etc/vconsole.conf ]; then -diff --git a/test.sh b/test.sh -index 864a8ce..67b932d 100755 ---- a/test.sh -+++ b/test.sh -@@ -647,6 +647,11 @@ extlinuxTest extlinux.2 add/extlinux2.1 --add-kernel=/boot/vmlinuz-3.12.0-2.fc21 - --initrd=/boot/initrd-3.12.0-2.fc21.i686-new.img --boot-filesystem=/boot --copy-default \ - --title="Fedora (3.12.0-2.fc21.i686) 20 (Heisenbug)" \ - --remove-kernel="TITLE=Fedora (3.12.0-2.fc21.i686) 20 (Heisenbug)" -+extlinuxTest extlinux.5 add/extlinux5.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl \ -+ --devtree='/boot/dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/imx6q-cubox-i.dtb' \ -+ --initrd=/boot/initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img --boot-filesystem=/boot --copy-default \ -+ --title="Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)" \ -+ --remove-kernel="TITLE=Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)" - - testing="LILO long titles" - liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \ -diff --git a/test/extlinux.5 b/test/extlinux.5 -new file mode 100644 -index 0000000..30e7572 ---- /dev/null -+++ b/test/extlinux.5 -@@ -0,0 +1,21 @@ -+ui menu.c32 -+ -+menu hidden -+timeout 50 -+totaltimeout 9000 -+ -+prompt 10 -+default Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide) -+ -+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl -+fdt /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/imx6q-cubox-i.dtb -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img -+ -+label Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.12.0-0.fc21.armv7hl -+fdt /dtb-3.12.0-0.fc21.armv7hl/imx6q-cubox-i.dtb -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.12.0-0.fc21.armv7hl.img -+ -diff --git a/test/results/add/extlinux5.1 b/test/results/add/extlinux5.1 -new file mode 100644 -index 0000000..5e97883 ---- /dev/null -+++ b/test/results/add/extlinux5.1 -@@ -0,0 +1,21 @@ -+ui menu.c32 -+ -+menu hidden -+timeout 50 -+totaltimeout 9000 -+ -+prompt 10 -+default Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide) -+ -+label Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl -+fdt /dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/imx6q-cubox-i.dtb -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img -+ -+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl -+fdt /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/imx6q-cubox-i.dtb -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img -+ --- -1.9.3 - diff --git a/0009-add-support-for-devicetree-directories-for-use-on-ar.patch b/0009-add-support-for-devicetree-directories-for-use-on-ar.patch deleted file mode 100644 index 0c64014..0000000 --- a/0009-add-support-for-devicetree-directories-for-use-on-ar.patch +++ /dev/null @@ -1,194 +0,0 @@ -From 69dbfdc99ce993d541984f7305bb1206858f4bcf Mon Sep 17 00:00:00 2001 -From: Dennis Gilmore -Date: Fri, 10 Oct 2014 01:38:27 -0500 -Subject: [PATCH 09/10] add support for devicetree directories for use on arm - ---- - grubby.c | 3 +++ - new-kernel-pkg | 31 ++++++++++++++++++++++++++----- - test.sh | 5 +++++ - test/extlinux.6 | 21 +++++++++++++++++++++ - test/results/add/extlinux6.1 | 21 +++++++++++++++++++++ - 5 files changed, 76 insertions(+), 5 deletions(-) - create mode 100644 test/extlinux.6 - create mode 100644 test/results/add/extlinux6.1 - -diff --git a/grubby.c b/grubby.c -index cbb1cca..a4a9811 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -582,6 +582,7 @@ struct keywordTypes extlinuxKeywords[] = { - { "append", LT_KERNELARGS, ' ' }, - { "prompt", LT_UNKNOWN, ' ' }, - { "fdt", LT_DEVTREE, ' ' }, -+ { "fdtdir", LT_DEVTREE, ' ' }, - { NULL, 0, 0 }, - }; - int useextlinuxmenu; -@@ -4232,6 +4233,8 @@ int main(int argc, const char ** argv) { - _("display the title of the default kernel") }, - { "devtree", 0, POPT_ARG_STRING, &newDevTreePath, 0, - _("device tree file for new stanza"), _("dtb-path") }, -+ { "devtreedir", 0, POPT_ARG_STRING, &newDevTreePath, 0, -+ _("device tree directory for new stanza"), _("dtb-path") }, - { "elilo", 0, POPT_ARG_NONE, &configureELilo, 0, - _("configure elilo bootloader") }, - { "efi", 0, POPT_ARG_NONE, &isEfi, 0, -diff --git a/new-kernel-pkg b/new-kernel-pkg -index 0f21e39..31976a7 100755 ---- a/new-kernel-pkg -+++ b/new-kernel-pkg -@@ -128,7 +128,7 @@ usage() { - echo " [--banner=] [--multiboot=multiboot]" >&2 - echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2 - echo " [--add-plymouth-initrd]" >&2 -- echo " [--host-only] [--devtree=]" >&2 -+ echo " [--host-only] [--devtree=] [--devtreedir=]" >&2 - echo " <--install | --remove | --update | --rpmposttrans> " >&2 - echo " (ex: `basename $0` --mkinitrd --depmod --install 2.4.7-2)" >&2 - exit 1 -@@ -153,11 +153,17 @@ install() { - fi - - DEVTREE="" -- if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then -+ if [ -n "$devtreefile" -a -f "$devtreefile" ]; then - [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" - DEVTREE="--devtree $devtreefile" - fi - -+ DEVTREEDIR="" -+ if [ -n "$devtreedir" -a -d "$devtreedir" ]; then -+ [ -n "$verbose" ] && echo "found $devtreedir and using it with grubby" -+ DEVTREEDIR="--devtreedir $devtreedir" -+ fi -+ - # FIXME: is this a good heuristic to find out if we're on iSeries? - if [ -d /proc/iSeries ]; then - [ -n "$verbose" ] && echo "On an iSeries, just making img file" -@@ -264,7 +270,7 @@ install() { - [ -n "$verbose" ] && echo "adding $version to $extlinuxConfig" - - $grubby --extlinux -c $extlinuxConfig \ -- --add-kernel=$kernelImage \ -+ --add-kernel=$kernelImage $DEVTREEDIR \ - $DEVTREE $INITRD --copy-default $makedefault --title "$title" \ - ${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ - --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title" -@@ -412,11 +418,17 @@ update() { - fi - - DEVTREE="" -- if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then -+ if [ -n "$devtreefile" -a -f "$devtreefile" ]; then - [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" - DEVTREE="--devtree $devtreefile" - fi - -+ DEVTREEDIR="" -+ if [ -n "$devtreedir" -a -d "$devtreedir" ]; then -+ [ -n "$verbose" ] && echo "found $devtreedir and using it with grubby" -+ DEVTREEDIR="--devtreedir $devtreedir" -+ fi -+ - if [ -n "$cfgGrub" ]; then - [ -n "$verbose" ] && echo "updating $version from $grubConfig" - $grubby --grub -c $grubConfig \ -@@ -505,7 +517,7 @@ update() { - [ -n "$verbose" ] && echo "updating $version from $extlinuxConfig" - $grubby --extlinux -c $extlinuxConfig \ - --update-kernel=$kernelImage \ -- $DEVTREE $INITRD \ -+ $DEVTREE $DEVTREEDIR $INITRD \ - ${kernargs:+--args="$kernargs"} \ - ${removeargs:+--remove-args="$removeargs"} - else -@@ -566,6 +578,15 @@ while [ $# -gt 0 ]; do - fi - ;; - -+ --devtreedir*) -+ if [[ $1 == --devtreedir\=* ]]; then -+ devtreedir=${1#--devtreedir=} -+ else -+ devtreedir=$2 -+ shift -+ fi -+ ;; -+ - --dracut) - dracut=--dracut - ;; -diff --git a/test.sh b/test.sh -index 67b932d..fe574c3 100755 ---- a/test.sh -+++ b/test.sh -@@ -652,6 +652,11 @@ extlinuxTest extlinux.5 add/extlinux5.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1. - --initrd=/boot/initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img --boot-filesystem=/boot --copy-default \ - --title="Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)" \ - --remove-kernel="TITLE=Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)" -+extlinuxTest extlinux.6 add/extlinux6.1 --add-kernel=/boot/vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl \ -+ --devtreedir='/boot/dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/' \ -+ --initrd=/boot/initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img --boot-filesystem=/boot --copy-default \ -+ --title="Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide)" \ -+ --remove-kernel="TITLE=Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide)" - - testing="LILO long titles" - liloTest lilo.1 longtitle/l1.1 --add-kernel=/boot/new-kernel.img \ -diff --git a/test/extlinux.6 b/test/extlinux.6 -new file mode 100644 -index 0000000..c28a4a8 ---- /dev/null -+++ b/test/extlinux.6 -@@ -0,0 +1,21 @@ -+ui menu.c32 -+ -+menu hidden -+timeout 50 -+totaltimeout 9000 -+ -+prompt 10 -+default Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide) -+ -+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl -+fdtdir /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/ -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img -+ -+label Fedora (3.12.0-0.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.12.0-0.fc21.armv7hl -+fdtdir /dtb-3.12.0-0.fc21.armv7hl/ -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.12.0-0.fc21.armv7hl.img -+ -diff --git a/test/results/add/extlinux6.1 b/test/results/add/extlinux6.1 -new file mode 100644 -index 0000000..ec2a2ea ---- /dev/null -+++ b/test/results/add/extlinux6.1 -@@ -0,0 +1,21 @@ -+ui menu.c32 -+ -+menu hidden -+timeout 50 -+totaltimeout 9000 -+ -+prompt 10 -+default Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide) -+ -+label Fedora (3.15.0-0.rc1.git4.1.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.15.0-0.rc1.git4.1.fc21.armv7hl -+fdtdir /dtb-3.15.0-0.rc1.git4.1.fc21.armv7hl/ -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.15.0-0.rc1.git4.1.fc21.armv7hl.img -+ -+label Fedora (3.15.0-0.rc1.git0.1.fc21.armv7hl) 21 (Rawhide) -+kernel /vmlinuz-3.15.0-0.rc1.git0.1.fc21.armv7hl -+fdtdir /dtb-3.15.0-0.rc1.git0.1.fc21.armv7hl/ -+append console=ttymxc0,115200 root=UUID=7ee85ed8-de4a-4779-8658-2daed0d35e97 ro rhgb quiet LANG=en_US.UTF-8 -+initrd /initramfs-3.15.0-0.rc1.git0.1.fc21.armv7hl.img -+ --- -1.9.3 - diff --git a/0010-cleanup-dtb-handling-to-work-in-the-supported-usecas.patch b/0010-cleanup-dtb-handling-to-work-in-the-supported-usecas.patch deleted file mode 100644 index 1dd031f..0000000 --- a/0010-cleanup-dtb-handling-to-work-in-the-supported-usecas.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 354c873f633db124d214da8a1258e32fe210c7cb Mon Sep 17 00:00:00 2001 -From: Dennis Gilmore -Date: Thu, 9 Oct 2014 01:42:03 -0500 -Subject: [PATCH 10/10] cleanup dtb handling to work in the supported usecases - -add SHIPSDTB variable in the uboot defaults file that needs to be set to yes for -platforms like the calxeda highbank that ship a dtb in u-boot that we want to use. -if the user defines a dtbfile in /etc/sysconfig/uboot update the extlinux.conf -with an fdt entry otherwise update a fdtdir entry unless SHIPSDTB is set to yes. ---- - new-kernel-pkg | 12 +++++++----- - uboot | 5 +++++ - 2 files changed, 12 insertions(+), 5 deletions(-) - -diff --git a/new-kernel-pkg b/new-kernel-pkg -index 31976a7..311deda 100755 ---- a/new-kernel-pkg -+++ b/new-kernel-pkg -@@ -752,14 +752,16 @@ fi - [ -n "$verbose" ] && echo "initrdfile is $initrdfile" - - if [[ ${ARCH} =~ armv[5|7].*l ]]; then -- if [ -d "$bootPrefix/dtb-$version/" ]; then -- devtreedir="$bootPrefix/dtb-$version/" -- if [ -n "$dtbfile" -a -f "$devtreedir/$dtbfile" ]; then -- devtreefile="$devtreedir/$dtbfile" -+ if [ -z "$SHIPSDTB" -o "$SHIPSDTB" != "yes" ]; then -+ if [ -n "$dtbfile" -a -f "$bootPrefix/dtb-$version/$dtbfile" ]; then -+ devtreefile="$bootPrefix/dtb-$version/$dtbfile" -+ [ -n "$verbose" ] && echo "devtreefile is $devtreefile" -+ elif [ -d "$bootPrefix/dtb-$version/" ]; then -+ devtreedir="$bootPrefix/dtb-$version/" -+ [ -n "$verbose" ] && echo "devtreedir is $devtreedir" - fi - fi - fi --[ -n "$verbose" ] && echo "devtreedir is $devtreedir" - - # add dracut i18n, keyboard and plymouth kernel args if requested - if [ -n "$dracut" -o -n "$adddracutargs" ]; then -diff --git a/uboot b/uboot -index aa663ad..07d8671 100644 ---- a/uboot -+++ b/uboot -@@ -36,3 +36,8 @@ - # default initrd uInitrd file name - #UBOOT_UINITRD=uInitrd - -+# defualt for platform shipping an onboard dtb. -+#SHIPSDTB=no -+ -+# option to tell new-kernel-pkg a specific dtb file to load in extlinux.conf -+#dtbfile=foo.dtb --- -1.9.3 - diff --git a/10-devicetree.install b/10-devicetree.install new file mode 100755 index 0000000..fdea5ec --- /dev/null +++ b/10-devicetree.install @@ -0,0 +1,73 @@ +#!/bin/bash + +# set -x + +if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 || "$(uname -m)" == riscv64 ]] +then +COMMAND="$1" +KERNEL_VERSION="$2" +#BOOT_DIR_ABS="$3" +#KERNEL_IMAGE="$4" + +[ -f /etc/u-boot.conf ] && source /etc/u-boot.conf || true +[ -z "$FIRMWAREDT" ] || FirmwareDT=$FIRMWAREDT + +if [[ $FirmwareDT == "True" ]] +then + # if we want to use firmware DT we remove symlink to current kernel DT + if [ -h /boot/dtb ]; then + rm -f /boot/dtb + fi + exit 0 +fi + +# Setup a /boot/dtb -> /boot/dtb-$newest_kernel_version symlink so that +# u-boot can find the correct dtb to load. +# +# If invoked to 'add' a new kernel, find the newest based on `sort`ing +# the kernel versions dtb. If 'remove', then follow basically the same +# procedure but exclude the version currently being removed. +# +# The theory of operation here is that, while newer kernels may add new +# dtb nodes and fields, as upstreaming hw support for some particular +# device progresses, it should never make backward incompatible changes. +# So it should always be safe to use a newer dtb with an older kernel. + + list_dtb_versions() { + excluded_version="$1" + for dtbdir in /boot/dtb-*; do + dtbver=${dtbdir#*-} + if [ "$dtbver" != "$excluded_version" ]; then + echo $dtbver + fi + done + } + + setup_dtb_link() { + ver=`list_dtb_versions $1 | sort -r --sort=version | head -1` + if [ -h /boot/dtb ]; then + rm -f /boot/dtb + fi + ln -s dtb-$ver /boot/dtb + } + + ret=0 + case "$COMMAND" in + add) + # If we're adding a kernel we want that version + if [ -h /boot/dtb ]; then + rm -f /boot/dtb + fi + ln -s dtb-$KERNEL_VERSION /boot/dtb + ret=$? + ;; + remove) + setup_dtb_link $KERNEL_VERSION + ret=$? + ;; + esac + exit $ret +else + # Just exit on non ARM + exit 0 +fi diff --git a/95-kernel-hooks.install b/95-kernel-hooks.install new file mode 100755 index 0000000..1313556 --- /dev/null +++ b/95-kernel-hooks.install @@ -0,0 +1,33 @@ +#!/usr/bin/bash + +if ! [[ $KERNEL_INSTALL_MACHINE_ID ]]; then + exit 0 +fi + +COMMAND="$1" +KERNEL_VERSION="$2" +BOOT_DIR_ABS="$3" + +# If $BOOT_DIR_ABS exists, some other boot loader is active. +[[ -d "$BOOT_DIR_ABS" ]] && exit 0 + +run_hooks() +{ + local f + local files="$1" + for f in $files ; do + [ -x "$f" ] || continue + "$f" "$KERNEL_VERSION" "/boot/vmlinuz-$KERNEL_VERSION" + done +} + +case "$COMMAND" in + add) + run_hooks "/etc/kernel/postinst.d/*[^~] /etc/kernel/postinst.d/$KERNEL_VERSION/*[^~]" + ;; + remove) + run_hooks "/etc/kernel/prerm.d/*[^~] /etc/kernel/prerm.d/$KERNEL_VERSION/*[^~]" + ;; + *) + exit 0 +esac diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..f90922e --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/grubby-bls b/grubby-bls new file mode 100755 index 0000000..11b69b1 --- /dev/null +++ b/grubby-bls @@ -0,0 +1,857 @@ +#!/bin/bash +# +# grubby wrapper to manage BootLoaderSpec files +# +# +# Copyright 2018 Red Hat, Inc. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +readonly SCRIPTNAME="${0##*/}" + +CMDLINE_LINUX_DEBUG=" systemd.log_level=debug systemd.log_target=kmsg" +LINUX_DEBUG_VERSION_POSTFIX="_with_debugging" +LINUX_DEBUG_TITLE_POSTFIX=" with debugging" + +declare -a bls_file +declare -a bls_title +declare -a bls_version +declare -a bls_linux +declare -a bls_initrd +declare -a bls_options +declare -a bls_id + +[[ -f /etc/sysconfig/kernel ]] && . /etc/sysconfig/kernel +[[ -f /etc/os-release ]] && . /etc/os-release +read MACHINE_ID < /etc/machine-id +arch=$(uname -m) + +if [[ $arch = 's390' || $arch = 's390x' ]]; then + bootloader="zipl" +else + bootloader="grub2" +fi + +print_error() { + echo "$1" >&2 + exit 1 +} + +print_info() { + echo "$1" >&2 +} + +if [[ ${#} = 0 ]]; then + print_error "no action specified" +fi + +get_bls_value() { + local bls="$1" && shift + local key="$1" && shift + + echo "$(grep "^${key}[ \t]" "${bls}" | sed -e "s!^${key}[ \t]*!!")" +} + +set_bls_value() { + local bls="$1" && shift + local key="$1" && shift + local value="$1" && shift + + value=$(echo $value | sed -e 's/\//\\\//g') + sed -i -e "s/^${key}.*/${key} ${value}/" "${bls}" +} + +append_bls_value() { + local bls="$1" && shift + local key="$1" && shift + local value="$1" && shift + + old_value="$(get_bls_value "${bls}" ${key})" + set_bls_value "${bls}" "${key}" "${old_value}${value}" +} + +get_bls_values() { + count=0 + local -a files + local IFS=$'\n' + files=($(for bls in ${blsdir}/*.conf ; do + if ! [[ -e "${bls}" ]] ; then + continue + fi + bls="${bls%.conf}" + bls="${bls##*/}" + echo "${bls}" + done | sort -Vr 2>/dev/null)) || : + + for bls in "${files[@]}" ; do + blspath="${blsdir}/${bls}.conf" + bls_file[$count]="${blspath}" + bls_title[$count]="$(get_bls_value ${blspath} title)" + bls_version[$count]="$(get_bls_value ${blspath} version)" + bls_linux[$count]="$(get_bls_value ${blspath} linux)" + bls_initrd[$count]="$(get_bls_value ${blspath} initrd)" + bls_options[$count]="$(get_bls_value ${blspath} options)" + bls_id[$count]="${bls}" + + count=$((count+1)) + done +} + +get_default_index() { + local default="" + local index="-1" + local title="" + local version="" + if [[ $bootloader = "grub2" ]]; then + default="$(grep '^saved_entry=' ${env} | sed -e 's/^saved_entry=//')" + else + default="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')" + fi + + if [[ -z $default ]]; then + index=0 + elif [[ $default =~ ^[0-9]+$ ]]; then + index="$default" + fi + + for i in ${!bls_file[@]}; do + if [[ $i -eq $index ]]; then + echo $i + return + fi + + if [[ $default = ${bls_id[$i]} || $default = ${bls_title[$i]} ]]; then + echo $i + return + fi + done +} + +display_default_value() { + local prefix=$(get_prefix) + + case "$display_default" in + kernel) + echo "${prefix}${bls_linux[$default_index]}" + exit 0 + ;; + index) + echo "$default_index" + exit 0 + ;; + title) + echo "${bls_title[$default_index]}" + exit 0 + ;; + esac +} + +param_to_indexes() { + local param="$1" + local indexes="" + + if [[ $param = "ALL" ]]; then + for i in ${!bls_file[@]}; do + indexes="$indexes $i" + done + echo -n $indexes + return + fi + + if [[ $param = "DEFAULT" ]]; then + echo -n $default_index + return + fi + + for i in ${!bls_file[@]}; do + if [[ $param = "${bls_linux[$i]}" || "/${param##*/}" = "${bls_linux[$i]}" ]]; then + indexes="$indexes $i" + fi + + if [[ $param = "TITLE=${bls_title[$i]}" ]]; then + indexes="$indexes $i" + fi + + if [[ $param = $i ]]; then + indexes="$indexes $i" + fi + done + + if [[ -n $indexes ]]; then + echo -n $indexes + return + fi + + echo -n "-1" +} + +get_prefix() { + if [[ $bootloader = grub2 ]] && mountpoint -q /boot; then + echo "/boot" + else + echo "" + fi +} + +expand_var() { + local var=$1 + + if [[ $bootloader == "grub2" ]]; then + local value="$(grub2-editenv "${env}" list | grep ${var##$} | sed -e "s/${var##$}=//")" + value="$(echo ${value} | sed -e 's/\//\\\//g')" + if [[ -n $value ]]; then + var="$value" + fi + fi + + echo $var +} + +has_kernelopts() +{ + local args=${bls_options[$1]} + local opts=(${args}) + + for opt in ${opts[*]}; do + [[ $opt = "\$kernelopts" ]] && echo "true" + done + + echo "false" +} + +get_bls_args() { + local args=${bls_options[$1]} + local opts=(${args}) + + for opt in ${opts[*]}; do + if [[ $opt = "\$kernelopts" ]]; then + value="$(expand_var $opt)" + args="$(echo ${args} | sed -e "s/${opt}/${value}/")" + fi + done + + echo ${args} +} + +display_info_values() { + local indexes=($(param_to_indexes "$1")) + local prefix=$(get_prefix) + + if [[ $indexes = "-1" ]]; then + print_error "The param $1 is incorrect" + fi + + for i in ${indexes[*]}; do + local root="" + local value="" + local args="$(get_bls_args "$i")" + + local opts=(${args}) + + for opt in ${opts[*]}; do + if echo $opt | grep -q "^root="; then + root="$(echo $opt | sed -e 's/root=//')" + value="$(echo ${opt} | sed -e 's/\//\\\//g')" + args="$(echo ${args} | sed -e "s/${value}[ \t]*//")" + break + fi + done + + echo "index=$i" + echo "kernel=\"${prefix}${bls_linux[$i]}\"" + echo "args=\"${args}\"" + + if [[ -n $root ]]; then + echo "root=\"${root}\"" + fi + + echo "initrd=\"${prefix}${bls_initrd[$i]}\"" + echo "title=\"${bls_title[$i]}\"" + echo "id=\"${bls_id[$i]}\"" + done + exit 0 +} + +mkbls() { + local kernel=$1 && shift + local kernelver=$1 && shift + local datetime=$1 && shift + + local debugname="" + local flavor="" + local prefix="" + + if [[ $(get_prefix) = "" ]]; then + prefix="/boot" + fi + + if [[ $kernelver == *\+* ]] ; then + local flavor=-"${kernelver##*+}" + if [[ $flavor == "-debug" ]]; then + local debugname="with debugging" + local debugid="-debug" + fi + fi + + cat </dev/null | sort -V); do + if [[ -e ${bls_entry} ]]; then + bls_entry="${bls_entry##"${prefix}".}" + bls_entry="${bls_entry%%~custom*}" + if [[ "${bls_entry}" = "${first}" ]]; then + first=$((first+1)) + else + break + fi + fi + done + echo "${first}") || : + + if [[ -z "$first_gap" ]]; then + first_gap="0" + fi + + echo "${bls_target}" | sed -e "s!${prefix}!${prefix}.${first_gap}~custom!" +} + +add_bls_fragment() { + local kernel="$1" && shift + local title="$1" && shift + local options="$1" && shift + local initrd="$1" && shift + local extra_initrd="$1" && shift + + if [[ $kernel = *"vmlinuz-"* ]]; then + kernelver="${kernel##*/vmlinuz-}" + prefix="vmlinuz-" + else + kernelver="${kernel##*/}" + fi + + if [[ ! -f "/boot/${prefix}${kernelver}" ]] && + [[ $bad_image != "true" ]]; then + print_error "The ${kernelver} kernel isn't installed in the machine" + fi + + if [[ -z $title ]]; then + print_error "The kernel title must be specified" + fi + + if [[ ! -d $blsdir ]]; then + install -m 700 -d "${blsdir}" + fi + + bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf" + + if [[ -e ${bls_target} ]]; then + bls_target="$(get_custom_bls_filename "${kernelver}")" + print_info "An entry for kernel ${kernelver} already exists, adding ${bls_target}" + fi + + kernel_dir="/lib/modules/${kernelver}" + if [[ -d $kernel_dir ]]; then + datetime="$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" + else + datetime=0 + fi + mkbls "${kernel}" "${kernelver}" "${datetime}" > "${bls_target}" + + if [[ -n $title ]]; then + set_bls_value "${bls_target}" "title" "${title}" + fi + + if [[ -n $options ]]; then + set_bls_value "${bls_target}" "options" "${options}" + fi + + if [[ -n $initrd ]]; then + set_bls_value "${bls_target}" "initrd" "${initrd}" + fi + + if [[ -n $extra_initrd ]]; then + append_bls_value "${bls_target}" "initrd" " ${extra_initrd}" + fi + + if [[ $MAKEDEBUG = "yes" ]]; then + bls_debug="$(echo ${bls_target} | sed -e "s/${kernelver}/${kernelver}~debug/")" + cp -aT "${bls_target}" "${bls_debug}" + append_bls_value "${bls_debug}" "title" "${LINUX_DEBUG_TITLE_POSTFIX}" + append_bls_value "${bls_debug}" "version" "${LINUX_DEBUG_VERSION_POSTFIX}" + append_bls_value "${bls_debug}" "options" "${CMDLINE_LINUX_DEBUG}" + blsid="$(get_bls_value ${bls_debug} "id" | sed -e "s/${kernelver}/${kernelver}~debug/")" + set_bls_value "${bls_debug}" "id" "${blsid}" + fi + + get_bls_values + + if [[ $make_default = "true" ]]; then + set_default_bls "TITLE=${title}" + fi + + update_grubcfg + + exit 0 +} + +update_args() { + local args=$1 && shift + local remove_args=($1) && shift + local add_args=($1) && shift + + for arg in ${remove_args[*]}; do + arg="$(echo $arg | sed -e 's/\//\\\//g')" + if [[ $arg = *"="* ]]; then + args="$(echo $args | sed -E "s/(^|[[:space:]])$arg([[:space:]]|$)/ /")" + else + args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" + fi + done + + for arg in ${add_args[*]}; do + arg="${arg%%=*}" + arg="$(echo $arg | sed -e 's/\//\\\//g')" + args="$(echo $args | sed -E "s/(^|[[:space:]])$arg(([[:space:]]|$)|([=][^ ]*([$]*)))/ /g")" + done + + for arg in ${add_args[*]}; do + args="$args $arg" + done + + echo ${args} +} + +update_bls_fragment() { + local param="$1" + local indexes=($(param_to_indexes "$1")) && shift + local remove_args=$1 && shift + local add_args=$1 && shift + local initrd=$1 && shift + local opts + + if [[ $indexes = "-1" ]]; then + print_error "The param $(get_prefix)${param} is incorrect" + fi + + if [[ $param = "ALL" && $bootloader = grub2 ]] && [[ -n $remove_args || -n $add_args ]]; then + local old_args="" + + if [[ -z $no_etc_update ]] && [[ -e ${grub_etc_default} ]]; then + old_args="$(source ${grub_etc_default}; echo ${GRUB_CMDLINE_LINUX})" + if [[ -n $old_args ]]; then + opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + opts="$(echo "$opts" | sed -e 's/\//\\\//g')" + sed -i -e "s/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\\\"${opts}\\\"/" "${grub_etc_default}" + fi + fi + + old_args="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")" + if [[ -n $old_args ]]; then + opts="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + grub2-editenv "${env}" set kernelopts="${opts}" + fi + elif [[ $bootloader = grub2 ]]; then + opts="$(grub2-editenv "${env}" list | grep kernelopts | sed -e "s/kernelopts=//")" + fi + + for i in ${indexes[*]}; do + if [[ -n $remove_args || -n $add_args ]]; then + local old_args="$(get_bls_args "$i")" + local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + + if [[ $param != "ALL" || "$(has_kernelopts "$i")" = "false" ]]; then + set_bls_value "${bls_file[$i]}" "options" "${new_args}" + fi + fi + + if [[ -n $initrd ]]; then + set_bls_value "${bls_file[$i]}" "initrd" "${initrd}" + fi + done + + if [[ $param = "ALL" ]] && [[ -n $remove_args || -n $add_args ]]; then + if [[ ! -f /etc/kernel/cmdline ]]; then + # anaconda could pre-populate this file, but until then, most of + # the time we'll just want the most recent one. This is pretty + # close to the current almost-correct behavior of falling back to + # /proc/cmdline anyhow. + echo "$(get_bls_args -1)" > /etc/kernel/cmdline + fi + + read old_args < /etc/kernel/cmdline + local new_args="$(update_args "${old_args}" "${remove_args}" "${add_args}")" + echo "$new_args" > /etc/kernel/cmdline + fi + + update_grubcfg +} + +set_default_bls() { + local index=($(param_to_indexes "$1")) + + if [[ $index = "-1" ]]; then + print_error "The param $1 is incorrect" + fi + + if [[ $bootloader = grub2 ]]; then + grub2-editenv "${env}" set saved_entry="${bls_id[$index]}" + else + local default="${bls_title[$index]}" + local current="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')" + if [[ -n $current ]]; then + sed -i -e "s,^default=.*,default=${default}," "${zipl_config}" + else + echo "default=${default}" >> "${zipl_config}" + fi + fi + update_grubcfg + print_info "The default is ${bls_file[$index]} with index $index and kernel $(get_prefix)${bls_linux[$index]}" +} + +remove_var_prefix() { + local prefix="$1" + + [ -z "${prefix}" ] && return + + if [[ -n $remove_kernel && $remove_kernel =~ ^/ ]]; then + remove_kernel="/${remove_kernel##${prefix}/}" + fi + + if [[ -n $initrd ]]; then + initrd="/${initrd##${prefix}/}" + fi + + if [[ -n $extra_initrd ]]; then + extra_initrd="/${extra_initrd##${prefix}/}" + fi + + if [[ -n $kernel ]]; then + kernel="/${kernel##${prefix}/}" + fi + + if [[ -n $update_kernel && $update_kernel =~ ^/ ]]; then + update_kernel="/${update_kernel##${prefix}/}" + fi +} + +update_grubcfg() +{ + # Turn on RUN_MKCONFIG on different archs/scenarios + if [[ "${arch}" = 's390' ]] || [[ "${arch}" = 's390x' ]]; then + # On s390/s390x systems, run mkconfig/zipl + RUN_MKCONFIG="true" + elif [[ "${arch}" = "ppc64le" ]] && [[ -d /sys/firmware/opal ]]; then + # Older ppc64le OPAL firmware don't have BLS support so grub2-mkconfig has to be run + # to generate a config with menuentry commands. + RUN_MKCONFIG="true" + elif [[ -e /sys/hypervisor/type ]] && grep -q "^xen$" /sys/hypervisor/type; then + if [ ! -e /sys/hypervisor/guest_type ] || ! grep -q "^HVM$" /sys/hypervisor/guest_type; then + # PV and PVH Xen DomU guests boot with pygrub that doesn't have BLS support, + # also Xen Dom0 use the menuentries from 20_linux_xen and not the ones from + # 10_linux. So grub2-mkconfig has to run for both Xen Dom0 and DomU. + RUN_MKCONFIG=true + fi + fi + + if [[ $RUN_MKCONFIG = "true" ]]; then + if [[ $bootloader = "zipl" ]]; then + zipl + else + grub2-mkconfig --no-grubenv-update -o "${grub_config}" &> /dev/null + fi + fi +} + +print_usage() +{ + cat <&2 + echo "Try '${SCRIPTNAME} --help' to list supported options" >&2 + echo + exit 1 + ;; + --) + shift + break + ;; + *) + echo + echo "${SCRIPTNAME}: invalid option \"${1}\"" >&2 + echo "Try '${SCRIPTNAME} --help' for more information" >&2 + echo + exit 1 + ;; + esac + shift +done + +if [[ -z $update_kernel && -z $kernel ]] && [[ -n $args || -n $remove_args ]]; then + print_error "no action specified" +fi + +if [[ -z $blsdir ]]; then + blsdir="/boot/loader/entries" +fi + +if [[ -z $env ]]; then + env="/boot/grub2/grubenv" +fi + +if [[ -z $zipl_config ]]; then + zipl_config="/etc/zipl.conf" +fi + +if [[ -z $grub_config ]]; then + grub_config="/boot/grub2/grub.cfg" +fi + +if [[ -z $grub_etc_default ]]; then + grub_etc_default="/etc/default/grub" +fi + +get_bls_values + +default_index="$(get_default_index)" + +if [[ -n $display_default ]]; then + display_default_value +fi + +if [[ -n $display_info ]]; then + display_info_values "${display_info}" +fi + +remove_var_prefix "$(get_prefix)" + +if [[ -n $kernel ]]; then + if [[ $copy_default = "true" ]]; then + opts="${bls_options[$default_index]}" + if [[ -n $args ]]; then + opts="${opts} ${args}" + fi + else + opts="${opts} ${args}" + remove_args="$kernelopts" + update_args "${opts}" "${remove_args}" "" + fi + + add_bls_fragment "${kernel}" "${title}" "${opts}" "${initrd}" \ + "${extra_initrd}" +fi + +if [[ -n $remove_kernel ]]; then + remove_bls_fragment "${remove_kernel}" +fi + +if [[ -n $update_kernel ]]; then + update_bls_fragment "${update_kernel}" "${remove_args}" "${args}" "${initrd}" +fi + +if [[ -n $set_default ]]; then + set_default_bls "${set_default}" +fi + +exit 0 diff --git a/grubby.8 b/grubby.8 new file mode 100644 index 0000000..e9a8e7b --- /dev/null +++ b/grubby.8 @@ -0,0 +1,177 @@ +.TH GRUBBY 8 "Wed Apr 29 2020" +.SH NAME +grubby \- command line tool for configuring grub and zipl + +.SH SYNOPSIS +\fBgrubby\fR [--add-kernel=\fIkernel-path\fR] [--args=\fIargs\fR] + [--bad-image-okay] [--config-file=\fIpath\fR] [--copy-default] + [--default-kernel] [--default-index] [--default-title] + [--env=\fIpath\fR] [--grub2] [--info=\fIkernel-path\fR] + [--initrd=\fIinitrd-path\fR] [--extra-initrd=\fIinitrd-path\fR] + [--make-default] [--remove-args=\fIargs\fR] + [--remove-kernel=\fIkernel-path\fR] [--set-default=\fIkernel-path\fR] + [--set-default-index=\fientry-index\fR] [--title=\fentry-title\fR] + [--update-kernel=\fIkernel-path\fR] [--zipl] [--bls-directory=\fIpath\fR] + +.SH DESCRIPTION +\fBgrubby\fR is a command line tool for updating and displaying information +about the configuration files for the \fBgrub2\fR and \fBzipl\fR boot loaders. +It is primarily designed to be used from scripts which install new kernels and +need to find information about the current boot environment. + +On BIOS-based Intel x86, PowerPC and UEFI-based platforms, \fBgrub2\fR is the +default bootloader and the configuration file is in \fB/boot/grub2/grub.cfg\fR. +On s390x platforms, the \fBzipl\fR bootloader use a default configuration in +\fB/etc/zipl.conf\fR. + +All bootloaders define the boot entries as individual configuration fragments +that are stored by default in \fB/boot/loader/entries\fR. The format for the +config files is specified at \fBhttps://systemd.io/BOOT_LOADER_SPECIFICATION\fR. +The \fBgrubby\fR tool is used to update and display the configuration defined +in the BootLoaderSpec fragment files. + +There are a number of ways to specify the kernel used for \fB-\-info\fR, +\fB-\-remove-kernel\fR, and \fB-\-update-kernel\fR. Specificying \fBDEFAULT\fR +or \fBALL\fR selects the default entry and all of the entries, respectively. +Also, the title of a boot entry may be specified by using \fBTITLE=\fItitle\fR +as the argument; all entries with that title are used. + +.SH OPTIONS +.TP +\fB-\-add-kernel\fR=\fIkernel-path\fR +Add a new boot entry for the kernel located at \fIkernel-path\fR. + +.TP +\fB-\-args\fR=\fIkernel-args\fR +When a new kernel is added, this specifies the command line arguments +which should be passed to the kernel by default (note they are merged +with the arguments of the default entry if \fB-\-copy-default\fR is used). +When \fB-\-update-kernel\fR is used, this specifies new arguments to add +to the argument list. Multiple, space separated arguments may be used. If +an argument already exists the new value replaces the old values. The +\fBroot=\fR kernel argument gets special handling if the configuration +file has special handling for specifying the root filesystem. + +.TP +\fB-\-bad-image-okay\fR +When \fBgrubby\fR is looking for an entry to use for something (such +as a default boot entry) it uses sanity checks, such as ensuring that +the kernel exists in the filesystem, to make sure entries that obviously +won't work aren't selected. This option overrides that behavior, and is +designed primarily for testing. + +.TP +\fB-\-config-file\fR=\fIpath\fR +Use \fIpath\fR as the configuration file rather then the default. + +.TP +\fB-\-copy-default\fR +\fBgrubby\fR will copy as much information (such as kernel arguments and +root device) as possible from the current default kernel. The kernel path +and initrd path will never be copied. + +.TP +\fB-\-default-kernel\fR +Display the full path to the current default kernel and exit. + +.TP +\fB-\-default-index\fR +Display the numeric index of the current default boot entry and exit. + +.TP +\fB-\-default-title\fR +Display the title of the current default boot entry and exit. + +.TP +\fB-\-env\fR=\fIpath\fR +Use \fIpath\fR as the grub2 environment block file rather then the default path. + +.TP +\fB-\-grub2\fR +Configure \fBgrub2\fR bootloader. + +.TP +\fB-\-info\fR=\fIkernel-path\fR +Display information on all boot entries which match \fIkernel-path\fR. If +\fIkernel-path\fR is \fBDEFAULT\fR, then information on the default kernel +is displayed. If \fIkernel-path\fR is \fBALL\fR, then information on all boot +entries are displayed. + +.TP +\fB-\-initrd\fR=\fIinitrd-path\fR +Use \fIinitrd-path\fR as the path to an initial ram disk for a new kernel +being added. + +.TP +\fB-\-extrainitrd\fR=\fIinitrd-path\fR +Use \fIinitrd-path\fR as the path to an auxiliary init ram disk image to be +added to the boot entry. + +.TP +\fB-\-make-default\fR +Make the new kernel entry being added the default entry. + +.TP +\fB-\-remove-args\fR=\fIkernel-args\fR +The arguments specified by \fIkernel-args\fR are removed from the kernels +specified by \fB-\-update-kernel\fR. The \fBroot\fR argument gets special +handling for configuration files that support separate root filesystem +configuration. + +.TP +\fB-\-remove-kernel\fR=\fIkernel-path\fR +Removes all boot entries which match \fIkernel-path\fR. This may be used +along with -\-add-kernel, in which case the new kernel being added will +never be removed. + +.TP +\fB-\-set-default\fR=\fIkernel-path\fR +The first entry which boots the specified kernel is made the default +boot entry. + +.TP +\fB-\-set-default-index\fR=\fIentry-index\fR +Makes the given entry number the default boot entry. + +.TP +\fB-\-title\fR=\fIentry-title\fR +When a new kernel entry is added \fIentry-title\fR is used as the title +for the entry. + +.TP +\fB-\-update-kernel\fR=\fIkernel-path\fR +The entries for kernels matching \fRkernel-path\fR are updated. Currently +the only items that can be updated is the kernel argument list, which is +modified via the \fB-\-args\fR and \fB-\-remove-args\fR options. If the +\fBALL\fR argument is used the variable \fB GRUB_CMDLINE_LINUX\fR in +\fB/etc/default/grub\fR is updated with the latest kernel argument list, +unless the \fB-\-no-etc-grub-update\fR option is used or the file does not +exist (e.g., on s390x). + +.TP +\fB-\-zipl\fR +Configure \fBzipl\fR bootloader. + +.TP +\fB-\-bls-directory\fR=\fIpath\fR +Use \fIpath\fR as the directory for the BootLoaderSpec config files rather +than the default \fB/boot/loader/entries\fR. + +.TP +\fB-\-no-etc-grub-update\fR +Makes grubby to not update the \fBGRUB_CMDLINE_LINUX\fR variable in +\fB/etc/default/grub\fR when the \fB-\-update-kernel\fR option is +used with the \fBALL\fR argument. + +.SH "SEE ALSO" +.BR zipl (8), +.BR mkinitrd (8), +.BR kernel-install (8) + +.SH AUTHORS +.nf +Erik Troan +Jeremy Katz +Peter Jones +Javier Martinez +.fi diff --git a/grubby.spec b/grubby.spec index f6bc91e..87b8787 100644 --- a/grubby.spec +++ b/grubby.spec @@ -1,84 +1,419 @@ +# What? No. +%define __brp_mangle_shebangs %{nil} + Name: grubby Version: 8.40 -Release: 4%{?dist} +Release: 86%{?dist} Summary: Command line tool for updating bootloader configs -Group: System Environment/Base -License: GPLv2+ -URL: https://github.com/rhinstaller/grubby -# we only pull git snaps at the moment -# git clone git@github.com:rhinstaller/grubby.git -# git archive --format=tar --prefix=grubby-%{version}/ HEAD |bzip2 > grubby-%{version}.tar.bz2 -Source0: %{name}-%{version}.tar.bz2 +License: GPL-2.0-or-later +Source1: grubby-bls +# Source2: rpm-sort.c +Source3: COPYING +Source5: 95-kernel-hooks.install +Source6: 10-devicetree.install +Source7: grubby.8 +Source8: kernel.sysconfig -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: pkgconfig glib2-devel popt-devel -BuildRequires: libblkid-devel git -# for make test / getopt: -BuildRequires: util-linux-ng -%ifarch aarch64 i686 x86_64 ppc ppc64 -BuildRequires: /usr/bin/grub2-editenv +BuildRequires: gcc +BuildRequires: glib2-devel +BuildRequires: libblkid-devel +BuildRequires: make +BuildRequires: pkgconfig +BuildRequires: popt-devel +BuildRequires: rpm-devel +BuildRequires: sed +%ifarch aarch64 x86_64 %{power64} riscv64 +BuildRequires: grub2-tools-minimal +Requires: grub2-tools-minimal +Requires: grub2-tools %endif %ifarch s390 s390x -Requires: s390utils-base -%endif -%ifarch %{arm} -Requires: uboot-tools +Requires: s390utils-core %endif +Requires: findutils +Requires: util-linux + +ExcludeArch: %{ix86} +Conflicts: uboot-tools < 2021.01-0.1.rc2 +Obsoletes: %{name}-bls < %{version}-%{release} +Obsoletes: %{name}-deprecated < %{version}-%{release} %description -grubby is a command line tool for updating and displaying information about -the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc) -and zipl (s390) boot loaders. It is primarily designed to be used from scripts -which install new kernels and need to find information about the current boot -environment. +This package provides a grubby compatibility script that manages +BootLoaderSpec files and is meant to be backward compatible with +the previous grubby tool. %prep -%setup -q - -git init -git config user.email "noone@example.com" -git config user.name "no one" -git add . -git commit -a -q -m "%{version} baseline" -git am %{patches} > $RPM_BUILD_ROOT/boot/boot.scr -%endif +mkdir -p %{buildroot}%{_sbindir}/ +install -T -m 0755 %{SOURCE1} %{buildroot}%{_sbindir}/grubby -%clean -rm -rf $RPM_BUILD_ROOT +install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE5} +install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE6} + +mkdir -p %{buildroot}%{_mandir}/man8 +install -m 0644 %{SOURCE7} %{buildroot}%{_mandir}/man8/ + +mkdir -p %{buildroot}%{_sysconfdir}/sysconfig +install -m 0644 %{SOURCE8} %{buildroot}%{_sysconfdir}/sysconfig/kernel + +%post +if [ "$1" = 2 ]; then + arch=$(uname -m) + [[ $arch == "s390x" ]] && \ + zipl-switch-to-blscfg --backup-suffix=.rpmsave &>/dev/null || : +fi %files -%defattr(-,root,root,-) -%{!?_licensedir:%global license %%doc} %license COPYING -/sbin/installkernel -/sbin/new-kernel-pkg -/sbin/grubby -%{_mandir}/man8/*.8* -%ifarch %{arm} -%config(noreplace) %{_sysconfdir}/sysconfig/uboot -%config(noreplace) /boot/boot.scr -%endif +%attr(0755,root,root) %{_sbindir}/grubby +%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/10-devicetree.install +%attr(0755,root,root) %{_prefix}/lib/kernel/install.d/95-kernel-hooks.install +%{_mandir}/man8/grubby.8* +%config(noreplace) %{_sysconfdir}/sysconfig/kernel %changelog +* Wed Dec 10 2025 Simon de Vlieger - 8.40-86 +- Own `/etc/sysconfig/kernel` which is used for `grubby` configuration + +* Wed Jul 30 2025 Leo Sandoval - 8.40-85 +- Update cfg when setting a default kernel + +* Thu Jul 24 2025 Fedora Release Engineering - 8.40-84 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Thu Mar 20 2025 Leo Sandoval - 8.40-83 +- grubby-bls: in s390* systems, run zipl on grub cfg update event + Fixes previous commit and formats better the conditions that trigger grub cfg updates + +* Fri Jan 17 2025 Fedora Release Engineering - 8.40-82 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Mon Jan 06 2025 Nicolas Frayer - 8.40-81 +- Fixups to custom kernel targets + +* Fri Dec 06 2024 Leo Sandoval - 8.40-80 +- grubby-bls: on PPC systems, remove petiboot's version checks + +* Fri Dec 06 2024 Leo Sandoval - 8.40-79 +- grubby-bls: in s390* systems, run zipl on grub cfg update event + +* Mon Dec 02 2024 David Abdurachmanov - 8.40-78 +- Add riscv64 support + +* Mon Nov 25 2024 Leo Sandoval - 8.40-77 +- On grub cfg updates, run grub2-mkconfig for Xen systems + +* Thu Jul 18 2024 Fedora Release Engineering - 8.40-76 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Wed Jan 24 2024 Fedora Release Engineering - 8.40-75 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 20 2024 Fedora Release Engineering - 8.40-74 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Wed Jan 10 2024 Marta Lewandowska - 8.40-73 +- Do not overwrite all vars that start with GRUB_CMDLINE_LINUX + +* Mon Sep 11 2023 Zbigniew Jedrzejewski-Szmek - 8.40-72 +- Drop installkernel so that it can be provided by systemd + +* Thu Jul 20 2023 Fedora Release Engineering - 8.40-71 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Feb 21 2023 Marta Lewandowska - 8.40-70 +- remove root= when not copying default + +* Thu Jan 19 2023 Fedora Release Engineering - 8.40-69 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Tue Nov 01 2022 Robbie Harwood - 8.40-68 +- Drop custom rpm-sort +- See-also: https://github.com/rpm-software-management/rpm/pull/2249 + +* Tue Oct 04 2022 Robbie Harwood - 8.40-67 +- Apply Marta's copy-default args fix + +* Mon Aug 22 2022 Robbie Harwood - 8.40-66 +- Give up and just pull the config from BLS +- Suggested-by: Bojan Smojver + +* Wed Aug 17 2022 Robbie Harwood - 8.40-65 +- Mark package as obsoleting -deprecated +- Resolves: #2117817 + +* Tue Aug 02 2022 Robbie Harwood - 8.40-64 +- Handle updating /etc/kernel/cmdline + +* Thu Jul 21 2022 Fedora Release Engineering - 8.40-63 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Tue Jul 19 2022 Robbie Harwood - 8.40-62 +- Clarify that grub files aren't used on s390x in man page + +* Wed Jun 22 2022 Robbie Harwood - 8.40-61 +- Revert previous change + +* Tue May 31 2022 Robbie Harwood - 8.40-60 +- Additionally write to /etc/kernel/cmdline + +* Wed Apr 27 2022 Robbie Harwood - 8.40-59 +- Remove upstream and layers of indirection around -bls + +* Thu Mar 10 2022 Robbie Harwood - 8.40-58 +- Remove grubby-deprecated + +* Mon Feb 07 2022 Robbie Harwood - 8.40-57 +- grubby-bls: wire up -h (help) + +* Thu Jan 20 2022 Fedora Release Engineering - 8.40-56 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Jul 22 2021 Fedora Release Engineering - 8.40-55 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Wed Jun 23 2021 Javier Martinez Canillas - 8.40-54 +- Clarify package description + Resolves: rhbz#1913299 +- Update man page to not mention the GRUB config in the ESP anymore + Resolves: rhbz#1958458 + +* Wed Jun 09 2021 Javier Martinez Canillas - 8.40-53 +- grubby-bls: expand only the kernelopts variable + +* Mon Apr 26 2021 Javier Martinez Canillas - 8.40-52 +- grubby-bs: Fix changing kernel cmdline params not working on ppc64le + +* Tue Jan 26 2021 Fedora Release Engineering - 8.40-51 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Dec 30 2020 Tom Stellard - 8.40-50 +- Use make_build macro instead of plain make +- https://docs.fedoraproject.org/en-US/packaging-guidelines/#_parallel_make + +* Fri Nov 20 2020 Peter Robinson - 8.40-49 +- Add device tree kernel install option + +* Mon Oct 26 2020 Josh Boyer - 8.40-48 +- Only require s390utils-core, not s390utils-base + +* Tue Jul 28 2020 Fedora Release Engineering - 8.40-47 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Fri Jun 26 2020 Javier Martinez Canillas - 8.40-46 +- fix build with rpm-4.16 +- grubby-bls: fix --extra-initrd option not adding the correct path + +* Wed May 13 2020 Javier Martinez Canillas - 8.40-45 +- grubby-bls: don't replace options with kernelopts if values are the same + +* Wed May 06 2020 Javier Martinez Canillas - 8.40-44 +- Fix installed man page file mode bits + +* Tue May 05 2020 Javier Martinez Canillas - 8.40-43 +- grubby-bls: always escape the delimiter character used in sed commands +- grubby-bls: add a --no-etc-grub-update option + +* Wed Apr 29 2020 Javier Martinez Canillas - 8.40-42 +- grubby-bls: fix corner case when a kernel param value contains a '=' +- grubby-bls: update man page to match options in current wrapper script + +* Mon Mar 30 2020 Javier Martinez Canillas - 8.40-41 +- Make grubby to also update GRUB_CMDLINE_LINUX in /etc/default/grub + Related: rhbz#1287854 + +* Mon Feb 10 2020 Javier Martinez Canillas - 8.40-40 +- Fix FTBFS + Resolves: rhbz#1799496 +- Fix wrong S-o-B tag in patch +- Fix warning about using unversioned Obsoletes + +* Wed Jan 29 2020 Fedora Release Engineering - 8.40-39 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Nov 29 2019 Javier Martinez Canillas - 8.40-38 +- grubby-bls: don't update grubenv when generating grub.cfg for ppc64le + Related: rhbz#1726514 + +* Thu Nov 28 2019 Javier Martinez Canillas - 8.40-37 +- grubby-bls: don't print rpm-sort error messages + Resolves: rhbz#1731924 +- grubby-bls: remove -o option and support -c for ppc64le grub config + Resolves: rhbz#1758598 +- grubby-bls: fix logic to check if the kernelopts var is defined in a BLS + Resolves: rhbz#1726514 + +* Tue Aug 06 2019 Yuval Turgeman - 8.40-36 +- grubby-bls: strip only /boot from paths + +* Thu Jul 25 2019 Fedora Release Engineering - 8.40-35 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Jun 17 2019 Javier Martinez Canillas - 8.40-34 +- Add a kernel-install plugin to execute hook scripts in /etc/kernel/ + Resolves: rhbz#1696202 + +* Mon Jun 10 22:13:19 CET 2019 Igor Gnatenko - 8.40-33 +- Rebuild for RPM 4.15 + +* Mon Jun 10 15:42:02 CET 2019 Igor Gnatenko - 8.40-32 +- Rebuild for RPM 4.15 + +* Fri May 03 2019 Javier Martinez Canillas - 8.40-31 +- Use mountpoint command to check whether /boot is a mount point + Resolves: rhbz#1706091 + +* Thu Mar 21 2019 Javier Martinez Canillas - 8.40-30 +- grubby-bls: fix --add-kernel not working when using the --args option + Resolves: rhbz#1691004 + +* Mon Mar 11 2019 Javier Martinez Canillas - 8.40-29 +- Only switch to BLS config for s390x / zipl + Related: rhbz#1652806 + +* Fri Mar 01 2019 Javier Martinez Canillas - 8.40-28 +- grubby-bls: make --update-kernel ALL to update kernelopts var in grubenv + +* Thu Feb 14 2019 Javier Martinez Canillas - 8.40-27 +- grubby-bls: error if args or remove-args is used without update-kernel + +* Tue Feb 05 2019 Javier Martinez Canillas - 8.40-26 +- Fix GCC warnings about possible string truncations and buffer overflows +- grubby-bls: unset default entry if is the one being removed +- grubby-bls: show absolute path when printing error about incorrect param + +* Fri Feb 01 2019 Fedora Release Engineering - 8.40-25 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Jan 14 2019 Javier Martinez Canillas - 8.40-24 +- Correctly set LDFLAGS to include hardened flags (pjones) + Related: rhbz#1654936 +- grubby-bls: expand all variables in options field when updating it + Resolves: rhbz#1660700 + +* Tue Dec 11 2018 Javier Martinez Canillas - 8.40-23 +- grubby-bls: lookup default entry by either id or title on grub2 + Related: rhbz#1654936 + +* Fri Nov 30 2018 Javier Martinez Canillas - 8.40-22 +- grubby-bls: also print the absolute path in the --default-kernel option + Resolves: rhbz#1649778 +- grubby-bls: allow to specify the same kernel param multiple times + Resolves: rhbz#1652486 +- grubby-bls: expand kernel options if these are environment variables + Resolves: rhbz#1649785 +- grubby-bls: always generate the BLS snippets when adding new entries + Resolves: rhbz#1653365 +- Improve man page for --info option (jstodola) + Resolves: rhbz#1651672 +- Make the old grubby take precedence over grubby-bls if is installed + Related: rhbz#165484 + +* Wed Nov 21 2018 Javier Martinez Canillas - 8.40-21 +- installkernel-bls: remove unnecessary check for GRUB_ENABLE_BLSCFG=true + Resolves: rhbz#1647721 +- grubby-bls: use title field instead of version for zipl default entry + Related: rhbz#1645200 +- grubby-bls: print the absolute kernel and initramfs images paths + Resolves: rhbz#1649778 +- grubby-bls: make info print the root parameter if is present in cmdline + Resolves: rhbz#1649791 + +* Tue Nov 13 2018 Javier Martinez Canillas - 8.40-20 +- Switch to a BLS configuration on %%post + +* Tue Nov 06 2018 Javier Martinez Canillas - 8.40-19 +- Make the temporary config wrapper be what "grubby" contains, and put + traditional grubby in grubby-deprecated (pjones) +- Re-enable debuginfo generation (pjones) + Related: rhbz#1619344 +- Install installkernel-bls here as well, not just in the grub2 package, + since s390x doesn't have grubby packages (pjones) + Related: rhbz#1619344 +- Make grubby-bls execute grub2-mkconfig on ppc64 + Resolves: rhbz#1636039 +- grubby-bls should only check if kernel exists and not if was installed + Resolves: rhbz#1634740 +- Use ! instead of , as sed delimiter in grubby-bls script + Resolves: rhbz#1634744 +- Print information about the entry set as default + Resolves: rhbz#1636180 +- grubby-bls: make "id" be the filename, and include it in --info=ALL (pjones) + Related: rhbz#1638103 +- grubby-bls: Make grubby-bls sort everything the same way grub2 does (pjones) + Resolves: rhbz#1638103 +- grubby-bls: Consistently use the filename as the bls id + Related: rhbz#1638103 +- grubby-bls: check if entry exists before attempting to print its info + Resolves: rhbz#1634712 +- grubby-bls: make a copy of the cmdline if is modified for an entry + Resolves: rhbz#1629054 +- grubby-bls: escape delimiter character before replacing the options field + Resolves: rhbz#1640017 +- grubby-bls: grubby-bls: use id instead of title to get the default entry + Resolves: rhbz#1638103 +- grubby-bls: use ~debug instead of -debug as suffix to sort correctly + Related: rhbz#1638103 +- grubby-bls: allow to add many BLS entries for the same kernel image + Resolves: rhbz#1634752 +- grubby-bls: fix --default-* options for s390x + Resolves: rhbz#1644608 +- grubby-bls: only compare using relative paths if /boot is a mount point + Resolves: rhbz#1642078 + +* Fri Aug 10 2018 Javier Martinez Canillas - 8.40-18 +- Make installkernel to use kernel-install scripts on BLS configuration + +* Tue Jul 24 2018 Javier Martinez Canillas - 8.40-17 +- Fix grubby wrapper paths + Resolves: rhbz#1607981 + +* Tue Jul 24 2018 Peter Jones - 8.40-16 +- Fix permissions on /usr/sbin/grubby + +* Fri Jul 13 2018 Javier Martinez Canillas - 8.40-15 +- Add a grubby-bls package that conflicts with grubby + +* Fri Jul 13 2018 Fedora Release Engineering - 8.40-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Thu Jun 14 2018 Peter Jones - 8.40-13 +- Use standard Fedora linker flags (rhbz#1543502) (rdossant) +- Switch zipl config to BLS configuration on %%postun for s390x (javierm) + +* Tue Apr 10 2018 Javier Martinez Canillas - 8.40-12 +- Use .rpmsave as backup suffix when switching to BLS configuration + +* Fri Apr 06 2018 Javier Martinez Canillas - 8.40-11 +- Switch grub2 config to BLS configuration on %%postun + +* Sat Mar 03 2018 Nathaniel McCallum - 8.40-10 +- Add support for /boot on btrfs subvolumes + +* Wed Feb 07 2018 Fedora Release Engineering - 8.40-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jan 24 2018 Peter Robinson 8.40-8 +- Drop u-boot uImage generation on ARMv7 +- Minor cleanups + +* Tue Sep 12 2017 Peter Jones - 8.40-7 +- Explicitly require grub2-tools on platforms that need grub2-editenv +- Minor packaging cleanups + +* Wed Aug 02 2017 Fedora Release Engineering - 8.40-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 8.40-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + * Fri Feb 10 2017 Fedora Release Engineering - 8.40-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild @@ -308,16 +643,16 @@ rm -rf $RPM_BUILD_ROOT * Thu Dec 08 2011 Adam Williamson - 8.4-1 - Update to 8.4: - + fix Loading... line for updated kernels - + Add new '--default-title' feature - + Add new '--default-index' feature - + add feature for testing the output of a grubby command - + Fix detection when comparing stage1 to MBR - + do not link against glib-2.0 - + Don't crash if grubConfig not found - + Adding extlinux support for new-kernel-pkg - + Look for Debian / Ubuntu grub config files (#703260) - + Make grubby recognize Ubuntu's spin of Grub2 (#703260) + + fix Loading... line for updated kernels + + Add new '--default-title' feature + + Add new '--default-index' feature + + add feature for testing the output of a grubby command + + Fix detection when comparing stage1 to MBR + + do not link against glib-2.0 + + Don't crash if grubConfig not found + + Adding extlinux support for new-kernel-pkg + + Look for Debian / Ubuntu grub config files (#703260) + + Make grubby recognize Ubuntu's spin of Grub2 (#703260) * Thu Sep 29 2011 Peter Jones - 8.3-1 - Fix new-kernel-pkg invocation of grubby for grub (patch from Mads Kiilerich) @@ -405,7 +740,7 @@ rm -rf $RPM_BUILD_ROOT Resolves: rhbz#520515 * Wed Sep 09 2009 Hans de Goede - 7.0.4-1 -- Add --dracut cmdline argument for %post generation of dracut initrd +- Add --dracut cmdline argument for %%post generation of dracut initrd * Wed Aug 26 2009 Hans de Goede - 7.0.3-1 - Silence error when no /etc/sysconfig/keyboard (#517187) diff --git a/kernel.sysconfig b/kernel.sysconfig new file mode 100644 index 0000000..8da1970 --- /dev/null +++ b/kernel.sysconfig @@ -0,0 +1,6 @@ +# UPDATEDEFAULT specifies if kernel-install should make +# new kernels the default +UPDATEDEFAULT=yes + +# DEFAULTKERNEL specifies the default kernel package type +DEFAULTKERNEL=kernel-core diff --git a/sources b/sources deleted file mode 100644 index e3b9613..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -bcad3c0dc804c4f526374616c1154469 grubby-8.40.tar.bz2