Andrew F. Davis | f698047 | 2017-04-02 17:25:10 -0500 | [diff] [blame] | 1 | ############################################################################### |
| 2 | # Targets |
| 3 | ############################################################################### |
| 4 | .PHONY: all clean cleaner prepare |
| 5 | |
Jens Wiklander | 88d027c | 2018-05-09 10:12:03 +0200 | [diff] [blame] | 6 | all: u-boot linux optee-os build-fit buildroot |
| 7 | clean: linux-clean u-boot-clean optee-os-clean build-fit-clean buildroot-clean |
Etienne Carriere | bb1adef | 2019-05-14 17:15:04 +0200 | [diff] [blame] | 8 | cleaner: clean prepare-cleaner linux-cleaner |
Andrew F. Davis | f698047 | 2017-04-02 17:25:10 -0500 | [diff] [blame] | 9 | |
Victor Chong | 7a71651 | 2017-09-11 15:18:44 +0100 | [diff] [blame] | 10 | include toolchain.mk |
Andrew F. Davis | f698047 | 2017-04-02 17:25:10 -0500 | [diff] [blame] | 11 | |
| 12 | prepare: |
| 13 | @if [ ! -d $(STAGING_AREA) ]; then mkdir -p $(STAGING_AREA); fi |
| 14 | |
| 15 | .PHONY: prepare-cleaner |
| 16 | prepare-cleaner: |
| 17 | rm -r $(STAGING_AREA) |
| 18 | |
| 19 | ############################################################################### |
| 20 | # Das U-Boot |
| 21 | ############################################################################### |
| 22 | .PHONY: u-boot u-boot-clean |
| 23 | |
| 24 | U-BOOT_EXPORTS ?= CROSS_COMPILE=$(CROSS_COMPILE_NS_KERNEL) ARCH=arm |
| 25 | |
| 26 | u-boot: |
| 27 | $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) $(U-BOOT_CONFIG) |
| 28 | $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) all |
| 29 | |
| 30 | u-boot-clean: |
| 31 | $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) clean |
| 32 | |
| 33 | ############################################################################### |
| 34 | # Linux kernel |
| 35 | ############################################################################### |
| 36 | .PHONY: linux-defconfig linux linux-defconfig-clean linux-clean linux-cleaner |
| 37 | |
| 38 | linux-defconfig: |
| 39 | cd $(LINUX_PATH) && \ |
| 40 | ti_config_fragments/defconfig_builder.sh -t $(CONFIG_TYPE) |
| 41 | $(MAKE) -C $(LINUX_PATH) $(LINUX_COMMON_FLAGS) $(CONFIG_TYPE)_defconfig |
| 42 | |
| 43 | LINUX_COMMON_FLAGS += ARCH=arm |
| 44 | linux: linux-common |
| 45 | linux-defconfig-clean: linux-defconfig-clean-common |
| 46 | |
| 47 | LINUX_CLEAN_COMMON_FLAGS += ARCH=arm |
| 48 | linux-clean: linux-clean-common |
| 49 | |
| 50 | LINUX_CLEANER_COMMON_FLAGS += ARCH=arm |
| 51 | linux-cleaner: linux-cleaner-common |
| 52 | |
| 53 | ############################################################################### |
| 54 | # OP-TEE |
| 55 | ############################################################################### |
| 56 | .PHONY: optee-os optee-os-clean optee-client optee-client-clean |
| 57 | |
Etienne Carriere | 3768a2b | 2019-05-14 17:13:19 +0200 | [diff] [blame] | 58 | OPTEE_OS_COMMON_FLAGS += PLATFORM=$(OPTEE_OS_PLATFORM) |
Andrew F. Davis | f698047 | 2017-04-02 17:25:10 -0500 | [diff] [blame] | 59 | optee-os: optee-os-common |
| 60 | |
Etienne Carriere | 3768a2b | 2019-05-14 17:13:19 +0200 | [diff] [blame] | 61 | OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=$(OPTEE_OS_PLATFORM) |
Andrew F. Davis | f698047 | 2017-04-02 17:25:10 -0500 | [diff] [blame] | 62 | optee-os-clean: optee-os-clean-common |
| 63 | |
| 64 | optee-client: optee-client-common |
| 65 | optee-client-clean: optee-client-clean-common |
| 66 | |
| 67 | ############################################################################### |
Andrew F. Davis | f698047 | 2017-04-02 17:25:10 -0500 | [diff] [blame] | 68 | # Build FIT |
| 69 | ############################################################################### |
| 70 | .PHONY: build-fit build-fit-clean |
| 71 | |
| 72 | build-fit: prepare linux optee-os |
| 73 | cp $(LINUX_IMAGE) $(STAGING_AREA)/ |
| 74 | cp $(LINUX_DTBS) $(STAGING_AREA)/ |
| 75 | cp $(OPTEE_OS_BIN) $(STAGING_AREA)/ |
| 76 | cp $(FIT_SOURCE) $(STAGING_AREA)/fitImage.its |
| 77 | cp $(FIT_MAKEFILE) $(STAGING_AREA)/ |
| 78 | MKIMAGE=$(U-BOOT_PATH)/tools/mkimage $(MAKE) -C $(STAGING_AREA) |
| 79 | |
| 80 | build-fit-clean: |
| 81 | $(RM) $(STAGING_AREA)/Makefile |
| 82 | $(RM) $(STAGING_AREA)/fitImage.its |
| 83 | $(RM) $(STAGING_AREA)/tee.bin |
| 84 | $(RM) $(STAGING_AREA)/*.dtb |
| 85 | $(RM) $(STAGING_AREA)/zImage |
| 86 | |
| 87 | ############################################################################### |
| 88 | # Root FS |
| 89 | ############################################################################### |
Jens Wiklander | 88d027c | 2018-05-09 10:12:03 +0200 | [diff] [blame] | 90 | .PHONY: update_rootfs |
| 91 | # Make sure this is built before the buildroot target which will create the |
| 92 | # root file system based on what's in $(BUILDROOT_TARGET_ROOT) |
| 93 | buildroot: update_rootfs |
Andrew F. Davis | f698047 | 2017-04-02 17:25:10 -0500 | [diff] [blame] | 94 | |
Jens Wiklander | 88d027c | 2018-05-09 10:12:03 +0200 | [diff] [blame] | 95 | update_rootfs: u-boot build-fit |
| 96 | @mkdir -p --mode=755 $(BUILDROOT_TARGET_ROOT)/boot |
| 97 | @install -v -p --mode=644 $(UBOOT_SPL) $(BUILDROOT_TARGET_ROOT)/boot/MLO |
| 98 | @install -v -p --mode=644 $(UBOOT_IMG) \ |
| 99 | $(BUILDROOT_TARGET_ROOT)/boot/u-boot.img |
| 100 | @install -v -p --mode=644 $(STAGING_AREA)/fitImage \ |
| 101 | $(BUILDROOT_TARGET_ROOT)/boot/fitImage |