From 775cb063bcf69131ef3a40253c86e235f94a3b5c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 05 2015 13:25:57 +0000 Subject: import grubby-8.28-11.el7 --- diff --git a/SOURCES/0001-Don-t-put-spaces-in-debug-entries-on-zipl-platforms.patch b/SOURCES/0001-Don-t-put-spaces-in-debug-entries-on-zipl-platforms.patch new file mode 100644 index 0000000..e6a53f7 --- /dev/null +++ b/SOURCES/0001-Don-t-put-spaces-in-debug-entries-on-zipl-platforms.patch @@ -0,0 +1,34 @@ +From d02b178988837a37f8a9e88bcdc54f4c169ab5d7 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 11 Nov 2014 10:46:08 -0500 +Subject: [PATCH 1/2] Don't put spaces in debug entries on zipl platforms. + +Because of course zipl can't handle spaces. + +Related: rhbz#1152152 + +Signed-off-by: Peter Jones +--- + new-kernel-pkg | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index 9f3b192..811b989 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -140,7 +140,11 @@ rungrubby() { + if [ "$1" == "--debug" ]; then + [ "$MAKEDEBUG" != "yes" ] && return 0 + [ -n "$verbose" ] && echo "- First, making a debug entry." +- declare -x debugtitle=" with debugging" ++ if [ $ARCH = 's390' -o $ARCH = 's390x' ]; then ++ declare -x debugtitle="_with_debugging" ++ else ++ declare -x debugtitle=" with debugging" ++ fi + declare -x debugargs="$DEBUGARG" + shift + else +-- +1.9.3 + diff --git a/SOURCES/0001-Drop-SEGV-handler.patch b/SOURCES/0001-Drop-SEGV-handler.patch deleted file mode 100644 index 3e9a99c..0000000 --- a/SOURCES/0001-Drop-SEGV-handler.patch +++ /dev/null @@ -1,52 +0,0 @@ -From ec1c7aeb9c4d46f3e0a1362137c5eeb0902f13cd Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Thu, 27 Feb 2014 10:35:59 +0100 -Subject: [PATCH] Drop SEGV handler - -The generated tracebacks are mostly useless without debuginfo (which is likely -not present if the crash is not anticipated) and prevent ABRT from doing a -better job. - -Signed-off-by: Lubomir Rintel ---- - grubby.c | 17 ----------------- - 1 file changed, 17 deletions(-) - -diff --git a/grubby.c b/grubby.c -index b90fb4b..8d14a35 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -4100,21 +4100,6 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, - return 0; - } - --static void traceback(int signum) --{ -- void *array[40]; -- size_t size; -- -- signal(SIGSEGV, SIG_DFL); -- memset(array, '\0', sizeof (array)); -- size = backtrace(array, 40); -- -- fprintf(stderr, "grubby received SIGSEGV! Backtrace (%ld):\n", -- (unsigned long)size); -- backtrace_symbols_fd(array, size, STDERR_FILENO); -- exit(1); --} -- - int main(int argc, const char ** argv) { - poptContext optCon; - const char * grubConfig = NULL; -@@ -4255,8 +4240,6 @@ int main(int argc, const char ** argv) { - - useextlinuxmenu=0; - -- signal(SIGSEGV, traceback); -- - int i = 0; - for (int j = 1; j < argc; j++) - i += strlen(argv[j]) + 1; --- -1.8.3.1 - diff --git a/SOURCES/0001-Fix-a-crash-with-kernel.patch b/SOURCES/0001-Fix-a-crash-with-kernel.patch deleted file mode 100644 index e8fc696..0000000 --- a/SOURCES/0001-Fix-a-crash-with-kernel.patch +++ /dev/null @@ -1,39 +0,0 @@ -From: Lubomir Rintel -Date: Wed, 27 Nov 2013 16:59:48 +0100 -Subject: [PATCH grubby 2/4] grub: Fix a crash with kernel line without being - preceded by title - -Quite obviously this implies a broken configuration file where a lone kernel -line is found without ever seeing an entry start, resulting in a NULL -dereference attempt. Reproducible by running GRUB code against extlinux -configuration: - -./grubby --grub -c test/extlinux.1 --default-kernel -grubby received SIGSEGV! Backtrace (6): -... - -Signed-off-by: Lubomir Rintel ---- - grubby.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/grubby.c b/grubby.c -index 3de53b3..935edf1 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -1175,7 +1175,7 @@ static struct grubConfig * readConfig(const char * inName, - * lines came earlier in the template, make sure to use LT_HYPER - * instead of LT_KERNEL now - */ -- if (entry->multiboot) -+ if (entry && entry->multiboot) - line->type = LT_HYPER; - - } else if (line->type == LT_MBMODULE) { --- -1.8.4.2 - -_______________________________________________ -anaconda-patches mailing list -anaconda-patches@lists.fedorahosted.org -https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches diff --git a/SOURCES/0001-Honor-linux16-and-initrd16.patch b/SOURCES/0001-Honor-linux16-and-initrd16.patch deleted file mode 100644 index dbe3f14..0000000 --- a/SOURCES/0001-Honor-linux16-and-initrd16.patch +++ /dev/null @@ -1,638 +0,0 @@ -From 92c61a05e30bd5e68efac2f92ea520f47ce5416b Mon Sep 17 00:00:00 2001 -From: Peter Jones -Date: Mon, 18 Nov 2013 14:44:13 -0500 -Subject: [PATCH] Honor "linux16" and "initrd16" - -Resolves: rhbz#1031192 -Resolves: rhbz#1034743 - -Signed-off-by: Peter Jones ---- - grubby.c | 63 ++++++++++++++++++++++--------- - test.sh | 16 ++++++++ - test/grub2.10 | 84 +++++++++++++++++++++++++++++++++++++++++ - test/grub2.11 | 97 +++++++++++++++++++++++++++++++++++++++++++++++ - test/results/add/g2-1.10 | 96 +++++++++++++++++++++++++++++++++++++++++++++++ - test/results/add/g2-1.11 | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ - 6 files changed, 437 insertions(+), 17 deletions(-) - create mode 100644 test/grub2.10 - create mode 100644 test/grub2.11 - create mode 100644 test/results/add/g2-1.10 - create mode 100644 test/results/add/g2-1.11 - -diff --git a/grubby.c b/grubby.c -index 3de53b3..5dc5487 100644 ---- a/grubby.c -+++ b/grubby.c -@@ -90,7 +90,9 @@ enum lineType_e { - LT_SET_VARIABLE = 1 << 19, - LT_KERNEL_EFI = 1 << 20, - LT_INITRD_EFI = 1 << 21, -- LT_UNKNOWN = 1 << 22, -+ LT_KERNEL_16 = 1 << 22, -+ LT_INITRD_16 = 1 << 23, -+ LT_UNKNOWN = 1 << 24, - }; - - struct singleLine { -@@ -220,8 +222,10 @@ struct keywordTypes grub2Keywords[] = { - { "fallback", LT_FALLBACK, ' ' }, - { "linux", LT_KERNEL, ' ' }, - { "linuxefi", LT_KERNEL_EFI, ' ' }, -+ { "linux16", LT_KERNEL_16, ' ' }, - { "initrd", LT_INITRD, ' ', ' ' }, - { "initrdefi", LT_INITRD_EFI, ' ', ' ' }, -+ { "initrd16", LT_INITRD_16, ' ', ' ' }, - { "module", LT_MBMODULE, ' ' }, - { "kernel", LT_HYPER, ' ' }, - { NULL, 0, 0 }, -@@ -397,11 +401,11 @@ static int isquote(char q) - } - - static int iskernel(enum lineType_e type) { -- return (type == LT_KERNEL || type == LT_KERNEL_EFI); -+ return (type == LT_KERNEL || type == LT_KERNEL_EFI || type == LT_KERNEL_16); - } - - static int isinitrd(enum lineType_e type) { -- return (type == LT_INITRD || type == LT_INITRD_EFI); -+ return (type == LT_INITRD || type == LT_INITRD_EFI || type == LT_INITRD_16); - } - - char *grub2ExtractTitle(struct singleLine * line) { -@@ -719,6 +723,17 @@ static enum lineType_e preferredLineType(enum lineType_e type, - default: - return type; - } -+#if defined(__i386__) || defined(__x86_64__) -+ } else if (cfi == &grub2ConfigType) { -+ switch (type) { -+ case LT_KERNEL: -+ return LT_KERNEL_16; -+ case LT_INITRD: -+ return LT_INITRD_16; -+ default: -+ return type; -+ } -+#endif - } - return type; - } -@@ -1806,7 +1821,7 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix, - return 0; - } - -- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); -+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); - if (!line) { - notSuitablePrintf(entry, 0, "no line found\n"); - return 0; -@@ -1940,7 +1955,7 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, - entry = findEntryByIndex(config, indexVars[i]); - if (!entry) return NULL; - -- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); -+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); - if (!line) return NULL; - - if (index) *index = indexVars[i]; -@@ -1991,9 +2006,9 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, - for (line = entry->lines; line; line = line->next) { - enum lineType_e ct = checkType; - if (entry->multiboot && checkType == LT_KERNEL) -- ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER; -+ ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER|LT_KERNEL_16; - else if (checkType & LT_KERNEL) -- ct = checkType | LT_KERNEL_EFI; -+ ct = checkType | LT_KERNEL_EFI | LT_KERNEL_16; - line = getLineByType(ct, line); - if (!line) - break; /* not found in this entry */ -@@ -2015,7 +2030,7 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, - * non-Linux boot entries (could find netbsd etc, though, which is - * unfortunate) - */ -- if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines)) -+ if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines)) - break; /* found 'im! */ - } - -@@ -2249,7 +2264,7 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) { - - printf("index=%d\n", index); - -- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); -+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); - if (!line) { - printf("non linux entry\n"); - return; -@@ -2314,7 +2329,7 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) { - printf("root=%s\n", s); - } - -- line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines); -+ line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines); - - if (line && line->numElements >= 2) { - if (!strncmp(prefix, line->elements[1].item, strlen(prefix))) -@@ -2731,7 +2746,7 @@ struct singleLine * addLineTmpl(struct singleEntry * entry, - insertElement(newLine, val, 1, cfi); - - /* but try to keep the rootspec from the template... sigh */ -- if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI)) { -+ if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI|LT_KERNEL_16|LT_INITRD_16)) { - char * rootspec = getRootSpecifier(tmplLine->elements[1].item); - if (rootspec != NULL) { - free(newLine->elements[1].item); -@@ -3101,7 +3116,7 @@ int updateActualImage(struct grubConfig * cfg, const char * image, - firstElement = 2; - - } else { -- line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI, entry->lines); -+ line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); - if (!line) { - /* no LT_KERNEL or LT_MBMODULE in this entry? */ - continue; -@@ -3302,10 +3317,10 @@ int updateInitrd(struct grubConfig * cfg, const char * image, - if (!image) return 0; - - for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) { -- kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI, entry->lines); -+ kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); - if (!kernelLine) continue; - -- line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines); -+ line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines); - if (line) - removeLine(entry, line); - if (prefix) { -@@ -3316,8 +3331,21 @@ int updateInitrd(struct grubConfig * cfg, const char * image, - endLine = getLineByType(LT_ENTRY_END, entry->lines); - if (endLine) - removeLine(entry, endLine); -- line = addLine(entry, cfg->cfi, preferredLineType(LT_INITRD, cfg->cfi), -- kernelLine->indent, initrd); -+ enum lineType_e lt; -+ switch(kernelLine->type) { -+ case LT_KERNEL: -+ lt = LT_INITRD; -+ break; -+ case LT_KERNEL_EFI: -+ lt = LT_INITRD_EFI; -+ break; -+ case LT_KERNEL_16: -+ lt = LT_INITRD_16; -+ break; -+ default: -+ lt = preferredLineType(LT_INITRD, cfg->cfi); -+ } -+ line = addLine(entry, cfg->cfi, lt, kernelLine->indent, initrd); - if (!line) - return 1; - if (endLine) { -@@ -3915,6 +3943,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, - switch (config->cfi->entryStart) { - case LT_KERNEL: - case LT_KERNEL_EFI: -+ case LT_KERNEL_16: - if (new->multiboot && config->cfi->mbHyperFirst) { - /* fall through to LT_HYPER */ - } else { -@@ -4473,7 +4502,7 @@ int main(int argc, const char ** argv) { - if (!entry) return 0; - if (!suitableImage(entry, bootPrefix, 0, flags)) return 0; - -- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); -+ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); - if (!line) return 0; - - rootspec = getRootSpecifier(line->elements[1].item); -diff --git a/test.sh b/test.sh -index 17b40fe..5be4006 100755 ---- a/test.sh -+++ b/test.sh -@@ -536,6 +536,22 @@ if [ "$testgrub2" == "y" ]; then - - testing="GRUB2 --default-index with default=saved_entry and empty grubenv" - grub2DisplayTest grub2.8 defaultindex/0 --env grubenv.0 --default-index -+ -+ testlinux16=n -+ case $ARCH in -+ ia32|x86_64) testlinux16=y ;; -+ esac -+ -+ if [ "$testlinux16" == "y" ]; then -+ testing="GRUB2 add kernel with linux16" -+ grub2Test grub2.10 add/g2-1.10 --add-kernel=/boot/new-kernel.img \ -+ --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ -+ --copy-default -+ -+ testing="GRUB2 add initrd with linux16" -+ grub2Test grub2.11 add/g2-1.11 --update-kernel=/boot/new-kernel.img \ -+ --initrd=/boot/new-initrd --boot-filesystem=/boot/ -+ fi - fi - - testing="YABOOT add kernel" -diff --git a/test/grub2.10 b/test/grub2.10 -new file mode 100644 -index 0000000..d010783 ---- /dev/null -+++ b/test/grub2.10 -@@ -0,0 +1,84 @@ -+# -+# 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 -+set default="0" -+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 { -+ insmod vbe -+ insmod vga -+ insmod video_bochs -+ insmod video_cirrus -+} -+ -+set timeout=5 -+### END /etc/grub.d/00_header ### -+ -+### BEGIN /etc/grub.d/10_linux ### -+menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img -+} -+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img -+} -+### END /etc/grub.d/10_linux ### -+ -+### BEGIN /etc/grub.d/20_linux_xen ### -+### END /etc/grub.d/20_linux_xen ### -+ -+### 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 $prefix/custom.cfg ]; then -+ source $prefix/custom.cfg; -+fi -+### END /etc/grub.d/41_custom ### -+ -+### BEGIN /etc/grub.d/90_persistent ### -+### END /etc/grub.d/90_persistent ### -diff --git a/test/grub2.11 b/test/grub2.11 -new file mode 100644 -index 0000000..820880a ---- /dev/null -+++ b/test/grub2.11 -@@ -0,0 +1,97 @@ -+# -+# 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 -+set default="0" -+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 { -+ insmod vbe -+ insmod vga -+ insmod video_bochs -+ insmod video_cirrus -+} -+ -+set timeout=5 -+### END /etc/grub.d/00_header ### -+ -+set superusers="foo bar baz" -+ -+### BEGIN /etc/grub.d/10_linux ### -+menuentry 'title' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading title' -+ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+} -+menuentry 'Linux, with Linux 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Linux 2.6.38.8-32.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img -+} -+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img -+} -+### END /etc/grub.d/10_linux ### -+ -+### BEGIN /etc/grub.d/20_linux_xen ### -+### END /etc/grub.d/20_linux_xen ### -+ -+### 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 $prefix/custom.cfg ]; then -+ source $prefix/custom.cfg; -+fi -+### END /etc/grub.d/41_custom ### -+ -+### BEGIN /etc/grub.d/90_persistent ### -+### END /etc/grub.d/90_persistent ### -diff --git a/test/results/add/g2-1.10 b/test/results/add/g2-1.10 -new file mode 100644 -index 0000000..bb2c71c ---- /dev/null -+++ b/test/results/add/g2-1.10 -@@ -0,0 +1,96 @@ -+# -+# 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 -+set default="1" -+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 { -+ insmod vbe -+ insmod vga -+ insmod video_bochs -+ insmod video_cirrus -+} -+ -+set timeout=5 -+### END /etc/grub.d/00_header ### -+ -+### BEGIN /etc/grub.d/10_linux ### -+menuentry 'title' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading title' -+ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /new-initrd -+} -+menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img -+} -+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img -+} -+### END /etc/grub.d/10_linux ### -+ -+### BEGIN /etc/grub.d/20_linux_xen ### -+### END /etc/grub.d/20_linux_xen ### -+ -+### 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 $prefix/custom.cfg ]; then -+ source $prefix/custom.cfg; -+fi -+### END /etc/grub.d/41_custom ### -+ -+### BEGIN /etc/grub.d/90_persistent ### -+### END /etc/grub.d/90_persistent ### -diff --git a/test/results/add/g2-1.11 b/test/results/add/g2-1.11 -new file mode 100644 -index 0000000..a11cb41 ---- /dev/null -+++ b/test/results/add/g2-1.11 -@@ -0,0 +1,98 @@ -+# -+# 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 -+set default="0" -+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 { -+ insmod vbe -+ insmod vga -+ insmod video_bochs -+ insmod video_cirrus -+} -+ -+set timeout=5 -+### END /etc/grub.d/00_header ### -+ -+set superusers="foo bar baz" -+ -+### BEGIN /etc/grub.d/10_linux ### -+menuentry 'title' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading title' -+ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /new-initrd -+} -+menuentry 'Linux, with Linux 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Linux 2.6.38.8-32.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img -+} -+menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { -+ load_video -+ set gfxpayload=keep -+ insmod part_msdos -+ insmod ext2 -+ set root='(hd0,msdos1)' -+ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed -+ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' -+ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb -+ echo 'Loading initial ramdisk ...' -+ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img -+} -+### END /etc/grub.d/10_linux ### -+ -+### BEGIN /etc/grub.d/20_linux_xen ### -+### END /etc/grub.d/20_linux_xen ### -+ -+### 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 $prefix/custom.cfg ]; then -+ source $prefix/custom.cfg; -+fi -+### END /etc/grub.d/41_custom ### -+ -+### BEGIN /etc/grub.d/90_persistent ### -+### END /etc/grub.d/90_persistent ### --- -1.8.4.2 - diff --git a/SOURCES/0001-Only-set-RPM_OPT_FLAGS-if-undefined.patch b/SOURCES/0001-Only-set-RPM_OPT_FLAGS-if-undefined.patch deleted file mode 100644 index 59a192c..0000000 --- a/SOURCES/0001-Only-set-RPM_OPT_FLAGS-if-undefined.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 28c9a212031ce7db05bf9a4bd0802f93c5e6ef39 Mon Sep 17 00:00:00 2001 -From: "d.marlin" -Date: Mon, 24 Jun 2013 14:57:40 -0500 -Subject: [PATCH grubby/master] Only set RPM_OPT_FLAGS if undefined. - -Currently RPM_OPT_FLAGS are set even if they were already defined. -This overrides any defaults set by RPM, including architecture-specific -values that may be needed to compile on some architectures. - -To avoid this issue, only set RPM_OPT_FLAGS if previously undefined. - -Signed-off-by: David A. Marlin ---- - Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile b/Makefile -index d299b77..dd8104e 100644 ---- a/Makefile -+++ b/Makefile -@@ -23,7 +23,7 @@ TARGETS = grubby - OBJECTS = grubby.o log.o - - CC = gcc --RPM_OPT_FLAGS := -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector -+RPM_OPT_FLAGS ?= -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector - CFLAGS += $(RPM_OPT_FLAGS) -std=gnu99 -Wall -Werror -Wno-error=unused-function -Wno-unused-function -ggdb - LDFLAGS := - --- -1.8.1.4 - diff --git a/SOURCES/0001-Use-PREFIX-during-make-install.patch b/SOURCES/0001-Use-PREFIX-during-make-install.patch index 5607533..2759386 100644 --- a/SOURCES/0001-Use-PREFIX-during-make-install.patch +++ b/SOURCES/0001-Use-PREFIX-during-make-install.patch @@ -1,18 +1,20 @@ -From 57944dd96c2c14cac66ec29e99500357c189f8e7 Mon Sep 17 00:00:00 2001 +From 5ed33f682272c88bd6eadf91f2688a1520e28b53 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 13 Sep 2013 10:37:10 -0400 -Subject: [PATCH] Use $(PREFIX) during make install. +Subject: [PATCH 01/16] Use $(PREFIX) during make install. Signed-off-by: Peter Jones --- - Makefile | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + Makefile | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile -index 5dbf0f7..ad83c33 100644 +index 3f6370b..5a151ce 100644 --- a/Makefile +++ b/Makefile -@@ -44,12 +44,12 @@ test: all +@@ -42,14 +42,14 @@ test: all + @./test.sh + install: all - mkdir -p $(DESTDIR)/sbin + mkdir -p $(DESTDIR)$(PREFIX)/sbin @@ -30,5 +32,5 @@ index 5dbf0f7..ad83c33 100644 fi -- -1.8.3.1 +1.9.3 diff --git a/SOURCES/0002-Honor-linux16-and-initrd16.patch b/SOURCES/0002-Honor-linux16-and-initrd16.patch new file mode 100644 index 0000000..bb4efc2 --- /dev/null +++ b/SOURCES/0002-Honor-linux16-and-initrd16.patch @@ -0,0 +1,638 @@ +From a2c98347462a78a162525496ef694190018fb66c Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 18 Nov 2013 14:44:13 -0500 +Subject: [PATCH 02/16] Honor "linux16" and "initrd16" + +Resolves: rhbz#1031192 +Resolves: rhbz#1034743 + +Signed-off-by: Peter Jones +--- + grubby.c | 63 ++++++++++++++++++++++--------- + test.sh | 16 ++++++++ + test/grub2.10 | 84 +++++++++++++++++++++++++++++++++++++++++ + test/grub2.11 | 97 +++++++++++++++++++++++++++++++++++++++++++++++ + test/results/add/g2-1.10 | 96 +++++++++++++++++++++++++++++++++++++++++++++++ + test/results/add/g2-1.11 | 98 ++++++++++++++++++++++++++++++++++++++++++++++++ + 6 files changed, 437 insertions(+), 17 deletions(-) + create mode 100644 test/grub2.10 + create mode 100644 test/grub2.11 + create mode 100644 test/results/add/g2-1.10 + create mode 100644 test/results/add/g2-1.11 + +diff --git a/grubby.c b/grubby.c +index bbca9d0..4488636 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -90,7 +90,9 @@ enum lineType_e { + LT_SET_VARIABLE = 1 << 19, + LT_KERNEL_EFI = 1 << 20, + LT_INITRD_EFI = 1 << 21, +- LT_UNKNOWN = 1 << 22, ++ LT_KERNEL_16 = 1 << 22, ++ LT_INITRD_16 = 1 << 23, ++ LT_UNKNOWN = 1 << 24, + }; + + struct singleLine { +@@ -220,8 +222,10 @@ struct keywordTypes grub2Keywords[] = { + { "fallback", LT_FALLBACK, ' ' }, + { "linux", LT_KERNEL, ' ' }, + { "linuxefi", LT_KERNEL_EFI, ' ' }, ++ { "linux16", LT_KERNEL_16, ' ' }, + { "initrd", LT_INITRD, ' ', ' ' }, + { "initrdefi", LT_INITRD_EFI, ' ', ' ' }, ++ { "initrd16", LT_INITRD_16, ' ', ' ' }, + { "module", LT_MBMODULE, ' ' }, + { "kernel", LT_HYPER, ' ' }, + { NULL, 0, 0 }, +@@ -395,11 +399,11 @@ static int isquote(char q) + } + + static int iskernel(enum lineType_e type) { +- return (type == LT_KERNEL || type == LT_KERNEL_EFI); ++ return (type == LT_KERNEL || type == LT_KERNEL_EFI || type == LT_KERNEL_16); + } + + static int isinitrd(enum lineType_e type) { +- return (type == LT_INITRD || type == LT_INITRD_EFI); ++ return (type == LT_INITRD || type == LT_INITRD_EFI || type == LT_INITRD_16); + } + + char *grub2ExtractTitle(struct singleLine * line) { +@@ -717,6 +721,17 @@ static enum lineType_e preferredLineType(enum lineType_e type, + default: + return type; + } ++#if defined(__i386__) || defined(__x86_64__) ++ } else if (cfi == &grub2ConfigType) { ++ switch (type) { ++ case LT_KERNEL: ++ return LT_KERNEL_16; ++ case LT_INITRD: ++ return LT_INITRD_16; ++ default: ++ return type; ++ } ++#endif + } + return type; + } +@@ -1804,7 +1819,7 @@ int suitableImage(struct singleEntry * entry, const char * bootPrefix, + return 0; + } + +- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); ++ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!line) { + notSuitablePrintf(entry, 0, "no line found\n"); + return 0; +@@ -1938,7 +1953,7 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, + entry = findEntryByIndex(config, indexVars[i]); + if (!entry) return NULL; + +- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); ++ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!line) return NULL; + + if (index) *index = indexVars[i]; +@@ -1989,9 +2004,9 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, + for (line = entry->lines; line; line = line->next) { + enum lineType_e ct = checkType; + if (entry->multiboot && checkType == LT_KERNEL) +- ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER; ++ ct = LT_KERNEL|LT_KERNEL_EFI|LT_MBMODULE|LT_HYPER|LT_KERNEL_16; + else if (checkType & LT_KERNEL) +- ct = checkType | LT_KERNEL_EFI; ++ ct = checkType | LT_KERNEL_EFI | LT_KERNEL_16; + line = getLineByType(ct, line); + if (!line) + break; /* not found in this entry */ +@@ -2013,7 +2028,7 @@ struct singleEntry * findEntryByPath(struct grubConfig * config, + * non-Linux boot entries (could find netbsd etc, though, which is + * unfortunate) + */ +- if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines)) ++ if (line && getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines)) + break; /* found 'im! */ + } + +@@ -2247,7 +2262,7 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) { + + printf("index=%d\n", index); + +- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); ++ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!line) { + printf("non linux entry\n"); + return; +@@ -2312,7 +2327,7 @@ void displayEntry(struct singleEntry * entry, const char * prefix, int index) { + printf("root=%s\n", s); + } + +- line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines); ++ line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines); + + if (line && line->numElements >= 2) { + if (!strncmp(prefix, line->elements[1].item, strlen(prefix))) +@@ -2729,7 +2744,7 @@ struct singleLine * addLineTmpl(struct singleEntry * entry, + insertElement(newLine, val, 1, cfi); + + /* but try to keep the rootspec from the template... sigh */ +- if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI)) { ++ if (tmplLine->type & (LT_HYPER|LT_KERNEL|LT_MBMODULE|LT_INITRD|LT_KERNEL_EFI|LT_INITRD_EFI|LT_KERNEL_16|LT_INITRD_16)) { + char * rootspec = getRootSpecifier(tmplLine->elements[1].item); + if (rootspec != NULL) { + free(newLine->elements[1].item); +@@ -3099,7 +3114,7 @@ int updateActualImage(struct grubConfig * cfg, const char * image, + firstElement = 2; + + } else { +- line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI, entry->lines); ++ line = getLineByType(LT_KERNEL|LT_MBMODULE|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!line) { + /* no LT_KERNEL or LT_MBMODULE in this entry? */ + continue; +@@ -3264,10 +3279,10 @@ int updateInitrd(struct grubConfig * cfg, const char * image, + if (!image) return 0; + + for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) { +- kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI, entry->lines); ++ kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!kernelLine) continue; + +- line = getLineByType(LT_INITRD|LT_INITRD_EFI, entry->lines); ++ line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines); + if (line) + removeLine(entry, line); + if (prefix) { +@@ -3278,8 +3293,21 @@ int updateInitrd(struct grubConfig * cfg, const char * image, + endLine = getLineByType(LT_ENTRY_END, entry->lines); + if (endLine) + removeLine(entry, endLine); +- line = addLine(entry, cfg->cfi, preferredLineType(LT_INITRD, cfg->cfi), +- kernelLine->indent, initrd); ++ enum lineType_e lt; ++ switch(kernelLine->type) { ++ case LT_KERNEL: ++ lt = LT_INITRD; ++ break; ++ case LT_KERNEL_EFI: ++ lt = LT_INITRD_EFI; ++ break; ++ case LT_KERNEL_16: ++ lt = LT_INITRD_16; ++ break; ++ default: ++ lt = preferredLineType(LT_INITRD, cfg->cfi); ++ } ++ line = addLine(entry, cfg->cfi, lt, kernelLine->indent, initrd); + if (!line) + return 1; + if (endLine) { +@@ -3877,6 +3905,7 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, + switch (config->cfi->entryStart) { + case LT_KERNEL: + case LT_KERNEL_EFI: ++ case LT_KERNEL_16: + if (new->multiboot && config->cfi->mbHyperFirst) { + /* fall through to LT_HYPER */ + } else { +@@ -4435,7 +4464,7 @@ int main(int argc, const char ** argv) { + if (!entry) return 0; + if (!suitableImage(entry, bootPrefix, 0, flags)) return 0; + +- line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI, entry->lines); ++ line = getLineByType(LT_KERNEL|LT_HYPER|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!line) return 0; + + rootspec = getRootSpecifier(line->elements[1].item); +diff --git a/test.sh b/test.sh +index 17b40fe..5be4006 100755 +--- a/test.sh ++++ b/test.sh +@@ -536,6 +536,22 @@ if [ "$testgrub2" == "y" ]; then + + testing="GRUB2 --default-index with default=saved_entry and empty grubenv" + grub2DisplayTest grub2.8 defaultindex/0 --env grubenv.0 --default-index ++ ++ testlinux16=n ++ case $ARCH in ++ ia32|x86_64) testlinux16=y ;; ++ esac ++ ++ if [ "$testlinux16" == "y" ]; then ++ testing="GRUB2 add kernel with linux16" ++ grub2Test grub2.10 add/g2-1.10 --add-kernel=/boot/new-kernel.img \ ++ --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ ++ --copy-default ++ ++ testing="GRUB2 add initrd with linux16" ++ grub2Test grub2.11 add/g2-1.11 --update-kernel=/boot/new-kernel.img \ ++ --initrd=/boot/new-initrd --boot-filesystem=/boot/ ++ fi + fi + + testing="YABOOT add kernel" +diff --git a/test/grub2.10 b/test/grub2.10 +new file mode 100644 +index 0000000..d010783 +--- /dev/null ++++ b/test/grub2.10 +@@ -0,0 +1,84 @@ ++# ++# 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 ++set default="0" ++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 { ++ insmod vbe ++ insmod vga ++ insmod video_bochs ++ insmod video_cirrus ++} ++ ++set timeout=5 ++### END /etc/grub.d/00_header ### ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img ++} ++menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img ++} ++### END /etc/grub.d/10_linux ### ++ ++### BEGIN /etc/grub.d/20_linux_xen ### ++### END /etc/grub.d/20_linux_xen ### ++ ++### 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 $prefix/custom.cfg ]; then ++ source $prefix/custom.cfg; ++fi ++### END /etc/grub.d/41_custom ### ++ ++### BEGIN /etc/grub.d/90_persistent ### ++### END /etc/grub.d/90_persistent ### +diff --git a/test/grub2.11 b/test/grub2.11 +new file mode 100644 +index 0000000..820880a +--- /dev/null ++++ b/test/grub2.11 +@@ -0,0 +1,97 @@ ++# ++# 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 ++set default="0" ++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 { ++ insmod vbe ++ insmod vga ++ insmod video_bochs ++ insmod video_cirrus ++} ++ ++set timeout=5 ++### END /etc/grub.d/00_header ### ++ ++set superusers="foo bar baz" ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'title' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading title' ++ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++} ++menuentry 'Linux, with Linux 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Linux 2.6.38.8-32.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img ++} ++menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img ++} ++### END /etc/grub.d/10_linux ### ++ ++### BEGIN /etc/grub.d/20_linux_xen ### ++### END /etc/grub.d/20_linux_xen ### ++ ++### 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 $prefix/custom.cfg ]; then ++ source $prefix/custom.cfg; ++fi ++### END /etc/grub.d/41_custom ### ++ ++### BEGIN /etc/grub.d/90_persistent ### ++### END /etc/grub.d/90_persistent ### +diff --git a/test/results/add/g2-1.10 b/test/results/add/g2-1.10 +new file mode 100644 +index 0000000..bb2c71c +--- /dev/null ++++ b/test/results/add/g2-1.10 +@@ -0,0 +1,96 @@ ++# ++# 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 ++set default="1" ++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 { ++ insmod vbe ++ insmod vga ++ insmod video_bochs ++ insmod video_cirrus ++} ++ ++set timeout=5 ++### END /etc/grub.d/00_header ### ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'title' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading title' ++ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /new-initrd ++} ++menuentry 'Linux, with Fedora 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Fedora 2.6.38.8-32.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img ++} ++menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img ++} ++### END /etc/grub.d/10_linux ### ++ ++### BEGIN /etc/grub.d/20_linux_xen ### ++### END /etc/grub.d/20_linux_xen ### ++ ++### 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 $prefix/custom.cfg ]; then ++ source $prefix/custom.cfg; ++fi ++### END /etc/grub.d/41_custom ### ++ ++### BEGIN /etc/grub.d/90_persistent ### ++### END /etc/grub.d/90_persistent ### +diff --git a/test/results/add/g2-1.11 b/test/results/add/g2-1.11 +new file mode 100644 +index 0000000..a11cb41 +--- /dev/null ++++ b/test/results/add/g2-1.11 +@@ -0,0 +1,98 @@ ++# ++# 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 ++set default="0" ++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 { ++ insmod vbe ++ insmod vga ++ insmod video_bochs ++ insmod video_cirrus ++} ++ ++set timeout=5 ++### END /etc/grub.d/00_header ### ++ ++set superusers="foo bar baz" ++ ++### BEGIN /etc/grub.d/10_linux ### ++menuentry 'title' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading title' ++ linux16 /new-kernel.img root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /new-initrd ++} ++menuentry 'Linux, with Linux 2.6.38.8-32.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Linux 2.6.38.8-32.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.8-32.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.8-32.fc15.x86_64.img ++} ++menuentry 'Linux, with Linux 2.6.38.2-9.fc15.x86_64' --class gnu-linux --class gnu --class os { ++ load_video ++ set gfxpayload=keep ++ insmod part_msdos ++ insmod ext2 ++ set root='(hd0,msdos1)' ++ search --no-floppy --fs-uuid --set=root df0170c9-7d05-415c-bbd1-d4d503ba0eed ++ echo 'Loading Linux 2.6.38.2-9.fc15.x86_64 ...' ++ linux16 /vmlinuz-2.6.38.2-9.fc15.x86_64 root=/dev/mapper/vg_pjones5-lv_root ro quiet rhgb ++ echo 'Loading initial ramdisk ...' ++ initrd16 /initramfs-2.6.38.2-9.fc15.x86_64.img ++} ++### END /etc/grub.d/10_linux ### ++ ++### BEGIN /etc/grub.d/20_linux_xen ### ++### END /etc/grub.d/20_linux_xen ### ++ ++### 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 $prefix/custom.cfg ]; then ++ source $prefix/custom.cfg; ++fi ++### END /etc/grub.d/41_custom ### ++ ++### BEGIN /etc/grub.d/90_persistent ### ++### END /etc/grub.d/90_persistent ### +-- +1.9.3 + diff --git a/SOURCES/0002-Strdup-the-right-place-in-title-extraction.patch b/SOURCES/0002-Strdup-the-right-place-in-title-extraction.patch new file mode 100644 index 0000000..d55014c --- /dev/null +++ b/SOURCES/0002-Strdup-the-right-place-in-title-extraction.patch @@ -0,0 +1,36 @@ +From 320159cd9da53448793b39d044eec7c10fe17ffe Mon Sep 17 00:00:00 2001 +From: Jan Stancek +Date: Tue, 11 Nov 2014 10:44:09 -0500 +Subject: [PATCH 2/2] Strdup the right place in title extraction. + +Instead of strduping and then incrementing, which means we free the +wrong location, strdup the incremented pointer. + +Resolves: rhbz#1152152 + +Signed-off-by: Peter Jones +--- + grubby.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/grubby.c b/grubby.c +index 3ee6c98..4586310 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -826,11 +826,10 @@ static int isEntryStart(struct singleLine * line, + + /* extract the title from within brackets (for zipl) */ + static char * extractTitle(struct singleLine * line) { +- /* bracketed title... let's extract it (leaks a byte) */ ++ /* bracketed title... let's extract it */ + char * title = NULL; + if (line->type == LT_TITLE) { +- title = strdup(line->elements[0].item); +- title++; ++ title = strdup(line->elements[0].item + 1); + *(title + strlen(title) - 1) = '\0'; + } else if (line->type == LT_MENUENTRY) + title = strdup(line->elements[1].item); +-- +1.9.3 + diff --git a/SOURCES/0003-Only-set-RPM_OPT_FLAGS-if-undefined.patch b/SOURCES/0003-Only-set-RPM_OPT_FLAGS-if-undefined.patch new file mode 100644 index 0000000..6604a6e --- /dev/null +++ b/SOURCES/0003-Only-set-RPM_OPT_FLAGS-if-undefined.patch @@ -0,0 +1,32 @@ +From c0980dceebc0c67eeb25315b860f6d843e1baed6 Mon Sep 17 00:00:00 2001 +From: "d.marlin" +Date: Mon, 24 Jun 2013 14:57:40 -0500 +Subject: [PATCH 03/16] Only set RPM_OPT_FLAGS if undefined. + +Currently RPM_OPT_FLAGS are set even if they were already defined. +This overrides any defaults set by RPM, including architecture-specific +values that may be needed to compile on some architectures. + +To avoid this issue, only set RPM_OPT_FLAGS if previously undefined. + +Signed-off-by: David A. Marlin +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 5a151ce..94cef27 100644 +--- a/Makefile ++++ b/Makefile +@@ -23,7 +23,7 @@ TARGETS = grubby + OBJECTS = grubby.o log.o + + CC = gcc +-RPM_OPT_FLAGS := -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector ++RPM_OPT_FLAGS ?= -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector + CFLAGS += $(RPM_OPT_FLAGS) -std=gnu99 -Wall -Werror -Wno-error=unused-function -Wno-unused-function -ggdb + LDFLAGS := + +-- +1.9.3 + diff --git a/SOURCES/0004-Drop-SEGV-handler.patch b/SOURCES/0004-Drop-SEGV-handler.patch new file mode 100644 index 0000000..eb34d6a --- /dev/null +++ b/SOURCES/0004-Drop-SEGV-handler.patch @@ -0,0 +1,52 @@ +From 149a5e63ff5fc58d4cea9024d2ecfdd7f755fbc4 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Thu, 27 Feb 2014 10:35:59 +0100 +Subject: [PATCH 04/16] Drop SEGV handler + +The generated tracebacks are mostly useless without debuginfo (which is likely +not present if the crash is not anticipated) and prevent ABRT from doing a +better job. + +Signed-off-by: Lubomir Rintel +--- + grubby.c | 17 ----------------- + 1 file changed, 17 deletions(-) + +diff --git a/grubby.c b/grubby.c +index 4488636..d33ce6e 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -4029,21 +4029,6 @@ int addNewKernel(struct grubConfig * config, struct singleEntry * template, + return 0; + } + +-static void traceback(int signum) +-{ +- void *array[40]; +- size_t size; +- +- signal(SIGSEGV, SIG_DFL); +- memset(array, '\0', sizeof (array)); +- size = backtrace(array, 40); +- +- fprintf(stderr, "grubby received SIGSEGV! Backtrace (%ld):\n", +- (unsigned long)size); +- backtrace_symbols_fd(array, size, STDERR_FILENO); +- exit(1); +-} +- + int main(int argc, const char ** argv) { + poptContext optCon; + const char * grubConfig = NULL; +@@ -4182,8 +4167,6 @@ int main(int argc, const char ** argv) { + + useextlinuxmenu=0; + +- signal(SIGSEGV, traceback); +- + int i = 0; + for (int j = 1; j < argc; j++) + i += strlen(argv[j]) + 1; +-- +1.9.3 + diff --git a/SOURCES/0005-grub-Fix-a-crash-with-kernel-line-without-being-prec.patch b/SOURCES/0005-grub-Fix-a-crash-with-kernel-line-without-being-prec.patch new file mode 100644 index 0000000..df104ce --- /dev/null +++ b/SOURCES/0005-grub-Fix-a-crash-with-kernel-line-without-being-prec.patch @@ -0,0 +1,36 @@ +From b2ca7caef3da7bc3ca7a90c1d39f2dc42770a682 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Wed, 27 Nov 2013 16:59:48 +0100 +Subject: [PATCH 05/16] grub: Fix a crash with kernel line without being + preceded by title + +Quite obviously this implies a broken configuration file where a lone kernel +line is found without ever seeing an entry start, resulting in a NULL +dereference attempt. Reproducible by running GRUB code against extlinux +configuration: + +./grubby --grub -c test/extlinux.1 --default-kernel +grubby received SIGSEGV! Backtrace (6): +... + +Signed-off-by: Lubomir Rintel +--- + grubby.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/grubby.c b/grubby.c +index d33ce6e..4773852 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -1188,7 +1188,7 @@ static struct grubConfig * readConfig(const char * inName, + * lines came earlier in the template, make sure to use LT_HYPER + * instead of LT_KERNEL now + */ +- if (entry->multiboot) ++ if (entry && entry->multiboot) + line->type = LT_HYPER; + + } else if (line->type == LT_MBMODULE) { +-- +1.9.3 + diff --git a/SOURCES/0006-Support-devicetree-directive-in-grub2.patch b/SOURCES/0006-Support-devicetree-directive-in-grub2.patch new file mode 100644 index 0000000..e1de8a1 --- /dev/null +++ b/SOURCES/0006-Support-devicetree-directive-in-grub2.patch @@ -0,0 +1,65 @@ +From 058afd893cef267ee5d88f331da5c64708378b8b Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 11 Feb 2014 10:24:48 -0500 +Subject: [PATCH 06/16] Support "devicetree" directive in grub2. + +Resolves: rhbz#1063534 + +Signed-off-by: Peter Jones +--- + new-kernel-pkg | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index 7fec1fe..30477cc 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -111,6 +111,7 @@ initrd="" + dracut="" + dracuthostonly="" + initrdfile="" ++devtreefile="" + moddep="" + verbose="" + makedefault="" +@@ -127,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]" >&2 ++ echo " [--host-only] [--devtree=]" >&2 + echo " <--install | --remove | --update | --rpmposttrans> " >&2 + echo " (ex: `basename $0` --mkinitrd --depmod --install 2.4.7-2)" >&2 + exit 1 +@@ -151,6 +152,12 @@ install() { + fi + fi + ++ DEVTREE="" ++ if [ -f $devtreefile ]; then ++ [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" ++ DEVTREE="--devtree $devtreefile" ++ 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" +@@ -537,6 +544,15 @@ while [ $# -gt 0 ]; do + initrd="remove" + ;; + ++ --devtree*) ++ if [[ $1 == --devtree\=* ]]; then ++ devtreefile=${1#--devtreefile=} ++ else ++ devtreefile=$2 ++ shift ++ fi ++ ;; ++ + --dracut) + dracut=--dracut + ;; +-- +1.9.3 + diff --git a/SOURCES/0007-Actually-USE-DEVTREE-in-new-kernel-pkg.patch b/SOURCES/0007-Actually-USE-DEVTREE-in-new-kernel-pkg.patch new file mode 100644 index 0000000..0f503b1 --- /dev/null +++ b/SOURCES/0007-Actually-USE-DEVTREE-in-new-kernel-pkg.patch @@ -0,0 +1,28 @@ +From e3290d26354228a6d1ffa0e24377c35a53ef780f Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 12 Feb 2014 10:58:48 -0500 +Subject: [PATCH 07/16] Actually /USE/ $DEVTREE in new-kernel-pkg. + +Resolves: rhbz#1063534 + +Signed-off-by: Peter Jones +--- + new-kernel-pkg | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index 30477cc..f4fd275 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -224,7 +224,7 @@ install() { + [ -n "$verbose" ] && echo "adding $version to $grub2EfiConfig" + + $grubby --grub2 -c $grub2EfiConfig --efi \ +- --add-kernel=$kernelImage \ ++ --add-kernel=$kernelImage $DEVTREE \ + $INITRD --copy-default $makedefault --title "$title" \ + ${mbkernel:+--add-multiboot="$mbkernel"} \ + ${mbargs:+--mbargs="$mbargs"} \ +-- +1.9.3 + diff --git a/SOURCES/0008-Fix-bad-check-for-new-kernel-pkg-s-command-line-argu.patch b/SOURCES/0008-Fix-bad-check-for-new-kernel-pkg-s-command-line-argu.patch new file mode 100644 index 0000000..1d36bdd --- /dev/null +++ b/SOURCES/0008-Fix-bad-check-for-new-kernel-pkg-s-command-line-argu.patch @@ -0,0 +1,30 @@ +From 3ed06bf8ca9681a009f4ee0355829f05ed5ceade Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 31 Mar 2014 13:59:34 -0400 +Subject: [PATCH 08/16] Fix bad check for new-kernel-pkg's command line + arguments. + +--devtree's argument needs to be nonempty, not just pass -f. +Resolves: rhbz#1082318 + +Signed-off-by: Peter Jones +--- + new-kernel-pkg | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index f4fd275..5fb0949 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -153,7 +153,7 @@ install() { + fi + + DEVTREE="" +- if [ -f $devtreefile ]; then ++ if [ "x$devtreefile" != "x" -a -f $devtreefile ]; then + [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" + DEVTREE="--devtree $devtreefile" + fi +-- +1.9.3 + diff --git a/SOURCES/0009-Actually-do-a-fix-for-rhbz-1082318-that-fixes-the-is.patch b/SOURCES/0009-Actually-do-a-fix-for-rhbz-1082318-that-fixes-the-is.patch new file mode 100644 index 0000000..61cbf69 --- /dev/null +++ b/SOURCES/0009-Actually-do-a-fix-for-rhbz-1082318-that-fixes-the-is.patch @@ -0,0 +1,32 @@ +From 6125b964c666c57fc10746d9b1a4d02167cf3689 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 1 Apr 2014 08:48:09 -0400 +Subject: [PATCH 09/16] Actually do a fix for rhbz#1082318 that fixes the issue + there. + +News: after all these years I'm still terrible at shell scripts, just +like everybody else. + +Related: rhbz#1063534 + +Signed-off-by: Peter Jones +--- + new-kernel-pkg | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index 5fb0949..e6096ca 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -153,7 +153,7 @@ install() { + fi + + DEVTREE="" +- if [ "x$devtreefile" != "x" -a -f $devtreefile ]; then ++ if [ "x$devtreefile" != "x" -a -f "$devtreefile" ]; then + [ -n "$verbose" ] && echo "found $devtreefile and using it with grubby" + DEVTREE="--devtree $devtreefile" + fi +-- +1.9.3 + diff --git a/SOURCES/0010-Use-the-correct-load-commands-for-aarch64-efi.patch b/SOURCES/0010-Use-the-correct-load-commands-for-aarch64-efi.patch new file mode 100644 index 0000000..4b11c51 --- /dev/null +++ b/SOURCES/0010-Use-the-correct-load-commands-for-aarch64-efi.patch @@ -0,0 +1,64 @@ +From 1d7f20b6b0f803f960cc9375816d94cc3270d711 Mon Sep 17 00:00:00 2001 +From: no one +Date: Thu, 13 Feb 2014 10:30:11 -0500 +Subject: [PATCH 10/16] Use the correct load commands for aarch64 efi. + +Resolves: rhbz#1081269 +--- + grubby.c | 7 +++++++ + test.sh | 17 ++++++++++++++--- + 2 files changed, 21 insertions(+), 3 deletions(-) + +diff --git a/grubby.c b/grubby.c +index 4773852..74818a2 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -714,10 +714,17 @@ static enum lineType_e preferredLineType(enum lineType_e type, + struct configFileInfo *cfi) { + if (isEfi && cfi == &grub2ConfigType) { + switch (type) { ++#if defined(__aarch64__) ++ case LT_KERNEL: ++ return LT_KERNEL; ++ case LT_INITRD: ++ return LT_INITRD; ++#else + case LT_KERNEL: + return LT_KERNEL_EFI; + case LT_INITRD: + return LT_INITRD_EFI; ++#endif + default: + return type; + } +diff --git a/test.sh b/test.sh +index 5be4006..1d28fb1 100755 +--- a/test.sh ++++ b/test.sh +@@ -443,9 +443,20 @@ if [ "$testgrub2" == "y" ]; then + grub2Test grub2.1 add/g2-1.1 --add-kernel=/boot/new-kernel.img \ + --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ + --copy-default +- grub2Test grub2.1 add/g2-1.6 --add-kernel=/boot/new-kernel.img \ +- --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ +- --copy-default --efi ++ case $ARCH in ++ aarch64) ++ grub2Test grub2.1 add/g2-1.1 --add-kernel=/boot/new-kernel.img \ ++ --title='title' \ ++ --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ ++ --copy-default --efi ++ ;; ++ *) ++ grub2Test grub2.1 add/g2-1.6 --add-kernel=/boot/new-kernel.img \ ++ --title='title' \ ++ --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ ++ --copy-default --efi ++ ;; ++ esac + grub2Test grub2.6 add/g2-1.7 --add-kernel=/boot/new-kernel.img \ + --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ + --copy-default --efi +-- +1.9.3 + diff --git a/SOURCES/0011-Tell-a-slightly-better-fib-about-default-bootloader-.patch b/SOURCES/0011-Tell-a-slightly-better-fib-about-default-bootloader-.patch new file mode 100644 index 0000000..1762852 --- /dev/null +++ b/SOURCES/0011-Tell-a-slightly-better-fib-about-default-bootloader-.patch @@ -0,0 +1,46 @@ +From 6798634625ff6525632bf1fa26a54b85bd3cba5b Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 12 Sep 2014 15:50:05 -0400 +Subject: [PATCH 11/16] 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 d79e60e..9d7a1fd 100644 +--- a/grubby.8 ++++ b/grubby.8 +@@ -18,16 +18,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/SOURCES/0012-Make-findTemplate-actually-return-the-saved-default.patch b/SOURCES/0012-Make-findTemplate-actually-return-the-saved-default.patch new file mode 100644 index 0000000..326c0ea --- /dev/null +++ b/SOURCES/0012-Make-findTemplate-actually-return-the-saved-default.patch @@ -0,0 +1,35 @@ +From a045b730c7d5296097aab3b4194847165eed26dc Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 15 Sep 2014 14:31:01 -0400 +Subject: [PATCH 12/16] 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 74818a2..6cfc5b7 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -2108,8 +2108,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/SOURCES/0013-If-we-re-using-multiboot-add-a-new-mbmodule-not-an-i.patch b/SOURCES/0013-If-we-re-using-multiboot-add-a-new-mbmodule-not-an-i.patch new file mode 100644 index 0000000..371d59e --- /dev/null +++ b/SOURCES/0013-If-we-re-using-multiboot-add-a-new-mbmodule-not-an-i.patch @@ -0,0 +1,97 @@ +From 45561f504ef2329d0461b8d2c38447f54610f12e Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 12 Sep 2013 20:41:33 +0200 +Subject: [PATCH 13/16] If we're using multiboot, add a new mbmodule not an + initramfs + +I really don't know how this ever worked. +Related: rhbz#957681 + +Signed-off-by: Peter Jones +--- + grubby.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- + new-kernel-pkg | 3 ++- + 2 files changed, 47 insertions(+), 3 deletions(-) + +diff --git a/grubby.c b/grubby.c +index 6cfc5b7..c82ab00 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -3281,6 +3281,42 @@ int updateImage(struct grubConfig * cfg, const char * image, + return rc; + } + ++int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel, ++ const char * image, const char * prefix, const char * initrd) { ++ struct singleEntry * entry; ++ struct singleLine * line, * kernelLine, *endLine = NULL; ++ int index = 0; ++ ++ if (!image) return 0; ++ ++ for (; (entry = findEntryByPath(cfg, newMBKernel, prefix, &index)); index++) { ++ kernelLine = getLineByType(LT_MBMODULE, entry->lines); ++ if (!kernelLine) continue; ++ ++ if (prefix) { ++ int prefixLen = strlen(prefix); ++ if (!strncmp(initrd, prefix, prefixLen)) ++ initrd += prefixLen; ++ } ++ endLine = getLineByType(LT_ENTRY_END, entry->lines); ++ if (endLine) ++ removeLine(entry, endLine); ++ line = addLine(entry, cfg->cfi, preferredLineType(LT_MBMODULE,cfg->cfi), ++ kernelLine->indent, initrd); ++ if (!line) ++ return 1; ++ if (endLine) { ++ line = addLine(entry, cfg->cfi, LT_ENTRY_END, "", NULL); ++ if (!line) ++ return 1; ++ } ++ ++ break; ++ } ++ ++ return 0; ++} ++ + int updateInitrd(struct grubConfig * cfg, const char * image, + const char * prefix, const char * initrd) { + struct singleEntry * entry; +@@ -4519,8 +4555,15 @@ int main(int argc, const char ** argv) { + if (updateImage(config, updateKernelPath, bootPrefix, newKernelArgs, + removeArgs, newMBKernelArgs, removeMBKernelArgs)) return 1; + if (updateKernelPath && newKernelInitrd) { +- if (updateInitrd(config, updateKernelPath, bootPrefix, +- newKernelInitrd)) return 1; ++ if (newMBKernel) { ++ if (addMBInitrd(config, newMBKernel, updateKernelPath, ++ bootPrefix, newKernelInitrd)) ++ return 1; ++ } else { ++ if (updateInitrd(config, updateKernelPath, bootPrefix, ++ newKernelInitrd)) ++ return 1; ++ } + } + if (addNewKernel(config, template, bootPrefix, newKernelPath, + newKernelTitle, newKernelArgs, newKernelInitrd, +diff --git a/new-kernel-pkg b/new-kernel-pkg +index e6096ca..fe0d55a 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -411,7 +411,8 @@ update() { + --update-kernel=$kernelImage \ + $INITRD \ + ${kernargs:+--args="$kernargs"} \ +- ${removeargs:+--remove-args="$removeargs"} ++ ${removeargs:+--remove-args="$removeargs"} \ ++ ${mbkernel:+--add-multiboot="$mbkernel"} + else + [ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby" + fi +-- +1.9.3 + diff --git a/SOURCES/0014-Support-filtering-update-kernel-by-title-as-well.patch b/SOURCES/0014-Support-filtering-update-kernel-by-title-as-well.patch new file mode 100644 index 0000000..6013d96 --- /dev/null +++ b/SOURCES/0014-Support-filtering-update-kernel-by-title-as-well.patch @@ -0,0 +1,106 @@ +From dad65a1811412fb6b5e9e7211f8cf9d397732255 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 15 Sep 2014 15:18:48 -0400 +Subject: [PATCH 14/16] Support filtering --update-kernel= by title as well. + +If there are two entries with the same kernel, we need to match the +title to uniquely identify one. + +Related: rhbz#957681 +Signed-off-by: Peter Jones +--- + grubby.c | 40 +++++++++++++++++++++++++++++++++++----- + 1 file changed, 35 insertions(+), 5 deletions(-) + +diff --git a/grubby.c b/grubby.c +index c82ab00..24c6df0 100644 +--- a/grubby.c ++++ b/grubby.c +@@ -3282,7 +3282,8 @@ int updateImage(struct grubConfig * cfg, const char * image, + } + + int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel, +- const char * image, const char * prefix, const char * initrd) { ++ const char * image, const char * prefix, const char * initrd, ++ const char * title) { + struct singleEntry * entry; + struct singleLine * line, * kernelLine, *endLine = NULL; + int index = 0; +@@ -3293,6 +3294,20 @@ int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel, + kernelLine = getLineByType(LT_MBMODULE, entry->lines); + if (!kernelLine) continue; + ++ /* if title is supplied, the entry's title must match it. */ ++ if (title) { ++ line = getLineByType(LT_TITLE|LT_MENUENTRY, entry->lines); ++ char *linetitle = extractTitle(line); ++ ++ if (!linetitle) ++ continue; ++ if (strcmp(title, linetitle)) { ++ free(linetitle); ++ continue; ++ } ++ free(linetitle); ++ } ++ + if (prefix) { + int prefixLen = strlen(prefix); + if (!strncmp(initrd, prefix, prefixLen)) +@@ -3318,7 +3333,7 @@ int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel, + } + + int updateInitrd(struct grubConfig * cfg, const char * image, +- const char * prefix, const char * initrd) { ++ const char * prefix, const char * initrd, const char * title) { + struct singleEntry * entry; + struct singleLine * line, * kernelLine, *endLine = NULL; + int index = 0; +@@ -3329,6 +3344,20 @@ int updateInitrd(struct grubConfig * cfg, const char * image, + kernelLine = getLineByType(LT_KERNEL|LT_KERNEL_EFI|LT_KERNEL_16, entry->lines); + if (!kernelLine) continue; + ++ /* if title is supplied, the entry's title must match it. */ ++ if (title) { ++ line = getLineByType(LT_TITLE|LT_MENUENTRY, entry->lines); ++ char *linetitle = extractTitle(line); ++ ++ if (!linetitle) ++ continue; ++ if (strcmp(title, linetitle)) { ++ free(linetitle); ++ continue; ++ } ++ free(linetitle); ++ } ++ + line = getLineByType(LT_INITRD|LT_INITRD_EFI|LT_INITRD_16, entry->lines); + if (line) + removeLine(entry, line); +@@ -4335,7 +4364,7 @@ int main(int argc, const char ** argv) { + if (newKernelPath && !newKernelTitle) { + fprintf(stderr, _("grubby: kernel title must be specified\n")); + return 1; +- } else if (!newKernelPath && (newKernelTitle || copyDefault || ++ } else if (!newKernelPath && (copyDefault || + (newKernelInitrd && !updateKernelPath)|| + makeDefault || extraInitrdCount > 0)) { + fprintf(stderr, _("grubby: kernel path expected\n")); +@@ -4557,11 +4586,12 @@ int main(int argc, const char ** argv) { + if (updateKernelPath && newKernelInitrd) { + if (newMBKernel) { + if (addMBInitrd(config, newMBKernel, updateKernelPath, +- bootPrefix, newKernelInitrd)) ++ bootPrefix, newKernelInitrd, ++ newKernelTitle)) + return 1; + } else { + if (updateInitrd(config, updateKernelPath, bootPrefix, +- newKernelInitrd)) ++ newKernelInitrd, newKernelTitle)) + return 1; + } + } +-- +1.9.3 + diff --git a/SOURCES/0015-If-we-re-on-a-zipl-based-platform-use-banner-passed-.patch b/SOURCES/0015-If-we-re-on-a-zipl-based-platform-use-banner-passed-.patch new file mode 100644 index 0000000..0da9743 --- /dev/null +++ b/SOURCES/0015-If-we-re-on-a-zipl-based-platform-use-banner-passed-.patch @@ -0,0 +1,55 @@ +From f4ba2c9deba2a6575668c1c602621b3f596a7ea6 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 22 Jan 2014 17:16:06 -0500 +Subject: [PATCH 15/16] If we're on a zipl-based platform, use --banner passed + to us (sanitized.) + +"lilo" type bootloaders have gotten $version as their title since +forever, but on zipl that'll cause collisions when creating extra boot +images with the same version. So on that platform, choose to honor +--banner even though it has a lot of limitations, and attempt to get rid +of spaces in the result to avoid some of those problems. + +Related: rhbz#1032048 + +Signed-off-by: Peter Jones +--- + new-kernel-pkg | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index fe0d55a..d9a9b67 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -186,10 +186,16 @@ install() { + + + if [ -n "$banner" ]; then +- title="$banner ($version)" ++ if [ $ARCH = 's390' -o $ARCH = 's390x' ]; then ++ title=$(echo $banner | sed 's/ /_/g') ++ else ++ title="$banner ($version)" ++ fi ++ elif [ $ARCH = 's390' -o $ARCH = 's390x' ]; then ++ title=$(echo $version | sed 's/ /_/g') + elif [ -f /etc/os-release ]; then +- . /etc/os-release +- title="$NAME ($version) $VERSION" ++ . /etc/os-release ++ title="$NAME ($version) $VERSION" + elif [ -f /etc/redhat-release ]; then + title="$(sed 's/ release.*$//' < /etc/redhat-release) ($version)" + else +@@ -237,7 +243,7 @@ install() { + [ -n "$verbose" ] && echo "adding $version to $liloConfig" + + $grubby --add-kernel=$kernelImage $INITRD \ +- --copy-default $makedefault --title $version \ ++ --copy-default $makedefault --title "$title" \ + ${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ + --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$version" \ + --$liloFlag +-- +1.9.3 + diff --git a/SOURCES/0016-Conditionally-create-debug-entries-when-installing-k.patch b/SOURCES/0016-Conditionally-create-debug-entries-when-installing-k.patch new file mode 100644 index 0000000..18af0f4 --- /dev/null +++ b/SOURCES/0016-Conditionally-create-debug-entries-when-installing-k.patch @@ -0,0 +1,310 @@ +From 3639952b57652657a316de0d170d93fc7a34b20a Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 15 Sep 2014 15:20:34 -0400 +Subject: [PATCH 16/16] Conditionally create debug entries when installing + kernels. + +if /etc/sysconfig/kernel has MAKEDEBUG set to "yes", create non-default +entries that have systemd.debug set. + +Resolves: rhbz#957681 +Signed-off-by: Peter Jones +--- + new-kernel-pkg | 190 ++++++++++++++++++++++++++++++++++++--------------------- + 1 file changed, 119 insertions(+), 71 deletions(-) + +diff --git a/new-kernel-pkg b/new-kernel-pkg +index d9a9b67..70f6118 100755 +--- a/new-kernel-pkg ++++ b/new-kernel-pkg +@@ -50,6 +50,7 @@ grubConfig="" + grub2Config="" + grub2EfiConfig="" + extlinuxConfig="" ++ubootScript="/boot/boot.scr" + + ARCH=$(uname -m) + +@@ -120,6 +121,7 @@ mbkernel="$HYPERVISOR" + mbargs="$HYPERVISOR_ARGS" + adddracutargs="" + addplymouthinitrd="" ++DEBUGARG="systemd.debug" + + usage() { + echo "Usage: `basename $0` [-v] [--mkinitrd] [--rminitrd] [--dracut]" >&2 +@@ -134,6 +136,41 @@ usage() { + exit 1 + } + ++rungrubby() { ++ if [ "$1" == "--debug" ]; then ++ [ "$MAKEDEBUG" != "yes" ] && return 0 ++ [ -n "$verbose" ] && echo "- First, making a debug entry." ++ declare -x debugtitle=" with debugging" ++ declare -x debugargs="$DEBUGARG" ++ shift ++ else ++ [ -n "$verbose" ] && echo "- Making a normal entry." ++ fi ++ $(eval $grubby $@) ++ export -n debugargs ++ export -n debugtitle ++ unset debugargs ++ unset debugtitle ++} ++ ++set_title() { ++ if [ -n "$banner" ]; then ++ if [ $ARCH = 's390' -o $ARCH = 's390x' ]; then ++ title=$(echo $banner | sed 's/ /_/g') ++ else ++ title="$banner ($version)" ++ fi ++ elif [ $ARCH = 's390' -o $ARCH = 's390x' ]; then ++ title=$(echo $version | sed 's/ /_/g') ++ elif [ -f /etc/os-release ]; then ++ . /etc/os-release ++ title="$NAME ($version) $VERSION" ++ elif [ -f /etc/redhat-release ]; then ++ title="$(sed 's/ release.*$//' < /etc/redhat-release) ($version)" ++ else ++ title="Red Hat Linux ($version)" ++ fi ++} + + install() { + # XXX kernel should be able to be specified also (or work right on ia64) +@@ -184,57 +221,49 @@ install() { + cfgLilo="" + fi + +- +- if [ -n "$banner" ]; then +- if [ $ARCH = 's390' -o $ARCH = 's390x' ]; then +- title=$(echo $banner | sed 's/ /_/g') +- else +- title="$banner ($version)" +- fi +- elif [ $ARCH = 's390' -o $ARCH = 's390x' ]; then +- title=$(echo $version | sed 's/ /_/g') +- elif [ -f /etc/os-release ]; then +- . /etc/os-release +- title="$NAME ($version) $VERSION" +- elif [ -f /etc/redhat-release ]; then +- title="$(sed 's/ release.*$//' < /etc/redhat-release) ($version)" +- else +- title="Red Hat Linux ($version)" +- fi +- ++ set_title + + if [ -n "$cfgGrub" ]; then + [ -n "$verbose" ] && echo "adding $version to $grubConfig" + +- $grubby --grub -c $grubConfig \ +- --add-kernel=$kernelImage \ +- $INITRD --copy-default $makedefault --title "$title" \ +- ${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ +- --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title" ++ ARGS="--grub -c $grubConfig --add-kernel=$kernelImage $INITRD \ ++ ${mbkernel:+--add-multiboot=\"$mbkernel\"} \ ++ ${mbargs:+--mbargs=\"$mbargs\"} \ ++ --title=\"$title\$debugtitle\" --copy-default \ ++ --args=\"root=$rootdevice $kernargs \$debugargs\" \ ++ --remove-kernel=\"TITLE=$title\$debugtitle\"" ++ ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} $makedefault + else + [ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby for grub 0.97" + fi + if [ -n "$cfgGrub2" ]; then + [ -n "$verbose" ] && echo "adding $version to $grub2Config" + +- $grubby --grub2 -c $grub2Config \ +- --add-kernel=$kernelImage \ +- $INITRD --copy-default $makedefault --title "$title" \ +- ${mbkernel:+--add-multiboot="$mbkernel"} \ +- ${mbargs:+--mbargs="$mbargs"} \ +- --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title" ++ ARGS="--grub2 -c $grub2Config --add-kernel=$kernelImage $INITRD \ ++ --copy-default --title \"$title\$debugtitle\" \ ++ ${mbkernel:+--add-multiboot=\"$mbkernel\"} \ ++ ${mbargs:+--mbargs=\"$mbargs\"} \ ++ --args=\"root=$rootdevice $kernargs \$debugargs\" \ ++ --remove-kernel=\"TITLE=$title\$debugtitle\"" ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} $makedefault + else + [ -n "$verbose" ] && echo "$grub2Config does not exist, not running grubby for grub 2" + fi + if [ -n "$cfgGrub2Efi" ]; then + [ -n "$verbose" ] && echo "adding $version to $grub2EfiConfig" + +- $grubby --grub2 -c $grub2EfiConfig --efi \ +- --add-kernel=$kernelImage $DEVTREE \ +- $INITRD --copy-default $makedefault --title "$title" \ +- ${mbkernel:+--add-multiboot="$mbkernel"} \ +- ${mbargs:+--mbargs="$mbargs"} \ +- --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title" ++ ARGS="--grub2 -c $grub2EfiConfig --efi \ ++ --add-kernel=$kernelImage $DEVTREE $INITRD \ ++ --copy-default --title \"$title\$debugtitle\" \ ++ ${mbkernel:+--add-multiboot=\"$mbkernel\"} \ ++ ${mbargs:+--mbargs=\"$mbargs\"} \ ++ --args=\"root=$rootdevice $kernargs \$debugargs\" \ ++ --remove-kernel=\"TITLE=$title\$debugtitle\"" ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} $makedefault + else + [ -n "$verbose" ] && echo "$grub2EfiConfig does not exist, not running grubby for grub 2 with UEFI" + fi +@@ -242,12 +271,15 @@ install() { + if [ -n "$cfgLilo" ]; then + [ -n "$verbose" ] && echo "adding $version to $liloConfig" + +- $grubby --add-kernel=$kernelImage $INITRD \ +- --copy-default $makedefault --title "$title" \ +- ${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ +- --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$version" \ +- --$liloFlag ++ ARGS="--$liloFlag --add-kernel=$kernelImage $INITRD \ ++ --copy-default --title \"$title\$debugtitle\" \ ++ ${mbkernel:+--add-multiboot=\"$mbkernel\"} \ ++ ${mbargs:+--mbargs=\"$mbargs\"} \ ++ --args=\"root=$rootdevice $kernargs \$debugargs\" \ ++ --remove-kernel=\"TITLE=$version\"" + ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} $makedefault + if [ -n "$runLilo" ]; then + [ -n "$verbose" ] && echo "running $lilo" + if [ ! -x $lilo ] ; then +@@ -263,11 +295,15 @@ install() { + if [ -n "$cfgExtlinux" ]; then + [ -n "$verbose" ] && echo "adding $version to $extlinuxConfig" + +- $grubby --extlinux -c $extlinuxConfig \ +- --add-kernel=$kernelImage \ +- $INITRD --copy-default $makedefault --title "$title" \ +- ${mbkernel:+--add-multiboot="$mbkernel"} ${mbargs:+--mbargs="$mbargs"} \ +- --args="root=$rootdevice $kernargs" --remove-kernel="TITLE=$title" ++ ARGS="--extlinux -c $extlinuxConfig --add-kernel=$kernelImage \ ++ $INITRD --copy-default --title \"$title\$debugtitle\" \ ++ ${mbkernel:+--add-multiboot=\"$mbkernel\"} \ ++ ${mbargs:+--mbargs=\"$mbargs\"} \ ++ --args=\"root=$rootdevice $kernargs \$debugargs\" \ ++ --remove-kernel=\"TITLE=$title\$debugtitle\"" ++ ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} $makedefault + else + [ -n "$verbose" ] && echo "$extlinuxConfig does not exist, not running grubby for extlinux" + fi +@@ -401,6 +437,8 @@ update() { + return + fi + ++ set_title ++ + INITRD="" + if [ -f $initrdfile ]; then + [ -n "$verbose" ] && echo "found $initrdfile and using it with grubby" +@@ -413,45 +451,53 @@ update() { + + if [ -n "$cfgGrub" ]; then + [ -n "$verbose" ] && echo "updating $version from $grubConfig" +- $grubby --grub -c $grubConfig \ +- --update-kernel=$kernelImage \ +- $INITRD \ +- ${kernargs:+--args="$kernargs"} \ +- ${removeargs:+--remove-args="$removeargs"} \ +- ${mbkernel:+--add-multiboot="$mbkernel"} ++ ARGS="--grub -c $grubConfig --update-kernel=$kernelImage $INITRD \ ++ ${kernargs:+--args=\"$kernargs\"} \ ++ ${removeargs:+--remove-args=\"$removeargs\"} \ ++ ${mbkernel:+--add-multiboot=\"$mbkernel\"} \ ++ --title=\"$title\$debugtitle\"" ++ ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} + else + [ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby" + fi + + if [ -n "$cfgGrub2" ]; then + [ -n "$verbose" ] && echo "updating $version from $grub2Config" +- $grubby --grub2 -c $grub2Config \ +- --update-kernel=$kernelImage \ +- $INITRD \ +- ${kernargs:+--args="$kernargs"} \ +- ${removeargs:+--remove-args="$removeargs"} ++ ARGS="--grub2 -c $grub2Config --update-kernel=$kernelImage $INITRD \ ++ ${kernargs:+--args=\"$kernargs\"} \ ++ ${removeargs:+--remove-args=\"$removeargs\"} \ ++ --title=\"$title\$debugtitle\"" ++ ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} + else + [ -n "$verbose" ] && echo "$grub2Config does not exist, not running grubby" + fi + + if [ -n "$cfgGrub2Efi" ]; then + [ -n "$verbose" ] && echo "updating $version from $grub2EfiConfig" +- $grubby --grub2 -c $grub2EfiConfig --efi \ +- --update-kernel=$kernelImage \ +- $INITRD \ +- ${kernargs:+--args="$kernargs"} \ +- ${removeargs:+--remove-args="$removeargs"} ++ ARGS="--grub2 -c $grub2EfiConfig --efi --update-kernel=$kernelImage \ ++ $INITRD ${kernargs:+--args=\"$kernargs\"} \ ++ ${removeargs:+--remove-args=\"$removeargs\"} \ ++ --title=\"$title\$debugtitle\"" ++ ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} + else + [ -n "$verbose" ] && echo "$grub2EfiConfig does not exist, not running grubby" + fi + + if [ -n "$cfgLilo" ]; then + [ -n "$verbose" ] && echo "updating $version from $liloConfig" +- $grubby --update-kernel=$kernelImage \ +- $INITRD \ +- ${kernargs:+--args="$kernargs"} \ +- ${removeargs:+--remove-args="$removeargs"} \ +- --$liloFlag ++ ARGS="--$liloFlag --update-kernel=$kernelImage $INITRD \ ++ ${kernargs:+--args=\"$kernargs\"} \ ++ ${removeargs:+--remove-args=\"$removeargs\"} \ ++ --title=\"$title\$debugtitle\"" ++ ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} + + if [ -n "$runLilo" ]; then + [ -n "$verbose" ] && echo "running $lilo" +@@ -497,11 +543,13 @@ update() { + + if [ -n "$cfgExtlinux" ]; then + [ -n "$verbose" ] && echo "updating $version from $extlinuxConfig" +- $grubby --extlinux -c $extlinuxConfig \ +- --update-kernel=$kernelImage \ +- $INITRD \ +- ${kernargs:+--args="$kernargs"} \ +- ${removeargs:+--remove-args="$removeargs"} ++ ARGS="--extlinux -c $extlinuxConfig --update-kernel=$kernelImage \ ++ $INITRD ${kernargs:+--args=\"$kernargs\"} \ ++ ${removeargs:+--remove-args=\"$removeargs\"} \ ++ --title=\"$title\$debugtitle\"" ++ ++ rungrubby --debug ${ARGS} ++ rungrubby ${ARGS} + else + [ -n "$verbose" ] && echo "$extlinuxConfig does not exist, not running grubby" + fi +-- +1.9.3 + diff --git a/SPECS/grubby.spec b/SPECS/grubby.spec index 24a6c94..0889e5c 100644 --- a/SPECS/grubby.spec +++ b/SPECS/grubby.spec @@ -1,16 +1,29 @@ Name: grubby Version: 8.28 -Release: 8%{?dist} +Release: 11%{?dist} Summary: Command line tool for updating bootloader configs Group: System Environment/Base License: GPLv2+ URL: http://git.fedorahosted.org/git/grubby.git Source0: https://git.fedorahosted.org/cgit/grubby.git/snapshot/%{name}-%{version}-1.tar.bz2 -Patch0: 0001-Use-PREFIX-during-make-install.patch -Patch1: 0001-Honor-linux16-and-initrd16.patch -Patch2: 0001-Only-set-RPM_OPT_FLAGS-if-undefined.patch -Patch3: 0001-Drop-SEGV-handler.patch -Patch4: 0001-Fix-a-crash-with-kernel.patch +Patch0001: 0001-Use-PREFIX-during-make-install.patch +Patch0002: 0002-Honor-linux16-and-initrd16.patch +Patch0003: 0003-Only-set-RPM_OPT_FLAGS-if-undefined.patch +Patch0004: 0004-Drop-SEGV-handler.patch +Patch0005: 0005-grub-Fix-a-crash-with-kernel-line-without-being-prec.patch +Patch0006: 0006-Support-devicetree-directive-in-grub2.patch +Patch0007: 0007-Actually-USE-DEVTREE-in-new-kernel-pkg.patch +Patch0008: 0008-Fix-bad-check-for-new-kernel-pkg-s-command-line-argu.patch +Patch0009: 0009-Actually-do-a-fix-for-rhbz-1082318-that-fixes-the-is.patch +Patch0010: 0010-Use-the-correct-load-commands-for-aarch64-efi.patch +Patch0011: 0011-Tell-a-slightly-better-fib-about-default-bootloader-.patch +Patch0012: 0012-Make-findTemplate-actually-return-the-saved-default.patch +Patch0013: 0013-If-we-re-using-multiboot-add-a-new-mbmodule-not-an-i.patch +Patch0014: 0014-Support-filtering-update-kernel-by-title-as-well.patch +Patch0015: 0015-If-we-re-on-a-zipl-based-platform-use-banner-passed-.patch +Patch0016: 0016-Conditionally-create-debug-entries-when-installing-k.patch +Patch0017: 0001-Don-t-put-spaces-in-debug-entries-on-zipl-platforms.patch +Patch0018: 0002-Strdup-the-right-place-in-title-extraction.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: pkgconfig glib2-devel popt-devel @@ -43,6 +56,8 @@ 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 @@ -71,12 +87,32 @@ rm -rf $RPM_BUILD_ROOT %{_prefix}/sbin/new-kernel-pkg %{_prefix}/sbin/grubby %{_mandir}/man8/*.8* +%ghost %config(noreplace) %{_sysconfdir}/sysconfig/kernel %ifarch %{arm} %config(noreplace) %{_sysconfdir}/sysconfig/uboot %config(noreplace) /boot/boot.scr %endif %changelog +* Tue Nov 11 2014 Peter Jones - 8.28-11 +- Fix a memory corruption issue we're hitting on s390/s390x + Resolves: rhbz#1152152 +- Don't use spaces on zipl platforms to describe debugging entries + Related: rhbz#1152152 + +* Thu Sep 25 2014 Peter Jones - 8.28-10 +- Use the correct load commands for aarch64 efi. + Resolves: rhbz#1081269 +- Support "devicetree" directive in grub2. + Resolves: rhbz#1063534 +- Explain the default bootloaders and configuration paths slightly better + in the manual. + Resolves: rhbz#1001664 +- Conditionally create debug entries when installing kernels. + Resolves: rhbz#957681 +- Make sure --banner from the command line is used correctly. + Resolves: rhbz#1032048 + * Thu Mar 06 2014 Peter Jones - 8.28-8 - Fix crash when config file doesn't match command line. Related: rhbz#1070646