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