|
|
56d25d |
From e19e664d4fcb1637f8ba4a4a088454acf2f94334 Mon Sep 17 00:00:00 2001
|
|
|
775cb0 |
From: Peter Jones <pjones@redhat.com>
|
|
|
775cb0 |
Date: Thu, 12 Sep 2013 20:41:33 +0200
|
|
|
56d25d |
Subject: [PATCH 02/41] If we're using multiboot, add a new mbmodule not an
|
|
|
775cb0 |
initramfs
|
|
|
775cb0 |
|
|
|
775cb0 |
I really don't know how this ever worked.
|
|
|
775cb0 |
Related: rhbz#957681
|
|
|
775cb0 |
|
|
|
775cb0 |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
775cb0 |
---
|
|
|
775cb0 |
grubby.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
|
|
|
775cb0 |
new-kernel-pkg | 3 ++-
|
|
|
775cb0 |
2 files changed, 47 insertions(+), 3 deletions(-)
|
|
|
775cb0 |
|
|
|
775cb0 |
diff --git a/grubby.c b/grubby.c
|
|
|
56d25d |
index bbca9d0..d91a847 100644
|
|
|
775cb0 |
--- a/grubby.c
|
|
|
775cb0 |
+++ b/grubby.c
|
|
|
56d25d |
@@ -3255,6 +3255,42 @@ int updateImage(struct grubConfig * cfg, const char * image,
|
|
|
775cb0 |
return rc;
|
|
|
775cb0 |
}
|
|
|
775cb0 |
|
|
|
775cb0 |
+int addMBInitrd(struct grubConfig * cfg, const char *newMBKernel,
|
|
|
775cb0 |
+ const char * image, const char * prefix, const char * initrd) {
|
|
|
775cb0 |
+ struct singleEntry * entry;
|
|
|
775cb0 |
+ struct singleLine * line, * kernelLine, *endLine = NULL;
|
|
|
775cb0 |
+ int index = 0;
|
|
|
775cb0 |
+
|
|
|
775cb0 |
+ if (!image) return 0;
|
|
|
775cb0 |
+
|
|
|
775cb0 |
+ for (; (entry = findEntryByPath(cfg, newMBKernel, prefix, &index)); index++) {
|
|
|
775cb0 |
+ kernelLine = getLineByType(LT_MBMODULE, entry->lines);
|
|
|
775cb0 |
+ if (!kernelLine) continue;
|
|
|
775cb0 |
+
|
|
|
775cb0 |
+ if (prefix) {
|
|
|
775cb0 |
+ int prefixLen = strlen(prefix);
|
|
|
775cb0 |
+ if (!strncmp(initrd, prefix, prefixLen))
|
|
|
775cb0 |
+ initrd += prefixLen;
|
|
|
775cb0 |
+ }
|
|
|
775cb0 |
+ endLine = getLineByType(LT_ENTRY_END, entry->lines);
|
|
|
775cb0 |
+ if (endLine)
|
|
|
775cb0 |
+ removeLine(entry, endLine);
|
|
|
775cb0 |
+ line = addLine(entry, cfg->cfi, preferredLineType(LT_MBMODULE,cfg->cfi),
|
|
|
775cb0 |
+ kernelLine->indent, initrd);
|
|
|
775cb0 |
+ if (!line)
|
|
|
775cb0 |
+ return 1;
|
|
|
775cb0 |
+ if (endLine) {
|
|
|
775cb0 |
+ line = addLine(entry, cfg->cfi, LT_ENTRY_END, "", NULL);
|
|
|
775cb0 |
+ if (!line)
|
|
|
775cb0 |
+ return 1;
|
|
|
775cb0 |
+ }
|
|
|
775cb0 |
+
|
|
|
775cb0 |
+ break;
|
|
|
775cb0 |
+ }
|
|
|
775cb0 |
+
|
|
|
775cb0 |
+ return 0;
|
|
|
775cb0 |
+}
|
|
|
775cb0 |
+
|
|
|
775cb0 |
int updateInitrd(struct grubConfig * cfg, const char * image,
|
|
|
775cb0 |
const char * prefix, const char * initrd) {
|
|
|
775cb0 |
struct singleEntry * entry;
|
|
|
56d25d |
@@ -4496,8 +4532,15 @@ int main(int argc, const char ** argv) {
|
|
|
775cb0 |
if (updateImage(config, updateKernelPath, bootPrefix, newKernelArgs,
|
|
|
775cb0 |
removeArgs, newMBKernelArgs, removeMBKernelArgs)) return 1;
|
|
|
775cb0 |
if (updateKernelPath && newKernelInitrd) {
|
|
|
775cb0 |
- if (updateInitrd(config, updateKernelPath, bootPrefix,
|
|
|
775cb0 |
- newKernelInitrd)) return 1;
|
|
|
775cb0 |
+ if (newMBKernel) {
|
|
|
775cb0 |
+ if (addMBInitrd(config, newMBKernel, updateKernelPath,
|
|
|
775cb0 |
+ bootPrefix, newKernelInitrd))
|
|
|
775cb0 |
+ return 1;
|
|
|
775cb0 |
+ } else {
|
|
|
775cb0 |
+ if (updateInitrd(config, updateKernelPath, bootPrefix,
|
|
|
775cb0 |
+ newKernelInitrd))
|
|
|
775cb0 |
+ return 1;
|
|
|
775cb0 |
+ }
|
|
|
775cb0 |
}
|
|
|
775cb0 |
if (addNewKernel(config, template, bootPrefix, newKernelPath,
|
|
|
775cb0 |
newKernelTitle, newKernelArgs, newKernelInitrd,
|
|
|
775cb0 |
diff --git a/new-kernel-pkg b/new-kernel-pkg
|
|
|
56d25d |
index 7fec1fe..6373385 100755
|
|
|
775cb0 |
--- a/new-kernel-pkg
|
|
|
775cb0 |
+++ b/new-kernel-pkg
|
|
|
56d25d |
@@ -404,7 +404,8 @@ update() {
|
|
|
775cb0 |
--update-kernel=$kernelImage \
|
|
|
775cb0 |
$INITRD \
|
|
|
775cb0 |
${kernargs:+--args="$kernargs"} \
|
|
|
775cb0 |
- ${removeargs:+--remove-args="$removeargs"}
|
|
|
775cb0 |
+ ${removeargs:+--remove-args="$removeargs"} \
|
|
|
775cb0 |
+ ${mbkernel:+--add-multiboot="$mbkernel"}
|
|
|
775cb0 |
else
|
|
|
775cb0 |
[ -n "$verbose" ] && echo "$grubConfig does not exist, not running grubby"
|
|
|
775cb0 |
fi
|
|
|
775cb0 |
--
|
|
|
56d25d |
2.4.3
|
|
|
775cb0 |
|