|
|
a85e8e |
From cab5d30d4cb182ee9dfd03079b415e1e0285de99 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu@vr-web.de>
|
|
|
a85e8e |
Date: Mon, 20 Jul 2015 14:06:45 +0200
|
|
|
a85e8e |
Subject: [PATCH 233/260] loader/linux: Make trailer initrd entry aligned
|
|
|
a85e8e |
again.
|
|
|
a85e8e |
|
|
|
a85e8e |
Regression from commit:
|
|
|
a85e8e |
loader/linux: do not pad initrd with zeroes at the end
|
|
|
a85e8e |
a8c473288d3f0a5e17a903a5121dea1a695dda3b
|
|
|
a85e8e |
|
|
|
a85e8e |
Wimboot fails since the change above because it expects the "trailer"
|
|
|
a85e8e |
initrd element on an aligned address.
|
|
|
a85e8e |
This issue shows only when newc_name is used and the last initrd
|
|
|
a85e8e |
entry has a not aligned size.
|
|
|
a85e8e |
---
|
|
|
a85e8e |
grub-core/loader/linux.c | 7 ++++++-
|
|
|
a85e8e |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
|
|
|
a85e8e |
index d2cd591f6..be6fa0f4d 100644
|
|
|
a85e8e |
--- a/grub-core/loader/linux.c
|
|
|
a85e8e |
+++ b/grub-core/loader/linux.c
|
|
|
a85e8e |
@@ -213,6 +213,7 @@ grub_initrd_init (int argc, char *argv[],
|
|
|
a85e8e |
|
|
|
a85e8e |
if (newc)
|
|
|
a85e8e |
{
|
|
|
a85e8e |
+ initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
|
|
|
a85e8e |
initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
|
|
a85e8e |
+ sizeof ("TRAILER!!!") - 1, 4);
|
|
|
a85e8e |
free_dir (root);
|
|
|
a85e8e |
@@ -290,7 +291,11 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
|
|
|
a85e8e |
ptr += cursize;
|
|
|
a85e8e |
}
|
|
|
a85e8e |
if (newc)
|
|
|
a85e8e |
- ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0);
|
|
|
a85e8e |
+ {
|
|
|
a85e8e |
+ grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4));
|
|
|
a85e8e |
+ ptr += ALIGN_UP_OVERHEAD (cursize, 4);
|
|
|
a85e8e |
+ ptr = make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1, 0, 0);
|
|
|
a85e8e |
+ }
|
|
|
a85e8e |
free_dir (root);
|
|
|
a85e8e |
root = 0;
|
|
|
a85e8e |
return GRUB_ERR_NONE;
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|