zynqmp: updated to petalinux 2020.2
Build script updated to use Petalinux 2020.2 release. Custom recipes
removed in order to use upstream recipes insted for optee and python
devtool dependencies.
Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Acked-by: Michael Grand michael.grand.mg@gmail.com
Tested-by: Michael Grand michael.grand.mg@gmail.com
diff --git a/zynqmp.mk b/zynqmp.mk
index 24defec..37a8f4b 100644
--- a/zynqmp.mk
+++ b/zynqmp.mk
@@ -1,11 +1,10 @@
-ROOT = $(PWD)/..
PLATFORM ?= zcu102
-PETALINUX_PATH ?= $(PETALINUX)
-BSP_PATH ?= ./xilinx-${PLATFORM}-v$(PETALINUX_VER)-final.bsp
-PRJ_PATH ?= $(ROOT)/$(PLATFORM)-$(PETALINUX_VER)
-PETALINUX_CFG_PATH ?= $(ROOT)/build/zynqmp
+BSP_PATH ?= ../xilinx-${PLATFORM}-v$(PETALINUX_VER)-final.bsp
+PRJ_PATH ?= ../petalinux-optee-$(PLATFORM)
OPTEE_VER ?= latest
+PYTHON_PATH ?= ${PRJ_PATH}/project-spec/meta-user/recipes-devtools/python
+
define set_cfg
@sed -i 's/$(1)=.*/$(1)=$(2)/' $(3)
endef
@@ -27,75 +26,63 @@
endif
.PHONY: all
-all: petalinux-create petalinux-config petalinux-build petalinux-package
+all: create build package
-.PHONY: check-petalinux
-check-petalinux:
+.PHONY: check
+check:
ifndef PETALINUX_VER
$(error You have to source Petalinux settings)
endif
-ifneq ($(PETALINUX_VER),2018.2)
- $(error This makefile only support Petalinux 2018.2)
+ifneq ($(PETALINUX_VER),2020.2)
+ $(error This makefile only support Petalinux 2020.2)
endif
-petalinux-create: check-petalinux
- @cd $(ROOT) && petalinux-create -n $(PLATFORM)-$(PETALINUX_VER) \
- -t project -s $(BSP_PATH)
- $(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)
- $(call set_cfg,CONFIG_SUBSYSTEM_ZYNQMP_ATF_MEM_SIZE,0x16001,$(PRJ_PATH)/project-spec/configs/config)
+create: check
+ @# Create TMP directory to avoid issues with .. in the path name
+ @mkdir -p /tmp/petalinux-optee-${PLATFORM}
+ @petalinux-create -n $(PRJ_PATH) -t project -s $(BSP_PATH) --tmpdir /tmp/petalinux-optee-${PLATFORM}
@#
- @# Replace BSP default rootfs by a minimal one to speed up building
- @# process and ease compatibility between different boards. Default
- @# rootfs is saved in rootfs_config_full file
- @mv $(PRJ_PATH)/project-spec/configs/rootfs_config \
- $(PRJ_PATH)/project-spec/configs/rootfs_config_full
- @cp $(PETALINUX_CFG_PATH)/rootfs_config \
- $(PRJ_PATH)/project-spec/configs/
+ @# Append the ATF recipe to include opteed as SPD
+ @mkdir -p ${PRJ_PATH}/project-spec/meta-user/recipes-bsp/arm-trusted-firmware
+ @cp zynqmp/arm-trusted-firmware/*.bbappend ${PRJ_PATH}/project-spec/meta-user/recipes-bsp/arm-trusted-firmware/.
@#
- @mkdir -p $(PRJ_PATH)/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/
- @cp $(PETALINUX_CFG_PATH)/kernel_optee.cfg \
- $(PRJ_PATH)/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/
- @cp $(PETALINUX_CFG_PATH)/linux-xlnx_%.bbappend \
- $(PRJ_PATH)/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend
- @cp $(PETALINUX_CFG_PATH)/system-user.dtsi \
- $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/device-tree/files/
+ @# Download optee package recipes from meta-arm layer using gatesgarth branch as there were not available for zeus
+ @curl -s https://git.yoctoproject.org/cgit/cgit.cgi/meta-arm/snapshot/meta-arm-3.2.tar.gz -o ../meta-arm-3.2.tar.gz
+ @tar -C ${PRJ_PATH}/project-spec/meta-user --strip-components=2 -xvf ../meta-arm-3.2.tar.gz meta-arm-3.2/meta-arm/recipes-security > /dev/null
@#
- @# Override default TF-A 1.4 with TF-A 1.5 because it does not work with
- @# OP-TEE
- @mkdir -p $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/arm-trusted-firmware/
- @cp -r $(PETALINUX_CFG_PATH)/arm-trusted-firmware/* \
- $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/arm-trusted-firmware/
+ @# Copy the bbapend files for our target
+ @cp zynqmp/optee/* ${PRJ_PATH}/project-spec/meta-user/recipes-security/optee/.
@#
- @petalinux-create -p $(PRJ_PATH) -t apps --template install \
- -n optee-client --enable
- @petalinux-create -p $(PRJ_PATH) -t apps --template install \
- -n optee-test --enable
- @mkdir -p $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/optee-os
- @cp -r $(PETALINUX_CFG_PATH)/optee-os/* \
- $(PRJ_PATH)/project-spec/meta-user/recipes-bsp/optee-os/
- @cp -r $(PETALINUX_CFG_PATH)/optee-client/* \
- $(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-client/
- @cp -r $(PETALINUX_CFG_PATH)/optee-test/* \
- $(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-test/
- @mkdir -p $(PRJ_PATH)/project-spec/meta-user/recipes-devtools/python
- @cp -r $(PETALINUX_CFG_PATH)/python/* \
- $(PRJ_PATH)/project-spec/meta-user/recipes-devtools/python/
-
-petalinux-config: check-petalinux
- $(call set_optee_version,$(OPTEE_VER),$(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-test/optee-test.bbappend)
- $(call set_optee_version,$(OPTEE_VER),$(PRJ_PATH)/project-spec/meta-user/recipes-apps/optee-client/optee-client.bbappend)
- $(call set_optee_version,$(OPTEE_VER),$(PRJ_PATH)/project-spec/meta-user/recipes-bsp/optee-os/optee-os.bbappend)
- @petalinux-config -p $(PRJ_PATH) --oldconfig
+ @# Download python package dependencies from meta-core layer using gatesgarth branch as there were not available for zeus
+ @mkdir -p ${PYTHON_PATH}
+ @curl -s http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/python/python3-pycryptodome_3.9.8.bb?h=gatesgarth \
+ -o ${PYTHON_PATH}/python3-pycryptodome_3.9.8.bb
+ @curl -s http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/python/python3-pycryptodomex_3.9.8.bb?h=gatesgarth \
+ -o ${PYTHON_PATH}/python3-pycryptodomex_3.9.8.bb
+ @curl -s http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/python/python3-pyelftools_0.26.bb?h=gatesgarth \
+ -o ${PYTHON_PATH}/python3-pyelftools_0.26.bb
+ @curl -s http://cgit.openembedded.org/openembedded-core/plain/meta/recipes-devtools/python/python-pycryptodome.inc?h=gatesgarth \
+ -o ${PYTHON_PATH}/python-pycryptodome.inc
+ @#
+ @# Add packages to the image
+ @echo IMAGE_INSTALL_append = \" optee-os optee-client optee-test\" >> ${PRJ_PATH}/project-spec/meta-user/conf/petalinuxbsp.conf
+ @#
+ @# Add optee kernel options to the exisiting kernel append recipe
+ @echo SRC_URI_append += \"file://kernel_optee.cfg\" >> ${PRJ_PATH}/project-spec/meta-user/recipes-kernel/linux/linux-xlnx_%.bbappend
+ @cp zynqmp/kernel/kernel_optee.cfg ${PRJ_PATH}/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/kernel_optee.cfg
+ @#
+ @# Replace exisiting user configued dts file to add optee node
+ @cp zynqmp/device-tree/system-user.dtsi ${PRJ_PATH}/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
-petalinux-build: check-petalinux
+
+build: create
@petalinux-build -p $(PRJ_PATH)
-qemu: check-petalinux
+qemu: check
@cd $(PRJ_PATH) && petalinux-boot --qemu \
--qemu-args "-device loader,file=${PRJ_PATH}/images/linux/bl32.elf" \
--kernel
-petalinux-package: check-petalinux
- @cd $(PRJ_PATH) && petalinux-package --boot --pmufw --fpga --u-boot \
- --add ${PRJ_PATH}/images/linux/bl32.elf --cpu a53-0 \
- --file-attribute "exception_level=el-1, trustzone" --force
+package: check
+ @petalinux-package --boot --pmufw --fpga --u-boot --add ${PRJ_PATH}/images/linux/tee_raw.bin --cpu a53-0 \
+ --file-attribute "load=0x60000000, startup=0x60000000, exception_level=el-1, trustzone" --force -p ${PRJ_PATH}