From 9d9d9e37a145014dd6f4ebf5733062f56f9b3c86 Mon Sep 17 00:00:00 2001 From: Tim Lee Date: Fri, 28 Oct 2022 16:57:26 +0800 Subject: meta-phosphor: npcm8xx.bbclass: adjust each image alignment by its definition Tested: buid pass and boot up successful when loading BB at 0x80000 for example Verified by bootblock log as below: ========== Load bootblock ========== tip_firmware_image_init fiu0 cs0 BOOTBLOCK tag U. scan from 0x80000000 to 0x88000000 tip_firmware_image_scan_flash BOOTBLOCK found addr 0x80080000 dst 0xfffd0000 Signed-off-by: Tim Lee Change-Id: I62eced6d80b48d488348d43468f8f01edf83d79a --- meta-nuvoton/conf/machine/include/npcm8xx.inc | 6 ++++++ .../classes/image_types_phosphor_nuvoton_npcm8xx.bbclass | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/meta-nuvoton/conf/machine/include/npcm8xx.inc b/meta-nuvoton/conf/machine/include/npcm8xx.inc index fafa92d9b6..a40e8fb65c 100644 --- a/meta-nuvoton/conf/machine/include/npcm8xx.inc +++ b/meta-nuvoton/conf/machine/include/npcm8xx.inc @@ -23,6 +23,12 @@ FLASH_UBI_RWFS_TXT_SIZE ?= "6MiB" SERIAL_CONSOLES ?= "115200;ttyS0" +BB_ALIGN ?= "4096" +ATF_ALIGN ?= "4096" +OPTEE_ALIGN ?= "4096" +UBOOT_ALIGN ?= "4096" +ALIGN_END ?= "4096" + SOC_FAMILY = "npcm8xx" include conf/machine/include/soc-family.inc MACHINEOVERRIDES .= ":npcm8xx" diff --git a/meta-phosphor/classes/image_types_phosphor_nuvoton_npcm8xx.bbclass b/meta-phosphor/classes/image_types_phosphor_nuvoton_npcm8xx.bbclass index 297db35a5e..dc82c4eb40 100644 --- a/meta-phosphor/classes/image_types_phosphor_nuvoton_npcm8xx.bbclass +++ b/meta-phosphor/classes/image_types_phosphor_nuvoton_npcm8xx.bbclass @@ -35,7 +35,7 @@ do_prepare_bootloaders() { python do_merge_bootloaders() { - def Merge_bin_files_and_pad(inF1, inF2, outF, align, padding_at_end): + def Merge_bin_files_and_pad(inF1, inF2, outF, align, align_end): padding_size = 0 padding_size_end = 0 F1_size = os.path.getsize(inF1) @@ -44,8 +44,8 @@ python do_merge_bootloaders() { if ((F1_size % align) != 0): padding_size = align - (F1_size % align) - if ((F2_size % align) != 0): - padding_size_end = align - (F2_size % align) + if ((F2_size % align_end) != 0): + padding_size_end = align_end - (F2_size % align_end) with open(outF, "wb") as file3: with open(inF1, "rb") as file1: @@ -63,22 +63,22 @@ python do_merge_bootloaders() { Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BINARY',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('BOOTBLOCK',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BINARY',True)), - 0x1000, 0x20) + int(d.getVar('BB_ALIGN', True)), int(d.getVar('ALIGN_END', True))) Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BINARY',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('ATF_BINARY',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_BINARY',True)), - 0x1000, 0x20) + int(d.getVar('ATF_ALIGN', True)), int(d.getVar('ALIGN_END', True))) Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_BINARY',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('OPTEE_BINARY',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_TEE_BINARY',True)), - 0x1000, 0x20) + int(d.getVar('OPTEE_ALIGN', True)), int(d.getVar('ALIGN_END', True))) Merge_bin_files_and_pad(os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_BL31_TEE_BINARY',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s.full' % d.getVar('UBOOT_BINARY',True)), os.path.join(d.getVar('DEPLOY_DIR_IMAGE', True), '%s' % d.getVar('KMT_TIPFW_BB_UBOOT_BINARY',True)), - 0x1000, 0x20) + int(d.getVar('UBOOT_ALIGN', True)), int(d.getVar('ALIGN_END', True))) } do_prepare_bootloaders[depends] += " \ -- cgit v1.2.3