gen_tee_bin: generate tee-raw.bin
Some platforms (like Rcar Gen3) still does not support OP-TEE images
wrapped into any type of container. In the past we were able to
generate raw binary straight from the resulting elf file. But with
recent changes, OP-TEE expects some additional data past the __end, so
wee need to use gen_tee_bin.py to generate header-less OP-TEE binary.
This patch adds `--out_tee_raw_bin` option, which generates needed
file.
Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
diff --git a/scripts/gen_tee_bin.py b/scripts/gen_tee_bin.py
index 5d1d2ac..34629b9 100755
--- a/scripts/gen_tee_bin.py
+++ b/scripts/gen_tee_bin.py
@@ -260,6 +260,18 @@
return init_load_addr_hi, init_load_addr_lo
+def output_raw_bin(elffile, outf):
+ pager_bin = get_pager_bin(elffile)
+ pageable_bin = get_pageable_bin(elffile)
+ embdata_bin = get_embdata_bin(elffile)
+ init_bin_size = get_symbol(elffile, '__init_size')['st_value']
+
+ outf.write(pager_bin)
+ outf.write(pageable_bin[:init_bin_size])
+ outf.write(embdata_bin)
+ outf.write(pageable_bin[init_bin_size:])
+
+
def output_header_v1(elffile, outf):
arch_id = get_arch_id(elffile)
pager_bin = get_pager_bin(elffile)
@@ -341,6 +353,10 @@
required=False, type=argparse.FileType('wb'),
help='The output tee.bin')
+ parser.add_argument('--out_tee_raw_bin',
+ required=False, type=argparse.FileType('wb'),
+ help='The output tee_raw.bin')
+
parser.add_argument('--out_tee_pager_bin',
required=False, type=argparse.FileType('wb'),
help='The output tee_pager.bin')
@@ -369,6 +385,9 @@
elffile = ELFFile(args.input)
+ if args.out_tee_raw_bin:
+ output_raw_bin(elffile, args.out_tee_raw_bin)
+
if args.out_tee_bin:
output_header_v1(elffile, args.out_tee_bin)