[Skiboot] [PATCH v2 01/12] core/init.c: adjust offset to run BOOTKERNEL containers

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Wed Sep 28 18:10:51 AEST 2016


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

Signed-off-by: Claudio Carvalho <cclaudio 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",
-- 
1.9.1



More information about the Skiboot mailing list