summaryrefslogtreecommitdiff
path: root/util/qualcomm/createxbl.py
diff options
context:
space:
mode:
authorT Michael Turney <mturney@codeaurora.org>2019-08-07 14:26:32 -0700
committerJulius Werner <jwerner@chromium.org>2020-02-07 23:11:45 +0000
commitbcd62f5737f5022b1bbe0041d4222575851b3cb9 (patch)
treec84ec40a5f2df8d6fa2f30195729d9da417f20c9 /util/qualcomm/createxbl.py
parent01bfa53f772a1a5cf7caa95abc62e35579022024 (diff)
downloadcoreboot-bcd62f5737f5022b1bbe0041d4222575851b3cb9.tar.xz
trogdor: support mbn_version 6 with python build scripts
Developer/Reviewer, be aware of this patch from Mistral: https://review.coreboot.org/c/coreboot/+/33425/18 Change-Id: I020d1e4d4f5c948948e1b39dd18af1d0e860c279 Signed-off-by: T Michael Turney <mturney@codeaurora.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/35506 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'util/qualcomm/createxbl.py')
-rwxr-xr-xutil/qualcomm/createxbl.py47
1 files changed, 28 insertions, 19 deletions
diff --git a/util/qualcomm/createxbl.py b/util/qualcomm/createxbl.py
index 4a218544c0..861cec9110 100755
--- a/util/qualcomm/createxbl.py
+++ b/util/qualcomm/createxbl.py
@@ -44,11 +44,13 @@
#
# when who what, where, why
# -------- --- ------------------------------------------------------
+# 05/21/19 rissha Added --mbn_version to add MBN header accordingly
# 03/26/18 tv Added -e to enable extended MBNV5 support
# 09/04/15 et Added -x and -d to embed xbl_sec ELF
# 02/11/15 ck Fixed missing elf type check in ZI OOB feature
# 11/04/14 ck Updated calls to mbn_tools functions
-# 10/22/14 ck Added -z option to remove out of bounds ZI segments when converting from 64 to 32
+# 10/22/14 ck Added -z option to remove out of bounds ZI segments when
+# converting from 64 to 32
# 10/10/14 ck Added -c option and logic to enable elf type swapping
# 09/12/14 ck Added single file logic
# 08/29/14 ck Added no_hash option
@@ -119,6 +121,10 @@ def main():
help="Removes ZI segments that have addresses greater" + \
" than 32 bits when converting from a 64 to 32 bit ELF")
+ parser.add_option("--mbn_version",
+ action="store", type="int", dest="mbn_version",
+ help="Add mbn header in elf image. '3', '5' or '6'")
+
(options, args) = parser.parse_args()
if not options.elf_inp_file1:
@@ -206,11 +212,13 @@ def main():
else:
zi_oob_enabled = True
+ header_version = 3
+
if options.elf_inp_xbl_sec:
- is_ext_mbn_v5 = True
- else:
- is_ext_mbn_v5 = False
+ header_version = 5
+ if options.mbn_version:
+ header_version = options.mbn_version
mbn_type = 'elf'
header_format = 'reg'
@@ -244,7 +252,7 @@ def main():
is_elf_xbl_sec_64_bit,
is_out_elf_64_bit,
zi_oob_enabled,
- is_ext_mbn_v5)
+ header_version)
# Hash the image if user did not explicitly say not to
@@ -259,7 +267,8 @@ def main():
source_elf,
target_hash,
elf_out_file_name = target_phdr_elf,
- secure_type = image_header_secflag)
+ secure_type = image_header_secflag,
+ header_version = header_version )
if rv:
raise RuntimeError, "Failed to run pboot_gen_elf"
@@ -269,8 +278,8 @@ def main():
target_hash,
target_hash_hd,
image_header_secflag,
- is_ext_mbn_v5,
- elf_file_name = source_elf)
+ elf_file_name = source_elf,
+ header_version = header_version)
if rv:
raise RuntimeError, "Failed to create image header for hash segment"
@@ -305,7 +314,7 @@ def merge_elfs(env,
is_elf_xbl_sec_64_bit,
is_out_elf_64_bit,
zi_oob_enabled,
- is_ext_mbn_v5):
+ header_version):
[elf_header1, phdr_table1] = \
mbn_tools.preprocess_elf_file(elf_in_file_name1)
@@ -663,12 +672,12 @@ def merge_elfs(env,
new_phdr.p_paddr = phys_virt_addr
new_phdr.p_filesz = os.path.getsize(elf_in_file_xbl_sec)
new_phdr.p_memsz = new_phdr.p_filesz
- if is_ext_mbn_v5 == True:
- new_phdr.p_flags = (0x5 |
- (mbn_tools.MI_PBT_XBL_SEC_SEGMENT <<
- mbn_tools.MI_PBT_FLAG_SEGMENT_TYPE_SHIFT));
+ if header_version >= 5:
+ new_phdr.p_flags = (0x5 |
+ (mbn_tools.MI_PBT_XBL_SEC_SEGMENT <<
+ mbn_tools.MI_PBT_FLAG_SEGMENT_TYPE_SHIFT));
else:
- new_phdr.p_flags = 0x5
+ new_phdr.p_flags = 0x5
new_phdr.p_align = 0x1000
else:
# Converting from 64 to 32 elf requires data size validation
@@ -677,12 +686,12 @@ def merge_elfs(env,
new_phdr = mbn_tools.Elf32_Phdr('\0' * ELF32_PHDR_SIZE)
new_phdr.p_type = 0x1 #
new_phdr.p_offset = segment_offset
- if is_ext_mbn_v5 == True:
- new_phdr.p_flags = (0x5 |
- (mbn_tools.MI_PBT_XBL_SEC_SEGMENT <<
- mbn_tools.MI_PBT_FLAG_SEGMENT_TYPE_SHIFT));
+ if header_version >= 5:
+ new_phdr.p_flags = (0x5 |
+ (mbn_tools.MI_PBT_XBL_SEC_SEGMENT <<
+ mbn_tools.MI_PBT_FLAG_SEGMENT_TYPE_SHIFT));
else:
- new_phdr.p_flags = 0x5
+ new_phdr.p_flags = 0x5
new_phdr.p_align = 0x1000
if phys_virt_addr > 0xFFFFFFFF: