Commit 334797f7 authored by Grant Likely's avatar Grant Likely
Browse files

Fixes to StMM and OPTEE build



StMM build isn't fully working yet, so leave it disabled by default, but
clean up some of the environmental settings so that it behaves more
consistently.
Signed-off-by: Grant Likely's avatarGrant Likely <grant.likely@arm.com>
parent c1cfdb47
TFA_PLAT := qemu
OPTEE_PLATFORM := vexpress-qemu_armv8a
UBOOT_EXTRA_CONFIGS += scripts/qemu_arm64_tfa.config
FLASH_IMAGE := nor_flash.bin
#USE_STMM := y
USE_OPTEE := y
ifneq ($(CONFIG_TFABOOT)$(CONFIG_POSITION_INDEPENDENT),yy)
tweakconfig:
echo "CONFIG_POSITION_INDEPENDENT=y" >> $(UBOOT_OUTPUT)/.config
echo "CONFIG_TFABOOT=y" >> $(UBOOT_OUTPUT)/.config
ifeq ($(USE_OPTEE),y)
echo "CONFIG_OPTEE=y" >> $(UBOOT_OUTPUT)/.config
endif
$(MAKE) -C $(UBOOT_PATH) $(UBOOT_EXTRA) olddefconfig
u-boot/all u-boot/u-boot.bin: tweakconfig
......
......@@ -9,6 +9,8 @@
# *_EXTRA: Extra parameters to the make call. Gets added to make targets, e.g.
# "$(MAKE) -C ${PROJECT_PATH} ... ${PROJECT_EXTRA} ..."
SHELL := /bin/bash
# Set some defaults that can be overridden by the target makefile include
DT_PATH := $(CURDIR)/devicetree-rebasing
DT_OUTPUT := $(DT_PATH)
......@@ -22,14 +24,15 @@ UBOOT_PATH := $(CURDIR)/u-boot
ifneq ($(BUILD_OUTPUT),)
__BUILD := $(realpath $(BUILD_OUTPUT))
EDK2_OUTPUT := $(__BUILD)/edk2
OPTEE_OUTPUT := $(__BUILD)/optee
OPTEE_OUTPUT := $(__BUILD)/optee_os
OPTEE_EXTRA += O=$(OPTEE_OUTPUT)
TFA_OUTPUT := $(__BUILD)/tfa
TFA_EXTRA += BUILD_BASE=$(TFA_OUTPUT)
UBOOT_OUTPUT := $(__BUILD)/u-boot
UBOOT_EXTRA += KBUILD_OUTPUT=$(UBOOT_OUTPUT)
else
EDK2_OUTPUT := $(EDK2_PATH)/Build
OPTEE_OUTPUT := $(OPTEE_PATH)/Build
EDK2_OUTPUT := $(EDK2_PATH)
OPTEE_OUTPUT := $(OPTEE_PATH)/out
TFA_OUTPUT := $(TFA_PATH)/build
UBOOT_OUTPUT := $(UBOOT_PATH)
endif
......@@ -163,47 +166,66 @@ ifeq ($(TFA_PLAT),)
$(info )
$(error Invalid configuration)
endif
ifeq ($(USE_OPTEE)_$(OPTEE_PLATFORM),y_)
$(info OPTEE is enabled, but $$OPTEE_PLATFORM is not set. Either the platform is not)
$(info yet supported, or there is a bug. Use \'make info\' to see the current)
$(info configuration)
$(info )
$(error Invalid configuration)
endif
endif
# If Standalone-MM is required, set some basic configuration.
ifeq ($(CONFIG_USE_STMM),y)
# ----------------------------------------------------------------------
# Standalone-MM build configuration
ifeq ($(USE_STMM),y)
# EDK2 Environmental variables; easiest to export these
export WORKSPACE=$(EDK2_OUTPUT)
export PACKAGES_PATH=$(EDK2_PATH):$(EDK2_PLATFORMS_PATH)
export GCC5_AARCH64_PREFIX=$(CROSS_COMPILE)
STMM_PLATFORM="Platform/StMMRpmb/PlatformStandaloneMm.dsc"
export ACTIVE_PLATFORM=Platform/StMMRpmb/PlatformStandaloneMm.dsc
# StMM requires some OPTEE config options
CONFIG_OPTEE=y
OPTEE_EXTRA += CFG_ARM64_core=y
# Tell optee where to find StMM
OPTEE_EXTRA += CFG_STMM_PATH=$(EDK2_OUTPUT)/QemuVirtMmStandalone/DEBUG_GCC5/FV/BL32_AP-MM.fd
optee/all: stmm/all
stmm/all:
source $(EDK2_PATH)/edksetup.sh && $(MAKE) -C $(EDK2_PATH)/BaseTools && build -p $(ACTIVE_PLATFORM) -b DEBUG -a AARCH64 -t GCC5 -n 4 -D DO_X86EMU=TRUE
endif # ifeq($(USE_STMM),y)
# ----------------------------------------------------------------------
# OP-TEE build configuration
ifeq ($(USE_OPTEE),y)
OPTEE_EXTRA += ARCH=arm
OPTEE_EXTRA += CROSS_COMPILE32=arm-linux-gnueabihf-
OPTEE_EXTRA += PLATFORM=$(OPTEE_PLATFORM)
OPTEE_EXTRA += CFG_ARM64_core=y
OPTEE_EXTRA += CFG_RPMB_FS=y
OPTEE_EXTRA += CFG_RPMB_FS_DEV_ID=1
OPTEE_EXTRA += CFG_RPMB_WRITE_KEY=1
OPTEE_EXTRA += CFG_TEE_CORE_LOG_LEVEL=3
OPTEE_EXTRA += CFG_CORE_HEAP_SIZE=524288
OPTEE_EXTRA += CFG_CORE_ASLR=n
OPTEE_EXTRA += CFG_TA_ASLR=n
endif
# If OP-TEE support is enabled, add in the OP-TEE build and dependencies
ifeq ($(CONFIG_OPTEE),y)
ifeq ($(OPTEE_PLATFORM),)
$(info $$OPTEE_PLATFORM is not set, but CONFIG_OPTEE=y. Either the platform is not)
$(info yet supported, or there is a bug. Use \'make info\' to see the current)
$(info configuration)
$(info )
$(error Invalid configuration)
endif
TFA_EXTRA += BL32=$(OPTEE_OUTPUT)/tee-header_v2.bin
TFA_EXTRA += BL32_EXTRA1=$(OPTEE_OUTPUT)/tee-pager_v2.bin
TFA_EXTRA += BL32_EXTRA2=$(OPTEE_OUTPUT)/tee-pageable_v2.bin
#OPTEE_EXTRA += CFG_TEE_CORE_LOG_LEVEL=3
#OPTEE_EXTRA += CFG_CORE_ASLR=n
#OPTEE_EXTRA += CFG_TA_ASLR=n
# Tell TFA where to find the OP-TEE binaries
TFA_EXTRA += BL32=$(OPTEE_OUTPUT)/arm-plat-vexpress/core/tee-header_v2.bin
TFA_EXTRA += BL32_EXTRA1=$(OPTEE_OUTPUT)/arm-plat-vexpress/core/tee-pager_v2.bin
TFA_EXTRA += BL32_EXTRA2=$(OPTEE_OUTPUT)/arm-plat-vexpress/core/tee-pageable_v2.bin
TFA_EXTRA += BL32_RAM_LOCATION=tdram
TFA_EXTRA += SPD=opteed
tfa/all tfa/fip: optee/all
endif
# ================================================
# Delegate optee targets to optee Makefile
optee/%:
${MAKE} -C ${OPTEE_PATH} ${OPTEE_EXTRA} $*
endif # ifeq($(USE_OPTEE),y)
# Default Trusted Firmware configuration settings
TFA_EXTRA += PLAT=$(TFA_PLAT)
......@@ -254,24 +276,15 @@ devicetree/%:
${MAKE} -C ${DT_PATH} $*
# ================================================
# The Standalone-MM build
ifeq ($(CONFIG_USE_STMM),y)
BL32_AP_MM.fd:
set -e; source $(EDK2_PATH)/edksetup.sh; $(MAKE) -C $(EDK2_PATH)/BaseTools; build -p $(STMM_PLATFORM) -b RELEASE -a AARCH64 -t GCC5 -D DO_X86EMU=TRUE
cp $(EDK2_OUTPUT)/MmStandaloneRpmb/RELEASE_GCC5/FV/BL32_AP_MM.fd .
endif
# ================================================
# Delegate to op-tee build
optee/%:
${MAKE} -C ${OPTEE_PATH} ${OPTEE_EXTRA} $*
# Delegate to op-tee clean target
optee/clean:
${MAKE} -C ${OPTEE_PATH} clean
# ================================================
# Delegate to trusted-firmware-a build
tfa/%:
${MAKE} -C ${TFA_PATH} ${TFA_EXTRA} $*
optee/all: stmm/all
tfa/all tfa/fip: u-boot/all
# ================================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment