Update to 8.40-1

Resolves: rhbz#1214950

Signed-off-by: Peter Jones <pjones@redhat.com>
This commit is contained in:
Peter Jones 2015-06-10 11:25:55 -04:00
parent 16069362e2
commit 529e352161
13 changed files with 7 additions and 1547 deletions

View File

@ -1,41 +0,0 @@
From 639b9ab2462d4dddd8b8cff04e8db352cb6dc5d5 Mon Sep 17 00:00:00 2001
From: Yannick Brosseau <scientist@fb.com>
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 <scientist@fb.com>
---
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

View File

@ -1,39 +0,0 @@
From 15d36a8f27c5b14b290da99c4be8880bc35dc41b Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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 <pjones@redhat.com>
---
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

View File

@ -1,452 +0,0 @@
From 0e5c50b8dff5208b915391e3b592790bdf174cf4 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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 <pjones@redhat.com>
---
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

View File

@ -1,37 +0,0 @@
From e91855ce14df65d12f681c15dfba5b22a2b4a061 Mon Sep 17 00:00:00 2001
From: Junxiao Bi <junxiao.bi@oracle.com>
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 <junxiao.bi@oracle.com>
Reviewed-by: John Haxby <john.haxby@oracle.com>
---
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

View File

@ -1,46 +0,0 @@
From dbd5b06ce590ca638e3c44746183f6f2379e820f Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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 <pjones@redhat.com>
---
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

View File

@ -1,35 +0,0 @@
From 629922b6dc32e4209980d7198b7d2aabb722033a Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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 <pjones@redhat.com>
---
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

View File

@ -1,446 +0,0 @@
From 0950d2e8693339a36f59c966dc8558263331665c Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
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

View File

@ -1,32 +0,0 @@
From e3a293332591f44a190775a3b4dceefe2e5118a1 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Thu, 25 Sep 2014 13:24:15 -0400
Subject: [PATCH 07/10] Always error check getLineByType()
Signed-off-by: Peter Jones <pjones@redhat.com>
---
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

View File

@ -1,155 +0,0 @@
From eb141563832f803abdfc1fde83fbfcc9031794b3 Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
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

View File

@ -1,194 +0,0 @@
From 69dbfdc99ce993d541984f7305bb1206858f4bcf Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
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=<banner>] [--multiboot=multiboot]" >&2
echo " [--mbargs=mbargs] [--make-default] [--add-dracut-args]" >&2
echo " [--add-plymouth-initrd]" >&2
- echo " [--host-only] [--devtree=<devicetree.dtb>]" >&2
+ echo " [--host-only] [--devtree=<devicetree.dtb>] [--devtreedir=</devicetree/path/>]" >&2
echo " <--install | --remove | --update | --rpmposttrans> <kernel-version>" >&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

View File

@ -1,56 +0,0 @@
From 354c873f633db124d214da8a1258e32fe210c7cb Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
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

View File

@ -1,6 +1,6 @@
Name: grubby
Version: 8.35
Release: 9%{?dist}
Version: 8.40
Release: 1%{?dist}
Summary: Command line tool for updating bootloader configs
Group: System Environment/Base
License: GPLv2+
@ -9,17 +9,6 @@ URL: http://git.fedorahosted.org/git/grubby.git
# git clone git://git.fedorahosted.org/git/grubby.git
# git archive --format=tar --prefix=grubby-%{version}/ HEAD |bzip2 > grubby-%{version}.tar.bz2
Source0: %{name}-%{version}.tar.bz2
Patch0001: 0001-Don-t-go-past-the-last-element-of-indexVars-in-findE.patch
Patch0002: 0002-Add-bls-test-harness-bits.patch
Patch0003: 0003-grubby-fix-initrd-updating-when-multiboot-exist.patch
Patch0004: 0004-Tell-a-slightly-better-fib-about-default-bootloader-.patch
Patch0005: 0005-Make-findTemplate-actually-return-the-saved-default.patch
Patch0006: 0006-Revert-Add-bls-test-harness-bits.patch
Patch0007: 0007-Always-error-check-getLineByType.patch
Patch0008: 0008-Add-devtree-support-to-extlinux-1088933.patch
Patch0009: 0009-add-support-for-devicetree-directories-for-use-on-ar.patch
Patch0010: 0010-cleanup-dtb-handling-to-work-in-the-supported-usecas.patch
Patch0011: 0001-Treat-kernel-and-kernel-core-as-identical-in-terms-o.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: pkgconfig glib2-devel popt-devel
@ -90,6 +79,10 @@ rm -rf $RPM_BUILD_ROOT
%endif
%changelog
* Wed Jun 10 2015 Peter Jones <pjones@redhat.com> - 8.40-1
- Update to 8.40-1
Resolves: rhbz#1214950
* Thu Nov 13 2014 Peter Jones <pjones@redhat.com> - 8.35-9
- Disable "make check" on arm builds; right now the test suite is broken
there and raises false positives constantly.

View File

@ -1 +1 @@
daf05585c3e1f3da2601cd1b0242fc60 grubby-8.35.tar.bz2
bcad3c0dc804c4f526374616c1154469 grubby-8.40.tar.bz2