Skip to content
Snippets Groups Projects
Commit f698047e authored by Andrew F. Davis's avatar Andrew F. Davis
Browse files

dra7xx: Refactor Makefile and filenames to ease addition of new platforms


Factor out TI common Makefile components, no functional changes made, except
removing -f from the common Makefile for directory removal and adding -p
to directory creation.

Signed-off-by: default avatarAndrew F. Davis <afd@ti.com>
Reviewed-by: default avatarIgor Opaniuk <igor.opaniuk@linaro.org>
parent 4b8b5536
No related branches found
No related tags found
No related merge requests found
# OP-TEE on Texas Instruments DRA7xx # OP-TEE on Texas Instruments SoCs
# Contents # Contents
1. [Introduction](#1-introduction) 1. [Introduction](#1-introduction)
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
3. [Booting the device](#3-booting-the-device) 3. [Booting the device](#3-booting-the-device)
# 1. Introduction # 1. Introduction
The instructions here will tell how to run OP-TEE on the DRA7xx-EVM board. The instructions here will tell how to run OP-TEE on Texas Instruments
Secure TI devices require a boot image that is authenticated by ROM devices. Secure TI devices require a boot image that is authenticated by ROM
code to function. Without this, even JTAG remains locked. In order to create code to function. Without this, even JTAG remains locked. In order to create
a valid boot image for a secure device from TI, the initial public software a valid boot image for a secure device from TI, the initial public software
image must be signed and combined with various headers, certificates, and image must be signed and combined with various headers, certificates, and
...@@ -50,7 +50,7 @@ Add the bootloader to the 'boot' partition ...@@ -50,7 +50,7 @@ Add the bootloader to the 'boot' partition
# cd <SD card boot partition> # cd <SD card boot partition>
# cp <repo directory>/u-boot/u-boot-spl_HS_MLO MLO # cp <repo directory>/u-boot/u-boot-spl_HS_MLO MLO
# cp <repo directory>/u-boot/u-boot_HS.img u-boot.img # cp <repo directory>/u-boot/u-boot_HS.img u-boot.img
# cp <repo directory>/build/dra7xx/uEnv.txt uEnv.txt # cp <repo directory>/build/ti/uEnv.txt uEnv.txt
``` ```
[README.md]: ../README.md [README.md]: ../README.md
...@@ -20,139 +20,17 @@ STAGING_AREA ?= $(ROOT)/out ...@@ -20,139 +20,17 @@ STAGING_AREA ?= $(ROOT)/out
U-BOOT_PATH ?= $(ROOT)/u-boot U-BOOT_PATH ?= $(ROOT)/u-boot
UBOOT_SPL ?= $(U-BOOT_PATH)/u-boot-spl_HS_MLO UBOOT_SPL ?= $(U-BOOT_PATH)/u-boot-spl_HS_MLO
UBOOT_IMG ?= $(U-BOOT_PATH)/u-boot_HS.img UBOOT_IMG ?= $(U-BOOT_PATH)/u-boot_HS.img
UBOOT_ENV ?= $(BUILD_PATH)/dra7xx/uEnv.txt UBOOT_ENV ?= $(BUILD_PATH)/ti/uEnv.txt
LINUX_IMAGE ?= $(LINUX_PATH)/arch/arm/boot/zImage LINUX_IMAGE ?= $(LINUX_PATH)/arch/arm/boot/zImage
LINUX_DTBS ?= $(wildcard $(LINUX_PATH)/arch/arm/boot/dts/dra7*.dtb) LINUX_DTBS ?= $(wildcard $(LINUX_PATH)/arch/arm/boot/dts/dra7*.dtb)
FIT_SOURCE ?= $(BUILD_PATH)/dra7xx/fitImage.its FIT_SOURCE ?= $(BUILD_PATH)/ti/fitImage-dra7xx.its
FIT_MAKEFILE ?= $(BUILD_PATH)/dra7xx/Makefile FIT_MAKEFILE ?= $(BUILD_PATH)/ti/Makefile
OPTEE_PLATFORM ?= ti-dra7xx
U-BOOT_CONFIG ?= dra7xx_hs_evm_defconfig
CONFIG_TYPE ?= ti_sdk_dra7x_debug
BUSYBOX_TARGET ?= dra7xx
############################################################################### ###############################################################################
# Targets # Include common to TI builds
############################################################################### ###############################################################################
.PHONY: all clean cleaner prepare include ti/ti-common.mk
all: u-boot linux optee-os optee-client xtest helloworld build-fit update_rootfs
clean: linux-clean busybox-clean u-boot-clean optee-os-clean optee-client-clean build-fit-clean
cleaner: clean prepare-cleaner busybox-cleaner linux-cleaner
-include toolchain.mk
prepare:
@if [ ! -d $(STAGING_AREA) ]; then mkdir $(STAGING_AREA); fi
.PHONY: prepare-cleaner
prepare-cleaner:
rm -rf $(STAGING_AREA)
###############################################################################
# Das U-Boot
###############################################################################
.PHONY: u-boot u-boot-clean
U-BOOT_EXPORTS ?= CROSS_COMPILE=$(CROSS_COMPILE_NS_KERNEL) ARCH=arm
u-boot:
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) dra7xx_hs_evm_defconfig
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) all
u-boot-clean:
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) clean
###############################################################################
# Linux kernel
###############################################################################
.PHONY: linux-defconfig linux linux-defconfig-clean linux-clean linux-cleaner
CONFIG_TYPE ?= ti_sdk_dra7x_debug
linux-defconfig:
cd $(LINUX_PATH) && \
ti_config_fragments/defconfig_builder.sh -t $(CONFIG_TYPE)
$(MAKE) -C $(LINUX_PATH) $(LINUX_COMMON_FLAGS) $(CONFIG_TYPE)_defconfig
LINUX_COMMON_FLAGS += ARCH=arm
linux: linux-common
linux-defconfig-clean: linux-defconfig-clean-common
LINUX_CLEAN_COMMON_FLAGS += ARCH=arm
linux-clean: linux-clean-common
LINUX_CLEANER_COMMON_FLAGS += ARCH=arm
linux-cleaner: linux-cleaner-common
###############################################################################
# OP-TEE
###############################################################################
.PHONY: optee-os optee-os-clean optee-client optee-client-clean
OPTEE_OS_COMMON_FLAGS += PLATFORM=ti-dra7xx
optee-os: optee-os-common
OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=ti-dra7xx
optee-os-clean: optee-os-clean-common
optee-client: optee-client-common
optee-client-clean: optee-client-clean-common
###############################################################################
# xtest / optee_test
###############################################################################
.PHONY: xtest xtest-clean xtest-patch
xtest: xtest-common
xtest-clean: xtest-clean-common
xtest-patch: xtest-patch-common
###############################################################################
# hello_world
###############################################################################
.PHONY: helloworld helloworld-clean
helloworld: helloworld-common
helloworld-clean: helloworld-clean-common
###############################################################################
# Busybox
###############################################################################
.PHONY: busybox busybox-clean busybox-cleaner
BUSYBOX_COMMON_TARGET = dra7xx
BUSYBOX_CLEAN_COMMON_TARGET = dra7xx clean
busybox: busybox-common
busybox-clean: busybox-clean-common
busybox-cleaner: busybox-cleaner-common
###############################################################################
# Build FIT
###############################################################################
.PHONY: build-fit build-fit-clean
build-fit: prepare linux optee-os
cp $(LINUX_IMAGE) $(STAGING_AREA)/
cp $(LINUX_DTBS) $(STAGING_AREA)/
cp $(OPTEE_OS_BIN) $(STAGING_AREA)/
cp $(FIT_SOURCE) $(STAGING_AREA)/
cp $(FIT_MAKEFILE) $(STAGING_AREA)/
MKIMAGE=$(U-BOOT_PATH)/tools/mkimage $(MAKE) -C $(STAGING_AREA)
build-fit-clean:
$(RM) $(STAGING_AREA)/Makefile
$(RM) $(STAGING_AREA)/fitImage.its
$(RM) $(STAGING_AREA)/tee.bin
$(RM) $(STAGING_AREA)/*.dtb
$(RM) $(STAGING_AREA)/zImage
###############################################################################
# Root FS
###############################################################################
.PHONY: filelist-tee update_rootfs
filelist-tee: filelist-tee-common u-boot build-fit
@echo "dir /boot 755 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/MLO $(UBOOT_SPL) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/u-boot.img $(UBOOT_IMG) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/uEnv.txt $(UBOOT_ENV) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/fitImage $(STAGING_AREA)/fitImage 644 0 0" >> $(GEN_ROOTFS_FILELIST)
update_rootfs: update_rootfs-common
File moved
File moved
###############################################################################
# Targets
###############################################################################
.PHONY: all clean cleaner prepare
all: u-boot linux optee-os optee-client xtest helloworld build-fit update_rootfs
clean: linux-clean busybox-clean u-boot-clean optee-os-clean optee-client-clean build-fit-clean
cleaner: clean prepare-cleaner busybox-cleaner linux-cleaner
-include toolchain.mk
prepare:
@if [ ! -d $(STAGING_AREA) ]; then mkdir -p $(STAGING_AREA); fi
.PHONY: prepare-cleaner
prepare-cleaner:
rm -r $(STAGING_AREA)
###############################################################################
# Das U-Boot
###############################################################################
.PHONY: u-boot u-boot-clean
U-BOOT_EXPORTS ?= CROSS_COMPILE=$(CROSS_COMPILE_NS_KERNEL) ARCH=arm
u-boot:
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) $(U-BOOT_CONFIG)
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) all
u-boot-clean:
$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) clean
###############################################################################
# Linux kernel
###############################################################################
.PHONY: linux-defconfig linux linux-defconfig-clean linux-clean linux-cleaner
linux-defconfig:
cd $(LINUX_PATH) && \
ti_config_fragments/defconfig_builder.sh -t $(CONFIG_TYPE)
$(MAKE) -C $(LINUX_PATH) $(LINUX_COMMON_FLAGS) $(CONFIG_TYPE)_defconfig
LINUX_COMMON_FLAGS += ARCH=arm
linux: linux-common
linux-defconfig-clean: linux-defconfig-clean-common
LINUX_CLEAN_COMMON_FLAGS += ARCH=arm
linux-clean: linux-clean-common
LINUX_CLEANER_COMMON_FLAGS += ARCH=arm
linux-cleaner: linux-cleaner-common
###############################################################################
# OP-TEE
###############################################################################
.PHONY: optee-os optee-os-clean optee-client optee-client-clean
OPTEE_OS_COMMON_FLAGS += PLATFORM=$(OPTEE_PLATFORM)
optee-os: optee-os-common
OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=$(OPTEE_PLATFORM)
optee-os-clean: optee-os-clean-common
optee-client: optee-client-common
optee-client-clean: optee-client-clean-common
###############################################################################
# xtest / optee_test
###############################################################################
.PHONY: xtest xtest-clean xtest-patch
xtest: xtest-common
xtest-clean: xtest-clean-common
xtest-patch: xtest-patch-common
###############################################################################
# hello_world
###############################################################################
.PHONY: helloworld helloworld-clean
helloworld: helloworld-common
helloworld-clean: helloworld-clean-common
###############################################################################
# Busybox
###############################################################################
.PHONY: busybox busybox-clean busybox-cleaner
BUSYBOX_COMMON_TARGET = $(BUSYBOX_TARGET)
BUSYBOX_CLEAN_COMMON_TARGET = $(BUSYBOX_COMMON_TARGET) clean
busybox: busybox-common
busybox-clean: busybox-clean-common
busybox-cleaner: busybox-cleaner-common
###############################################################################
# Build FIT
###############################################################################
.PHONY: build-fit build-fit-clean
build-fit: prepare linux optee-os
cp $(LINUX_IMAGE) $(STAGING_AREA)/
cp $(LINUX_DTBS) $(STAGING_AREA)/
cp $(OPTEE_OS_BIN) $(STAGING_AREA)/
cp $(FIT_SOURCE) $(STAGING_AREA)/fitImage.its
cp $(FIT_MAKEFILE) $(STAGING_AREA)/
MKIMAGE=$(U-BOOT_PATH)/tools/mkimage $(MAKE) -C $(STAGING_AREA)
build-fit-clean:
$(RM) $(STAGING_AREA)/Makefile
$(RM) $(STAGING_AREA)/fitImage.its
$(RM) $(STAGING_AREA)/tee.bin
$(RM) $(STAGING_AREA)/*.dtb
$(RM) $(STAGING_AREA)/zImage
###############################################################################
# Root FS
###############################################################################
.PHONY: filelist-tee update_rootfs
filelist-tee: filelist-tee-common u-boot build-fit
@echo "dir /boot 755 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/MLO $(UBOOT_SPL) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/u-boot.img $(UBOOT_IMG) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/uEnv.txt $(UBOOT_ENV) 644 0 0" >> $(GEN_ROOTFS_FILELIST)
@echo "file /boot/fitImage $(STAGING_AREA)/fitImage 644 0 0" >> $(GEN_ROOTFS_FILELIST)
update_rootfs: update_rootfs-common
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment