Skip to content

Commit 5b55bfd

Browse files
committed
versal: Move generation of ELF wrapper around tee-raw.bin into optee_os repository
As part of PR #857 it was decided that it would be better to perform the generation of the ELF wrapper directly within the optee_os/ build system and to just rely on its availability in build/versal.mk. Signed-off-by: Joachim Foerster <joachim.foerster@missinglinkelectronics.com>
1 parent c8b48b0 commit 5b55bfd

1 file changed

Lines changed: 2 additions & 34 deletions

File tree

versal.mk

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -429,45 +429,13 @@ endif
429429
# Boot Image
430430
###############################################################################
431431

432-
OPTEE_OS_ELF ?= $(shell dirname $(OPTEE_OS_BIN))/tee.elf
433-
OPTEE_OS_RAWBIN ?= $(shell dirname $(OPTEE_OS_BIN))/tee-raw.bin
434-
$(OPTEE_OS_ELF): optee-os-common
435-
$(OPTEE_OS_RAWBIN): optee-os-common
436-
437-
OPTEE_OS_RAWBIN_OBJ ?= versal/$(shell basename $(OPTEE_OS_RAWBIN)).o
438-
OPTEE_OS_RAWBIN_ELF ?= versal/$(shell basename $(OPTEE_OS_RAWBIN)).elf
439-
440-
# NOTE: Since we need to reference an ELF file in the .bif file to make PLM
441-
# firmware really recognize OP-TEE OS as a SEL-1 binary and provide
442-
# matching "handoff" parameters to ATF (API id 0x70b,
443-
# get_atf_handoff_params), we wrap the regular tee-raw.bin file in ELF
444-
# format with a single .text section and the appropriate entry point.
445-
#
446-
# The tee.elf file cannot be used directly, since OP-TEE OS entry code
447-
# (entry_a64.S) depends on a struct boot_embdata placed right at symbol
448-
# __data_end. The script gen_tee_bin.py does this placement while crafting
449-
# tee-raw.bin (and similarly tee.bin) from tee.elf.
450-
$(OPTEE_OS_RAWBIN_OBJ): $(OPTEE_OS_RAWBIN)
451-
$(subst ",,$(CROSS_COMPILE_S_KERNEL))objcopy \
452-
-I binary -O elf64-littleaarch64 -B aarch64 \
453-
--rename-section .data=.text \
454-
--set-section-flags .text=alloc,code,load,readonly,contents \
455-
$< $@
456-
$(OPTEE_OS_RAWBIN_ELF).load: $(OPTEE_OS_ELF)
457-
$(subst ",,$(CROSS_COMPILE_S_KERNEL))nm $< | \
458-
awk '/\s_start$$/ {printf "0x%s\n", $$1}' >$@
459-
$(OPTEE_OS_RAWBIN_ELF): $(OPTEE_OS_RAWBIN_OBJ) $(OPTEE_OS_RAWBIN_ELF).load
460-
$(subst ",,$(CROSS_COMPILE_S_KERNEL))ld \
461-
-Ttext $(shell cat $(OPTEE_OS_RAWBIN_ELF).load) \
462-
-e $(shell cat $(OPTEE_OS_RAWBIN_ELF).load) \
463-
$< -o $@
464-
.PHONY: $(OPTEE_OS_RAWBIN_OBJ) $(OPTEE_OS_RAWBIN_ELF).load $(OPTEE_OS_RAWBIN_ELF)
432+
OPTEE_OS_RAWBIN_ELF ?= $(shell dirname $(OPTEE_OS_BIN))/tee-raw.bin.elf
465433

466434
BIF_PATH := versal/bootImage-$(PLATFORM).bif
467435

468436
$(BIF_PATH): versal/bootImage-$(OPTEE_OS_PLATFORM).bif.in \
469437
$(_PDI_PATH) $(_PLM_PATH) $(_PSM_PATH) $(_DTB_PATH) $(_IUB_BIF_PATH) \
470-
$(OPTEE_OS_RAWBIN_ELF)
438+
optee-os
471439
cp -a $< $@
472440
# PLM firmware is optional, if already in .pdi file
473441
ifeq ($(_PLM_PATH),)

0 commit comments

Comments
 (0)