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