[Skiboot] [PATCH 25/40] core/init.c: adjust offset to run BOOTKERNEL containers

Stewart Smith stewart at linux.vnet.ibm.com
Mon Oct 10 19:44:06 AEDT 2016


From: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>

This adjusts the kernel header offset if BOOTKERNEL is a secure boot
container

Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/init.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/init.c b/core/init.c
index 85263f9..bde5637 100644
--- a/core/init.c
+++ b/core/init.c
@@ -45,6 +45,7 @@
 #include <sensor.h>
 #include <xive.h>
 #include <nvram.h>
+#include <libstb/container.h>
 
 enum proc_gen proc_gen;
 
@@ -369,7 +370,11 @@ static bool load_kernel(void)
 		if (!kernel_size)
 			printf("INIT: Assuming kernel at %p\n",
 			       KERNEL_LOAD_BASE);
-		kh = (struct elf_hdr *)KERNEL_LOAD_BASE;
+		if (stb_is_container(KERNEL_LOAD_BASE, kernel_size))
+			kh = (struct elf_hdr *) (KERNEL_LOAD_BASE +
+					        SECURE_BOOT_HEADERS_SIZE);
+		else
+			kh = (struct elf_hdr *) (KERNEL_LOAD_BASE);
 	}
 
 	printf("INIT: Kernel loaded, size: %zu bytes (0 = unknown preload)\n",
-- 
2.7.4



More information about the Skiboot mailing list