Andrew F. Davis | 830ceed | 2016-12-13 16:32:08 -0600 | [diff] [blame^] | 1 | ############################################################################### |
| 2 | # Following variables defines how the NS_USER (Non Secure User - Client |
| 3 | # Application), NS_KERNEL (Non Secure Kernel), S_KERNEL (Secure Kernel) and |
| 4 | # S_USER (Secure User - TA) are compiled |
| 5 | ############################################################################### |
| 6 | override COMPILE_NS_USER := 32 |
| 7 | override COMPILE_NS_KERNEL := 32 |
| 8 | override COMPILE_S_USER := 32 |
| 9 | override COMPILE_S_KERNEL := 32 |
| 10 | |
| 11 | ############################################################################### |
| 12 | # Includes |
| 13 | ############################################################################### |
| 14 | -include common.mk |
| 15 | |
| 16 | ############################################################################### |
| 17 | # Paths to git projects and various binaries |
| 18 | ############################################################################### |
| 19 | STAGING_AREA ?= $(ROOT)/out |
| 20 | U-BOOT_PATH ?= $(ROOT)/u-boot |
| 21 | UBOOT_SPL ?= $(U-BOOT_PATH)/u-boot-spl_HS_MLO |
| 22 | UBOOT_IMG ?= $(U-BOOT_PATH)/u-boot_HS.img |
| 23 | UBOOT_ENV ?= $(BUILD_PATH)/dra7xx/uEnv.txt |
| 24 | LINUX_IMAGE ?= $(LINUX_PATH)/arch/arm/boot/zImage |
| 25 | LINUX_DTBS ?= $(wildcard $(LINUX_PATH)/arch/arm/boot/dts/dra7*.dtb) |
| 26 | FIT_SOURCE ?= $(BUILD_PATH)/dra7xx/fitImage.its |
| 27 | FIT_MAKEFILE ?= $(BUILD_PATH)/dra7xx/Makefile |
| 28 | |
| 29 | ############################################################################### |
| 30 | # Targets |
| 31 | ############################################################################### |
| 32 | .PHONY: all clean cleaner prepare |
| 33 | |
| 34 | all: u-boot linux optee-os optee-client xtest helloworld build-fit update_rootfs |
| 35 | clean: linux-clean busybox-clean u-boot-clean optee-os-clean optee-client-clean build-fit-clean |
| 36 | cleaner: clean prepare-cleaner busybox-cleaner linux-cleaner |
| 37 | |
| 38 | -include toolchain.mk |
| 39 | |
| 40 | prepare: |
| 41 | @if [ ! -d $(STAGING_AREA) ]; then mkdir $(STAGING_AREA); fi |
| 42 | |
| 43 | .PHONY: prepare-cleaner |
| 44 | prepare-cleaner: |
| 45 | rm -rf $(STAGING_AREA) |
| 46 | |
| 47 | ############################################################################### |
| 48 | # Das U-Boot |
| 49 | ############################################################################### |
| 50 | .PHONY: u-boot u-boot-clean |
| 51 | |
| 52 | U-BOOT_EXPORTS ?= CROSS_COMPILE=$(CROSS_COMPILE_NS_KERNEL) ARCH=arm |
| 53 | |
| 54 | u-boot: |
| 55 | $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) dra7xx_hs_evm_defconfig |
| 56 | $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) all |
| 57 | |
| 58 | u-boot-clean: |
| 59 | $(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) clean |
| 60 | |
| 61 | ############################################################################### |
| 62 | # Linux kernel |
| 63 | ############################################################################### |
| 64 | .PHONY: linux-defconfig linux linux-defconfig-clean linux-clean linux-cleaner |
| 65 | |
| 66 | LINUX_DEFCONFIG_COMMON_ARCH := arm |
| 67 | LINUX_DEFCONFIG_COMMON_FILES := \ |
| 68 | $(LINUX_PATH)/arch/arm/configs/multi_v7_defconfig \ |
| 69 | $(LINUX_PATH)/ti_config_fragments/multi_v7_prune.cfg \ |
| 70 | $(LINUX_PATH)/ti_config_fragments/baseport.cfg \ |
| 71 | $(LINUX_PATH)/ti_config_fragments/ipc.cfg \ |
| 72 | $(LINUX_PATH)/ti_config_fragments/connectivity.cfg \ |
| 73 | $(LINUX_PATH)/ti_config_fragments/audio_display.cfg \ |
| 74 | $(LINUX_PATH)/ti_config_fragments/wlan.cfg \ |
| 75 | $(LINUX_PATH)/ti_config_fragments/omap_soc.cfg \ |
| 76 | $(LINUX_PATH)/ti_config_fragments/lpae.cfg \ |
| 77 | $(LINUX_PATH)/ti_config_fragments/dra7_only.cfg \ |
| 78 | $(LINUX_PATH)/ti_config_fragments/debug_options.cfg |
| 79 | |
| 80 | linux-defconfig: $(LINUX_PATH)/.config |
| 81 | |
| 82 | LINUX_COMMON_FLAGS += ARCH=arm |
| 83 | linux: linux-common |
| 84 | linux-defconfig-clean: linux-defconfig-clean-common |
| 85 | |
| 86 | LINUX_CLEAN_COMMON_FLAGS += ARCH=arm |
| 87 | linux-clean: linux-clean-common |
| 88 | |
| 89 | LINUX_CLEANER_COMMON_FLAGS += ARCH=arm |
| 90 | linux-cleaner: linux-cleaner-common |
| 91 | |
| 92 | ############################################################################### |
| 93 | # OP-TEE |
| 94 | ############################################################################### |
| 95 | .PHONY: optee-os optee-os-clean optee-client optee-client-clean |
| 96 | |
| 97 | OPTEE_OS_COMMON_FLAGS += PLATFORM=ti-dra7xx |
| 98 | optee-os: optee-os-common |
| 99 | |
| 100 | OPTEE_OS_CLEAN_COMMON_FLAGS += PLATFORM=ti-dra7xx |
| 101 | optee-os-clean: optee-os-clean-common |
| 102 | |
| 103 | optee-client: optee-client-common |
| 104 | optee-client-clean: optee-client-clean-common |
| 105 | |
| 106 | ############################################################################### |
| 107 | # xtest / optee_test |
| 108 | ############################################################################### |
| 109 | .PHONY: xtest xtest-clean xtest-patch |
| 110 | |
| 111 | xtest: xtest-common |
| 112 | xtest-clean: xtest-clean-common |
| 113 | xtest-patch: xtest-patch-common |
| 114 | |
| 115 | ############################################################################### |
| 116 | # hello_world |
| 117 | ############################################################################### |
| 118 | .PHONY: helloworld helloworld-clean |
| 119 | |
| 120 | helloworld: helloworld-common |
| 121 | helloworld-clean: helloworld-clean-common |
| 122 | |
| 123 | ############################################################################### |
| 124 | # Busybox |
| 125 | ############################################################################### |
| 126 | .PHONY: busybox busybox-clean busybox-cleaner |
| 127 | |
| 128 | BUSYBOX_COMMON_TARGET = dra7xx |
| 129 | BUSYBOX_CLEAN_COMMON_TARGET = dra7xx clean |
| 130 | |
| 131 | busybox: busybox-common |
| 132 | busybox-clean: busybox-clean-common |
| 133 | busybox-cleaner: busybox-cleaner-common |
| 134 | |
| 135 | ############################################################################### |
| 136 | # Build FIT |
| 137 | ############################################################################### |
| 138 | .PHONY: build-fit build-fit-clean |
| 139 | |
| 140 | build-fit: prepare linux optee-os |
| 141 | cp $(LINUX_IMAGE) $(STAGING_AREA)/ |
| 142 | cp $(LINUX_DTBS) $(STAGING_AREA)/ |
| 143 | cp $(OPTEE_OS_BIN) $(STAGING_AREA)/ |
| 144 | cp $(FIT_SOURCE) $(STAGING_AREA)/ |
| 145 | cp $(FIT_MAKEFILE) $(STAGING_AREA)/ |
| 146 | MKIMAGE=$(U-BOOT_PATH)/tools/mkimage $(MAKE) -C $(STAGING_AREA) |
| 147 | |
| 148 | build-fit-clean: |
| 149 | $(RM) $(STAGING_AREA)/Makefile |
| 150 | $(RM) $(STAGING_AREA)/fitImage.its |
| 151 | $(RM) $(STAGING_AREA)/tee.bin |
| 152 | $(RM) $(STAGING_AREA)/*.dtb |
| 153 | $(RM) $(STAGING_AREA)/zImage |
| 154 | |
| 155 | ############################################################################### |
| 156 | # Root FS |
| 157 | ############################################################################### |
| 158 | .PHONY: filelist-tee update_rootfs |
| 159 | |
| 160 | filelist-tee: filelist-tee-common u-boot build-fit |
| 161 | @echo "dir /boot 755 0 0" >> $(GEN_ROOTFS_FILELIST) |
| 162 | @echo "file /boot/MLO $(UBOOT_SPL) 644 0 0" >> $(GEN_ROOTFS_FILELIST) |
| 163 | @echo "file /boot/u-boot.img $(UBOOT_IMG) 644 0 0" >> $(GEN_ROOTFS_FILELIST) |
| 164 | @echo "file /boot/uEnv.txt $(UBOOT_ENV) 644 0 0" >> $(GEN_ROOTFS_FILELIST) |
| 165 | @echo "file /boot/fitImage.itb $(STAGING_AREA)/fitImage.itb 644 0 0" >> $(GEN_ROOTFS_FILELIST) |
| 166 | |
| 167 | update_rootfs: update_rootfs-common |