From d52fed67bdebe2b5faff2cf90b9c3927bcf4a718 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Wed, 1 Jan 2020 18:26:03 -0800 Subject: [PATCH] bootloader: skip secureboot header if exists and not secure booting To enable some level of compatibility for systems *not* booting in secure boot with firmware built for (and not for) secure boot, look for the secure boot header and skip over it if not secure boot. Resolves #194 Signed-off-by: Stewart Smith Change-Id: I9451eaecca0e78e8ea9928f312b10f688958568c Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/96037 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Tested-by: FSP CI Jenkins Reviewed-by: Nicholas E Bofferding Reviewed-by: Daniel M Crowell --- src/bootloader/bootloader.C | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bootloader/bootloader.C b/src/bootloader/bootloader.C index 2a2634055c0..5ad0b96b2ae 100644 --- a/src/bootloader/bootloader.C +++ b/src/bootloader/bootloader.C @@ -5,8 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2019 */ +/* Contributors Listed Below - COPYRIGHT 2015,2020 */ /* [+] International Business Machines Corp. */ +/* [+] Stewart Smith */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -521,6 +522,10 @@ namespace Bootloader{ reinterpret_cast(HBB_RUNNING_ADDR | IGNORE_HRMOR_MASK); + ROM_container_raw *l_hbb_container = + reinterpret_cast( + HBB_WORKING_ADDR | IGNORE_HRMOR_MASK); + // Get Secure Data from SBE HBBL communication area setSecureData(l_src_addr); @@ -532,8 +537,10 @@ namespace Bootloader{ // ROM verification of HBB image verifyContainer(l_src_addr); - // Increment past secure header - if (isEnforcedSecureSection(PNOR::HB_BASE_CODE)) + // Increment past secure header, + // even if built without secure boot + if (isEnforcedSecureSection(PNOR::HB_BASE_CODE) || + l_hbb_container->magic_number == ROM_MAGIC_NUMBER) { l_src_addr += PAGE_SIZE/sizeof(uint64_t); l_hbbLength -= PAGE_SIZE;