aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorClaudio Carvalho <cclaudio@linux.vnet.ibm.com>2016-09-28 05:10:51 -0300
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-10-10 15:29:36 +1100
commit841ef2517f1acf8b57550d697799c789a2994758 (patch)
treef7933e2ddf6600f95c1f5cceba4edd535bbecfee /core
parentd15dd47d4a0f766282a034641621529e58ae8b25 (diff)
downloadskiboot-841ef2517f1acf8b57550d697799c789a2994758.zip
skiboot-841ef2517f1acf8b57550d697799c789a2994758.tar.gz
skiboot-841ef2517f1acf8b57550d697799c789a2994758.tar.bz2
core/init.c: adjust offset to run BOOTKERNEL containers
This adjusts the kernel header offset if BOOTKERNEL is a secure boot container Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/init.c7
1 files changed, 6 insertions, 1 deletions
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",