diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-03-19 16:59:12 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-04-11 17:59:57 -0500 |
commit | e7a2da8d5e654467df63c03e2be91b435796df25 (patch) | |
tree | 789e07b7a962ec41b875b949fe07047613733943 /core/init.c | |
parent | 217e5a4ecbfab8e88b6e250d5d8fdfe502cfe5da (diff) | |
download | talos-skiboot-e7a2da8d5e654467df63c03e2be91b435796df25.tar.gz talos-skiboot-e7a2da8d5e654467df63c03e2be91b435796df25.zip |
core: Correctly load initramfs in stb container
Skiboot does not calculate the actual size and start location of the
initramfs if it is wrapped by an STB container (for example if loading
an initramfs from the ROOTFS partition).
Check if the initramfs is in an STB container and determine the size and
location correctly in the same manner as the kernel. Since
load_initramfs() is called after load_kernel() move the call to
trustedboot_exit_boot_services() into load_and_boot_kernel() so it is
called after both of these.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'core/init.c')
-rw-r--r-- | core/init.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/core/init.c b/core/init.c index 39c44607..b91e34b3 100644 --- a/core/init.c +++ b/core/init.c @@ -428,13 +428,13 @@ static bool load_kernel(void) SECURE_BOOT_HEADERS_SIZE + kernel_size); } - trustedboot_exit_boot_services(); - return true; } static void load_initramfs(void) { + uint64_t *initramfs_start; + void *stb_container = NULL; int loaded; loaded = wait_for_resource_loaded(RESOURCE_ID_INITRAMFS, @@ -443,15 +443,31 @@ static void load_initramfs(void) if (loaded != OPAL_SUCCESS || !initramfs_size) return; + if (stb_is_container(INITRAMFS_LOAD_BASE, initramfs_size)) { + stb_container = INITRAMFS_LOAD_BASE; + initramfs_start = INITRAMFS_LOAD_BASE + SECURE_BOOT_HEADERS_SIZE; + } else { + initramfs_start = INITRAMFS_LOAD_BASE; + } + dt_check_del_prop(dt_chosen, "linux,initrd-start"); dt_check_del_prop(dt_chosen, "linux,initrd-end"); printf("INIT: Initramfs loaded, size: %zu bytes\n", initramfs_size); dt_add_property_u64(dt_chosen, "linux,initrd-start", - (uint64_t)INITRAMFS_LOAD_BASE); + (uint64_t)initramfs_start); dt_add_property_u64(dt_chosen, "linux,initrd-end", - (uint64_t)INITRAMFS_LOAD_BASE + initramfs_size); + (uint64_t)initramfs_start + initramfs_size); + + if (chip_quirk(QUIRK_MAMBO_CALLOUTS)) { + secureboot_verify(RESOURCE_ID_INITRAMFS, + stb_container, + SECURE_BOOT_HEADERS_SIZE + initramfs_size); + trustedboot_measure(RESOURCE_ID_INITRAMFS, + stb_container, + SECURE_BOOT_HEADERS_SIZE + initramfs_size); + } } void *fdt; @@ -482,6 +498,8 @@ void __noreturn load_and_boot_kernel(bool is_reboot) load_initramfs(); + trustedboot_exit_boot_services(); + ipmi_set_fw_progress_sensor(IPMI_FW_OS_BOOT); occ_pstates_init(); |