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

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Thu Aug 11 16:30:09 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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/init.c b/core/init.c
index ca3ad55..f812545 100644
--- a/core/init.c
+++ b/core/init.c
@@ -44,6 +44,7 @@
 #include <ipmi.h>
 #include <sensor.h>
 #include <xive.h>
+#include <libstb/container.h>
 
 enum proc_gen proc_gen;
 
@@ -360,7 +361,12 @@ 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)) {
+			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