Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 1 | ROOT = $(PWD)/.. |
| 2 | PLATFORM ?= zcu102 |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 3 | PETALINUX_PATH ?= $(PETALINUX) |
| 4 | BSP_PATH ?= ./xilinx-${PLATFORM}-v$(PETALINUX_VER)-final.bsp |
| 5 | PRJ_PATH ?= $(ROOT)/$(PLATFORM)-$(PETALINUX_VER) |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 6 | PETALINUX_CFG_PATH ?= $(ROOT)/build/zynqmp |
| 7 | OPTEE_VER ?= latest |
| 8 | |
| 9 | define set_cfg |
| 10 | @sed -i 's/$(1)=.*/$(1)=$(2)/' $(3) |
| 11 | endef |
| 12 | |
| 13 | define set_optee_version |
| 14 | @if [ "$(1)" != "latest" ]; then \ |
| 15 | echo 'OPTEE_VERSION ?= "$(1)"' > $(2); \ |
| 16 | echo 'SRCREV ?= "$(1)"' >> $(2); \ |
| 17 | else \ |
| 18 | echo 'OPTEE_VERSION ?= "latest"' > $(2); \ |
| 19 | echo 'SRCREV ?= "$${AUTOREV}"' >> $(2); \ |
| 20 | fi |
| 21 | endef |
| 22 | |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 23 | ifeq ($(PLATFORM),ultra96-reva) |
| 24 | ZYNQMP_CONSOLE=cadence1 |
| 25 | else |
| 26 | ZYNQMP_CONSOLE=cadence0 |
| 27 | endif |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 28 | |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 29 | .PHONY: all |
| 30 | all: petalinux-create petalinux-config petalinux-build petalinux-package |
| 31 | |
| 32 | .PHONY: check-petalinux |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 33 | check-petalinux: |
| 34 | ifndef PETALINUX_VER |
| 35 | $(error You have to source Petalinux settings) |
| 36 | endif |
| 37 | ifneq ($(PETALINUX_VER),2018.2) |
| 38 | $(error This makefile only support Petalinux 2018.2) |
| 39 | endif |
| 40 | |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 41 | petalinux-create: check-petalinux |
| 42 | @cd $(ROOT) && petalinux-create -n $(PLATFORM)-$(PETALINUX_VER) \ |
| 43 | -t project -s $(BSP_PATH) |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 44 | $(call set_cfg,CONFIG_SUBSYSTEM_ATF_COMPILE_EXTRA_SETTINGS,"SPD=opteed ZYNQMP_BL32_MEM_BASE=0x60000000 ZYNQMP_BL32_MEM_SIZE=0x80000",$(PRJ_PATH)/project-spec/configs/config) |
| 45 | $(call set_cfg,CONFIG_SUBSYSTEM_ZYNQMP_ATF_MEM_SIZE,0x16001,$(PRJ_PATH)/project-spec/configs/config) |
| 46 | @# |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 47 | @# Replace BSP default rootfs by a minimal one to speed up building |
| 48 | @# process and ease compatibility between different boards. Default |
| 49 | @# rootfs is saved in rootfs_config_full file |
| 50 | @mv $(PRJ_PATH)/project-spec/configs/rootfs_config \ |
| 51 | $(PRJ_PATH)/project-spec/configs/rootfs_config_full |
| 52 | @cp $(PETALINUX_CFG_PATH)/rootfs_config \ |
| 53 | $(PRJ_PATH)/project-spec/configs/ |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 54 | @# |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 55 | @mkdir -p $(PRJ_PATH)/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/ |
| 56 | @cp $(PETALINUX_CFG_PATH)/kernel_optee.cfg \ |
| 57 | $(PRJ_PATH)/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/ |
| 58 | @cp $(PETALINUX_CFG_PATH)/linux-xlnx_%.bbappend \ |
| 59 | $(PRJ_PATH)/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend |
| 60 | @cp $(PETALINUX_CFG_PATH)/system-user.dtsi \ |
| 61 | $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/device-tree/files/ |
| 62 | @# |
| 63 | @# Override default TF-A 1.4 with TF-A 1.5 because it does not work with |
| 64 | @# OP-TEE |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 65 | @mkdir -p $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/arm-trusted-firmware/ |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 66 | @cp -r $(PETALINUX_CFG_PATH)/arm-trusted-firmware/* \ |
| 67 | $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/arm-trusted-firmware/ |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 68 | @# |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 69 | @petalinux-create -p $(PRJ_PATH) -t apps --template install \ |
| 70 | -n optee-client --enable |
| 71 | @petalinux-create -p $(PRJ_PATH) -t apps --template install \ |
| 72 | -n optee-test --enable |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 73 | @mkdir -p $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/optee-os |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 74 | @cp -r $(PETALINUX_CFG_PATH)/optee-os/* \ |
| 75 | $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/optee-os/ |
| 76 | @cp -r $(PETALINUX_CFG_PATH)/optee-client/* \ |
| 77 | $(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-client/ |
| 78 | @cp -r $(PETALINUX_CFG_PATH)/optee-test/* \ |
| 79 | $(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-test/ |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 80 | |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 81 | petalinux-config: check-petalinux |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 82 | $(call set_optee_version,$(OPTEE_VER),$(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-test/optee-test.bbappend) |
| 83 | $(call set_optee_version,$(OPTEE_VER),$(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-client/optee-client.bbappend) |
| 84 | $(call set_optee_version,$(OPTEE_VER),$(PRJ_PATH)/project-spec/meta-user/recipes-bsp/optee-os/optee-os.bbappend) |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 85 | @petalinux-config -p $(PRJ_PATH) --oldconfig |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 86 | |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 87 | petalinux-build: check-petalinux |
| 88 | @petalinux-build -p $(PRJ_PATH) |
Michael Grand | b76287b | 2019-02-24 23:38:57 +0100 | [diff] [blame] | 89 | |
Michael Grand | 08b8dde | 2019-03-13 17:56:04 +0100 | [diff] [blame^] | 90 | qemu: check-petalinux |
| 91 | @cd $(PRJ_PATH) && petalinux-boot --qemu \ |
| 92 | --qemu-args "-device loader,file=${PRJ_PATH}/images/linux/bl32.elf" \ |
| 93 | --kernel |
| 94 | |
| 95 | petalinux-package: check-petalinux |
| 96 | @cd $(PRJ_PATH) && petalinux-package --boot --pmufw --fpga --u-boot \ |
| 97 | --add ${PRJ_PATH}/images/linux/bl32.elf --cpu a53-0 \ |
| 98 | --file-attribute "exception_level=el-1, trustzone" --force |