grubby/0003-grubby-fix-initrd-upda...

38 lines
1.4 KiB
Diff

From e91855ce14df65d12f681c15dfba5b22a2b4a061 Mon Sep 17 00:00:00 2001
From: Junxiao Bi <junxiao.bi@oracle.com>
Date: Wed, 14 May 2014 16:44:21 +0800
Subject: [PATCH 03/10] grubby: fix initrd updating when multiboot exist
When using the following command to add an initrd for the kernel.
grubby --update-kernel=/boot/vmlinuz-2.6.32-431.17.1.el6.x86_64.debug
--initrd /boot/initramfs-2.6.32-431.17.1.el6.x86_64.debug.img
--add-multiboot=/boot/tboot.gz
The multiboot image /boot/tboot.gz is used as the key to search the
configure entry in grub.conf, this is wrong. There may be other kernels
also configure multiboot with the same name tboot.gz, if there index are
smaller than the target one, then that will make the initrd added to the
wrong kernel. Fix it to use kernel name as the search key.
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Reviewed-by: John Haxby <john.haxby@oracle.com>
---
grubby.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grubby.c b/grubby.c
index db91364..118cb84 100644
--- a/grubby.c
+++ b/grubby.c
@@ -3311,7 +3311,7 @@ int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel,
if (!image) return 0;
- for (; (entry = findEntryByPath(cfg, newMBKernel, prefix, &index)); index++) {
+ for (; (entry = findEntryByPath(cfg, image, prefix, &index)); index++) {
kernelLine = getLineByType(LT_MBMODULE, entry->lines);
if (!kernelLine) continue;
--
1.9.3