diff --git a/.grubby.metadata b/.grubby.metadata new file mode 100644 index 0000000..55ae099 --- /dev/null +++ b/.grubby.metadata @@ -0,0 +1 @@ +7f5d3eb0c5dc91158864d8acaadf21441ce8ac41 SOURCES/grubby-8.28.tar.bz2 diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-Honor-linux16-and-initrd16.patch b/SOURCES/0001-Honor-linux16-and-initrd16.patch new file mode 100644 index 0000000..5b00667 --- /dev/null +++ b/SOURCES/0001-Honor-linux16-and-initrd16.patch @@ -0,0 +1,632 @@ +From 2f05c14de6ef2cf27816f64f3cbc80903ecef3b1 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 + +Signed-off-by: Peter Jones +--- + grubby.c | 61 +++++++++++++++++++++--------- + test.sh | 9 +++++ + 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, 428 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..96f2dd0 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,15 @@ static enum lineType_e preferredLineType(enum lineType_e type, + default: + return type; + } ++ } else if (cfi == &grub2ConfigType) { ++ switch (type) { ++ case LT_KERNEL: ++ return LT_KERNEL_16; ++ case LT_INITRD: ++ return LT_INITRD_16; ++ default: ++ return type; ++ } + } + return type; + } +@@ -1806,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; +@@ -1940,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]; +@@ -1991,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 */ +@@ -2015,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! */ + } + +@@ -2249,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; +@@ -2314,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))) +@@ -2731,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); +@@ -3101,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; +@@ -3302,10 +3315,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 +3329,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 +3941,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 +4500,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..0dab284 100755 +--- a/test.sh ++++ b/test.sh +@@ -461,10 +461,19 @@ if [ "$testgrub2" == "y" ]; then + --title='title' --initrd=/boot/new-initrd --boot-filesystem=/boot/ \ + --copy-default + ++ 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" + grub2Test grub2.2 add/g2-1.4 --update-kernel=/boot/new-kernel.img \ + --initrd=/boot/new-initrd --boot-filesystem=/boot/ + ++ 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/ ++ + testing="GRUB2 display default index" + grub2DisplayTest grub2.1 defaultindex/0 --default-index + grub2DisplayTest grub2.2 defaultindex/0 --default-index +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.3.1 + diff --git a/SOURCES/0001-Use-PREFIX-during-make-install.patch b/SOURCES/0001-Use-PREFIX-during-make-install.patch new file mode 100644 index 0000000..5607533 --- /dev/null +++ b/SOURCES/0001-Use-PREFIX-during-make-install.patch @@ -0,0 +1,34 @@ +From 57944dd96c2c14cac66ec29e99500357c189f8e7 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. + +Signed-off-by: Peter Jones +--- + Makefile | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile b/Makefile +index 5dbf0f7..ad83c33 100644 +--- a/Makefile ++++ b/Makefile +@@ -44,12 +44,12 @@ test: all + install: all +- mkdir -p $(DESTDIR)/sbin ++ mkdir -p $(DESTDIR)$(PREFIX)/sbin + mkdir -p $(DESTDIR)/$(mandir)/man8 +- install -m 755 new-kernel-pkg $(DESTDIR)/sbin ++ install -m 755 new-kernel-pkg $(DESTDIR)$(PREFIX)/sbin + install -m 644 new-kernel-pkg.8 $(DESTDIR)/$(mandir)/man8 +- install -m 755 installkernel $(DESTDIR)/sbin ++ install -m 755 installkernel $(DESTDIR)$(PREFIX)/sbin + install -m 644 installkernel.8 $(DESTDIR)/$(mandir)/man8 + if [ -f grubby ]; then \ +- install -m 755 grubby $(DESTDIR)/sbin ; \ ++ install -m 755 grubby $(DESTDIR)$(PREFIX)/sbin ; \ + install -m 644 grubby.8 $(DESTDIR)/$(mandir)/man8 ; \ + fi + +-- +1.8.3.1 + diff --git a/SPECS/grubby.spec b/SPECS/grubby.spec new file mode 100644 index 0000000..f25190d --- /dev/null +++ b/SPECS/grubby.spec @@ -0,0 +1,346 @@ +Name: grubby +Version: 8.28 +Release: 3%{?dist} +Summary: Command line tool for updating bootloader configs +Group: System Environment/Base +License: GPLv2+ +URL: http://git.fedorahosted.org/git/grubby.git +# we only pull git snaps at the moment +# 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 +Patch0: 0001-Use-PREFIX-during-make-install.patch +Patch1: 0001-Honor-linux16-and-initrd16.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: pkgconfig glib2-devel popt-devel +BuildRequires: libblkid-devel git +# for make test / getopt: +BuildRequires: util-linux-ng +%ifarch aarch64 i686 x86_64 ppc ppc64 +BuildRequires: /usr/bin/grub2-editenv +%endif +%ifarch s390 s390x +Requires: s390utils-base +%endif +%ifarch %{arm} +Requires: uboot-tools +%endif + +%description +grubby is a command line tool for updating and displaying information about +the configuration files for the grub, lilo, elilo (ia64), yaboot (powerpc) +and zipl (s390) boot loaders. It is primarily designed to be used from scripts +which install new kernels and need to find information about the current boot +environment. + +%prep +%setup -q + +git init +git config user.email "noone@example.com" +git config user.name "no one" +git add . +git commit -a -q -m "%{version} baseline" +git am %{patches} > $RPM_BUILD_ROOT/boot/boot.scr +%endif + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root,-) +%doc COPYING +%{_prefix}/sbin/installkernel +%{_prefix}/sbin/new-kernel-pkg +%{_prefix}/sbin/grubby +%{_mandir}/man8/*.8* +%ifarch %{arm} +%config(noreplace) %{_sysconfdir}/sysconfig/uboot +%config(noreplace) /boot/boot.scr +%endif + +%changelog +* Mon Nov 18 2013 Peter Jones - 8.28-3 +- Honor linux16 and initrd16 in grub.cfg + Resolves: rhbz#1031192 + +* Fri Sep 13 2013 Peter Jones - 8.28-2 +- Use %%{_prefix} during "make install" (rpmdiff) + +* Fri Aug 02 2013 Peter Jones - 8.28-1 +- More work on grub's "saved_entry" system. + Resolves: rhbz#808021 + +* Tue Jul 30 2013 Peter Jones - 8.27-1 +- Make grubby understand grub's "saved_entry" system + Resolves: rhbz#808021 +- BuildRequire grub2 on appropriate platforms, for the test suite. + Related: rhbz#808021 + +* Fri Jun 07 2013 Dennis Gilmore - 8.26-2 +- add patch to update extlinux.conf file on arm if it exists + +* Fri May 10 2013 Peter Jones - 8.26-1 +- Conditionally call arm-boot-config's boot.scr generator if available + Resolves: rhbz#952428 + +* Tue Apr 09 2013 Peter Jones - 8.25-1 +- Error instead of segfaulting if we can't find any working config + Resolves: rhbz#912873 + Resolves: rhbz#751608 + +* Tue Mar 19 2013 Peter Jones - 8.24-1 +- Fix module remove code from Harald (#923441) + +* Mon Mar 11 2013 Peter Jones - 8.23-1 +- Update to 8.23 +- Fix empty root device in case of an empty /etc/fstab (lemenkov) +- General refactoring and cleanup (harald) +- Don't clean up modules.* so aggressively (harald) + +* Wed Feb 20 2013 Peter Jones - 8.22-3 +- Add --debug style logging (for both success and failures) to /var/log/grubby + +* Thu Feb 14 2013 Fedora Release Engineering - 8.22-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Fri Jan 04 2013 Peter Jones - 8.22-1 +- Revert test case for rhbz#742885 - it's a work in progress that isn't + ready yet. + +* Fri Jan 04 2013 Peter Jones - 8.21-1 +- Use systemd vconsole.conf and locale.conf if present + Resolves rhbz#881908 +- Avoid unnecessary stat calls (from Ville Skyttä) + Resolves rhbz#741135 +- Spelling fixes (Ville Skyttä) +- Add a test case for rhbz#742885 +- Handle case-insensitive extlinux config files properly (from Johannes Weiner) + +* Tue Oct 02 2012 Peter Jones - 8.20-1 +- Handle linuxefi initrd and removal correctly. + Resolves: rhbz#859285 + +* Wed Sep 26 2012 Peter Jones - 8.19-1 +- Don't accidentally migrate from linuxefi back to linux + Related: rhbz#859285 + +* Fri Sep 21 2012 Peter Jones - 8.18-1 +- Change the way the kernel load address is determined for ARM U-Boot. + +* Wed Aug 08 2012 Peter Jones - 8.17-1 +- Update to 8.17 +- Fixes a "make test" failure. + +* Wed Aug 08 2012 Peter Jones - 8.16-1 +- Update to 8.16 +- Handle "linuxefi" directive on grub2/uefi machines. + +* Thu Jul 19 2012 Fedora Release Engineering - 8.15-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jun 25 2012 Peter Jones - 8.15-1 +- Update to 8.15 +- Revert dirname change from 8.13; it was wrong. + +* Thu Jun 14 2012 Peter Jones - 8.14-1 +- Update to 8.14 to fix a build problem. + +* Thu Jun 14 2012 Peter Jones - 8.13-1 +- Update to 8.13 +- Add some more ARM tweaks (dmartin) +- Better support for other distros (crosa) + +* Tue Jun 12 2012 Peter Jones - 8.12-2 +- Support UBOOT_IMGADDR override on ARM (blc) + +* Thu May 31 2012 Peter Jones - 8.12-1 +- Update to 8.12 +- Preserve trailing indentation when splitting line elements (mads) + Resolves: rhbz#742720 +- Pick last device mounted on / (pjones,bcl) + Related: rhbz#820340 + Related: rhbz#820351 + +* Wed Mar 21 2012 Peter Jones - 8.11-1 +- Update to 8.11 + Resolves: rhbz#805310 + +* Thu Mar 15 2012 Peter Jones - 8.10-1 +- Update to 8.10 +- Use "isquote" where appropriate +- Make --remove-kenrel support titles in grub2 (jianzhong.huang) +- Use grub2 if it's there on ppc. + +* Fri Mar 02 2012 Peter Jones - 8.9-1 +- Refactor grub2 title extraction, making it a function (Cleber Rosa) +- Include prefix when printing kernel information (Cleber Rosa) +- Implement support for "default saved" for grub2 (Cleber Rosa) +- Try to display title when printing information with '--info' (Cleber Rosa) +- new-kernel-pkg fails to find U-Boot. (D. Marlin) +- Add support to new-kernel-pkg to recognize ARCH == armv5tel needed for Kir + (D.Marlin) +- Include a / when one is missing in paths (#769641) +- Fix hard coded paths so kernel's "make install" will DTRT. +- Fix endswith() to correctly test its input for validity. + +* Tue Feb 07 2012 Dennis Gilmore - 8.8-3 +- add uboot-tools requires on arm arches +- add uboot config file on arm arches + +* Fri Jan 13 2012 Fedora Release Engineering - 8.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Tue Dec 20 2011 Peter Jones - 8.8-1 +- Fix test cases from 8.7 to work on a system without /boot mounted. + +* Tue Dec 20 2011 Peter Jones - 8.7-1 +- Add a --debug to try to help diagnose "No suitable template". (sandeen,pjones) + +* Mon Dec 19 2011 Peter Jones - 8.6-1 +- Fix a "make test" errors introduced in 8.4-1 + +* Sat Dec 17 2011 Peter Jones - 8.5-1 +- Don't hardcode dracut path + Resolves: #768645 + +* Thu Dec 08 2011 Adam Williamson - 8.4-1 +- Update to 8.4: + + fix Loading... line for updated kernels + + Add new '--default-title' feature + + Add new '--default-index' feature + + add feature for testing the output of a grubby command + + Fix detection when comparing stage1 to MBR + + do not link against glib-2.0 + + Don't crash if grubConfig not found + + Adding extlinux support for new-kernel-pkg + + Look for Debian / Ubuntu grub config files (#703260) + + Make grubby recognize Ubuntu's spin of Grub2 (#703260) + +* Thu Sep 29 2011 Peter Jones - 8.3-1 +- Fix new-kernel-pkg invocation of grubby for grub (patch from Mads Kiilerich) + Resolves: rhbz#725185 + +* Wed Sep 14 2011 Peter Jones - 8.2-1 +- Fixes for xen (from Michael Petullo) + Resolves: rhbz#658387 + +* Fri Jul 22 2011 Peter Jones - 8.1-1 +- Update to 8.1 +- Fix miss-spelled variable name in new-kernel-pkg + +* Thu Jul 21 2011 Peter Jones - 8.0-1 +- Add support for grub2. + +* Tue Jun 07 2011 Brian C. Lane - 7.0.18-1 +- Bump version to 7.0.18 (bcl) +- Fixup new-kernel-pkg errors (#711493) (bcl) + +* Mon Jun 06 2011 Peter Jones - 7.0.17-1 +- Fix references to wrong program name in new-kernel-pkg.8 + Resolves: rhbz#663981 + +* Wed Feb 09 2011 Fedora Release Engineering - 7.0.16-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Mon Jan 24 2011 Karsten Hopp 7.0.16-2 +- add BR utils-linux-ng for getopt + +* Tue Jul 13 2010 Brian C. Lane - 7.0.16-1 +- Update to 7.0.16 +- Add patch to check the return value of getuuidbydev +- Resolves: rhbz#592294 + +* Wed Apr 14 2010 Peter Jones - 7.0.15-1 +- Update to 7.0.15 +- Add man pages for installkernel and new-kernel-pkg + Resolves: rhbz#529333 + +* Wed Apr 14 2010 Peter Jones - 7.0.14-1 +- Update to 7.0.14 + +* Thu Feb 11 2010 Peter Jones - 7.0.13-1 +- Strip boot partition prefix from initrd path if present during --update. + Related: rhbz#557922 +- add host only support for local kernel compiles (airlied) + +* Mon Feb 08 2010 Peter Jones - 7.0.12-1 +- compare rootdev using uuid instead of stat, for better btrfs support (josef) + Resolves: rhbz#530108 + +* Mon Feb 08 2010 Peter Jones - 7.0.11-1 +- Make it possible to update the initrd without any other change. + Related: rhbz#557922 + +* Fri Feb 05 2010 Peter Jones - 7.0.10-1 +- Make --update able to add an initramfs. + Related: rhbz#557922 + +* Mon Nov 30 2009 Peter Jones - 7.0.9-3 +- Use s390utils-base as the s390 dep, not s390utils + Related: rhbz#540565 + +* Tue Nov 24 2009 Peter Jones - 7.0.9-2 +- Add s390utils dep when on s390, since new-kernel-package needs it. + Resolves: rhbz#540565 + +* Fri Oct 30 2009 Peter Jones - 7.0.9-1 +- Add support for dracut to installkernel (notting) + +* Thu Oct 1 2009 Hans de Goede - 7.0.8-1 +- Stop using nash + +* Fri Sep 11 2009 Hans de Goede - 7.0.7-1 +- Remove writing rd_plytheme=$theme to kernel args in dracut mode (hansg) +- Add a couple of test cases for extra initrds (rstrode) +- Allow tmplLine to be NULL in getInitrdVal (rstrode) + +* Fri Sep 11 2009 Peter Jones - 7.0.6-1 +- Fix test case breakage from 7.0.5 (rstrode) + +* Fri Sep 11 2009 Peter Jones - 7.0.5-1 +- Add support for plymouth as a second initrd. (rstrode) + Resolves: rhbz#520515 + +* Wed Sep 09 2009 Hans de Goede - 7.0.4-1 +- Add --dracut cmdline argument for %post generation of dracut initrd + +* Wed Aug 26 2009 Hans de Goede - 7.0.3-1 +- Silence error when no /etc/sysconfig/keyboard (#517187) + +* Fri Aug 7 2009 Hans de Goede - 7.0.2-1 +- Add --add-dracut-args new-kernel-pkg cmdline option + +* Fri Jul 24 2009 Fedora Release Engineering - 7.0.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri Jul 17 2009 Jeremy Katz - 7.0.1-1 +- Fix blkid usage (#124246) + +* Wed Jun 24 2009 Jeremy Katz - 7.0-1 +- BR libblkid-devel now instead of e2fsprogs-devel +- Add bits to switch to using dracut for new-kernel-pkg + +* Wed Jun 3 2009 Jeremy Katz - 6.0.86-2 +- add instructions for checking out from git + +* Tue Jun 2 2009 Jeremy Katz - 6.0.86-1 +- initial build after splitting out from mkinitrd +