Add Xilinx ZynqMP and ZCU106 board support
v5 cover Add Xilinx ZynqMP and ZCU106 board support
Hi,
this patchset adds basic support for the ZynqMP family of ARM64 SoC+FPGA by Xilinx and for the ZCU106 board based on it.
The ZynqMP sets a few challenges that needed some work besides the usual defconfig + readme that is enough for more classic and simple SoCs.
This v5 addresses the comments received to v4 by Joel (BR2_EXTERNAL not working). It also fixes support for providing a PMU firmware as a local file, while keeping the ability to download it.
I reordered the patches w.r.t. v4. Here's their summary.
The first issue is the PMU (Platform Management Unit). It is a Microblaze core that handles power and clock gating and the like, and reprogramming it during early boot is necessary to boot any modern U-Boot and Linux. Since we can't build Microblaze code out of the ARM64 toolchain, U-Boot obtains a pre-built binary either from a local file or downloaded using EXTRA_DOWNLOADS. This is added in patch
1. Until v3, the PMUFW had to be copied inside the U-Boot source. With a patch from upstream it is now possible to avoid the copy.
With this in place, patch 2 just adds the defconfig and board files.
Patch 3 allows to pass an externally-supplied init file to U-Boot, which is needed to boot boards not supported in the U-Boot source code, or on the same boards but with a different configuration. Instead of copying the user-provided file inside the U-Boot source as in v3, I applied a patch from upstream so U-Boot is able to build that file without any copy. ZCU106 is supported by mainline U-Boot with a default configuration and thus it does not need this patch, so I have moved it at the end.
Luca
Luca Ceresoli (3):
uboot: zynqmp: generate SPL image with PMUFW binary configs/zynqmp_zcu106_defconfig: add Xilinx ZCU106 board (ZynqMP SoC)
uboot: zynqmp: allow to use custom psu_init files
DEVELOPERS | 2 + board/zynqmp/genimage.cfg | 28 +++ ...64-zynqmp-zcu106-fix-SPL-MMC-booting.patch | 52 ++++++ ...2-arm64-zynqmp-Enable-booting-to-ATF.patch | 114 ++++++++++++ ...ept-an-absolute-path-for-PMUFW_INIT_.patch | 68 +++++++ ...ynqmp-pass-the-PS-init-file-as-a-kco.patch | 175 ++++++++++++++++++ board/zynqmp/post-image.sh | 13 ++ board/zynqmp/readme.txt | 51 +++++ boot/uboot/Config.in | 52 ++++++ boot/uboot/uboot.mk | 34 ++++ configs/zynqmp_zcu106_defconfig | 34 ++++ 11 files changed, 623 insertions(+) create mode 100644 board/zynqmp/genimage.cfg create mode 100644 board/zynqmp/patches/uboot/0001-arm64-zynqmp-zcu106-fix-SPL-MMC-booting.patch create mode 100644 board/zynqmp/patches/uboot/0002-arm64-zynqmp-Enable-booting-to-ATF.patch create mode 100644 board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch create mode 100644 board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch create mode 100755 board/zynqmp/post-image.sh create mode 100644 board/zynqmp/readme.txt create mode 100644 configs/zynqmp_zcu106_defconfig
Signature · 1 line
2.17.1
PATCH v5 1/3 uboot: zynqmp: generate SPL image with PMUFW binary
In order to boot on the Xilinx ZynqMP SoCs, U-Boot SPL requires a recent PMU firmware loaded. Instruct U-Boot to add pmufw.bin to the boot.bin file together with U-Boot SPL, and the boot ROM will load both.
For this to work properly, a patch to U-Boot is needed. However this patch must be applied by each defconfig that wishes to use BR2_TARGET_UBOOT_ZYNQMP_PMUFW. If it were in boot/uboot/ to be applied unconditionally, it would break the build for configs using a U-Boot version higher than 2018.7-rc1 where the patch is already applied.
---
Changes v4 -> v5:
- accept either a path (absolute or relative) or an URL to be downloaded
- moved before "uboot: zynqmp: allow to use custom psu_init files"
Changes v3 -> v4:
- don't copy the pmufw binary in the source tree, use an absolute path to the download dir (which needs a patch from upstream to work)
- depend on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG (Thomas)
Changes v2 -> v3:
- don't use a "zynqmp-pmufw-binaries" package, just download a file
- define kconfig fixups in a variable, then define UBOOT_KCONFIG_FIXUP_CMDS unconditionally at global scope (Thomas)
- use $(INSTALL), not cp (Thomas)
- $(...) instead of ${...} to reference make variables (Thomas)
Changes v1 -> v2:
- split from a larger patch doing 2 things.
--- ...ept-an-absolute-path-for-PMUFW_INIT_.patch | 68 +++++++++++++++++++ boot/uboot/Config.in | 29 ++++++++ boot/uboot/uboot.mk | 24 +++++++ 3 files changed, 121 insertions(+) create mode 100644 board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch
board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch new file +68 -0
@@ -0,0 +1,68 @@ +From c7df098a71e05dc81cee818747759e8060b59626 Mon Sep 17 00:00:00 2001 +From: Luca Ceresoli <[email protected]> +Date: Mon, 4 Jun 2018 12:21:01 +0200 +Subject: [PATCH] arm64: zynqmp: accept an absolute path for PMUFW_INIT_FILE + +The value of PMUFW_INIT_FILE is prefixed with "$(srctree)/", thus +forcing it to be a relative path inside the U-Boot source tree. Since +the PMUFW is a binary file generated outside of U-Boot, the PMUFW +binary must be copied inside the U-Boot source tree before the +build. + +This generates a few problems: + + * if the source tree is shared among different out-of-tree builds, + they will pollute (and potentially corrupt) each other + * the source tree cannot be read-only + * any buildsystem must add a command to copy the PMUFW binary + * putting an externally-generated binary in the source tree is ugly + as hell + +Avoid these problems by accepting an absolute path for +PMUFW_INIT_FILE. This would be as simple as removing the "$(srctree)/" +prefix, but in order to keep backward compatibility we rather use the +shell and readlink to get the absolute path even when starting from a +relative path. + +Since 'readlink -f' produces an empty string if the file does not +exist, we also add a check to ensure the file configured in +PMUFW_INIT_FILE exists. Otherwise the build would exit successfully, +but produce a boot.bin without PMUFW as if PMUFW_INIT_FILE were empty. + +Tested in the 12 possible combinations of: + - PMUFW_INIT_FILE empty, relative, absolute, non-existing + - building in-tree, in subdir, in other directory + +Signed-off-by: Luca Ceresoli <[email protected]> +Cc: Michal Simek <[email protected]> +Cc: Simon Glass <[email protected]> +Cc: Emmanuel Vadot <[email protected]> +Signed-off-by: Michal Simek <[email protected]> +Backported from upstream: https://git.denx.de/?p=u-boot.git;a=commit;h=c7df098a71e05dc81cee818747759e8060b59626 +--- + scripts/Makefile.spl | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl +index ef018b5b4056..252f13826d4c 100644 +--- a/scripts/Makefile.spl ++++ b/scripts/Makefile.spl +@@ -167,8 +167,14 @@ ifdef CONFIG_ARCH_ZYNQ + MKIMAGEFLAGS_boot.bin = -T zynqimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) + endif + ifdef CONFIG_ARCH_ZYNQMP ++ifneq ($(CONFIG_PMUFW_INIT_FILE),"") ++spl/boot.bin: zynqmp-check-pmufw ++zynqmp-check-pmufw: FORCE ++ ( cd $(srctree) && test -r $(CONFIG_PMUFW_INIT_FILE) ) \ ++ || ( echo "Cannot read $(CONFIG_PMUFW_INIT_FILE)" && false ) ++endif + MKIMAGEFLAGS_boot.bin = -T zynqmpimage -R $(srctree)/$(CONFIG_BOOT_INIT_FILE) \ +- -n $(srctree)/$(CONFIG_PMUFW_INIT_FILE) ++ -n "$(shell cd $(srctree); readlink -f $(CONFIG_PMUFW_INIT_FILE))" + endif + + spl/boot.bin: $(obj)/u-boot-spl.bin FORCE +-- +2.7.4 +
boot/uboot/Config.in +29 -0
@@ -368,6 +368,35 @@ config BR2_TARGET_UBOOT_ZYNQ_IMAGE for u-boot-dtb.img file so this U-Boot format is required to be set. +config BR2_TARGET_UBOOT_ZYNQMP + bool "Boot on the Xilinx ZynqMP SoCs" + depends on BR2_aarch64 + help + Enable options specific to the Xilinx ZynqMP family of SoCs. + +if BR2_TARGET_UBOOT_ZYNQMP + +config BR2_TARGET_UBOOT_ZYNQMP_PMUFW + string "PMU firmware location" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + Location of a PMU firmware binary. + + If not empty, instructs the U-Boot build process to generate + a boot.bin (to be loaded by the ZynqMP boot ROM) containing + both the U-Boot SPL and the PMU firmware in the + Xilinx-specific boot format. + + The value can be an absolute or relative path, and will be + used directly from where it is located, or an URI + (e.g. http://...), and it will be downloaded and used from + the download directory. + + If empty, the generated boot.bin will not contain a PMU + firmware. + +endif + config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC bool "CRC image for Altera SoC FPGA (mkpimage)" depends on BR2_arm
boot/uboot/uboot.mk +24 -0
@@ -287,6 +287,26 @@ define UBOOT_INSTALL_IMAGES_CMDS $(BINARIES_DIR)/boot.scr) endef +ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) + +UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW)) + +ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),) +UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW) +BR_NO_CHECK_HASH_FOR += $(notdir $(UBOOT_ZYNQMP_PMUFW)) +define UBOOT_ZYNQMP_KCONFIG_PMUFW + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_DL_DIR)/$(notdir $(UBOOT_ZYNQMP_PMUFW))", \ + $(@D)/.config) +endef +else ifneq ($(UBOOT_ZYNQMP_PMUFW),) +define UBOOT_ZYNQMP_KCONFIG_PMUFW + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(shell readlink -f $(UBOOT_ZYNQMP_PMUFW))", \ + $(@D)/.config) +endef +endif + +endif # BR2_TARGET_UBOOT_ZYNQMP + define UBOOT_INSTALL_OMAP_IFT_IMAGE cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/ endef
@@ -336,6 +356,10 @@ UBOOT_DEPENDENCIES += host-mkpimage UBOOT_POST_INSTALL_IMAGES_HOOKS += UBOOT_CRC_ALTERA_SOCFPGA_IMAGE endif +define UBOOT_KCONFIG_FIXUP_CMDS + $(UBOOT_ZYNQMP_KCONFIG_PMUFW) +endef + ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y) ifeq ($(BR_BUILDING),y) ifeq ($(call qstrip,$(BR2_TARGET_UBOOT_ENVIMAGE_SOURCE)),)
Signature · 1 line
2.17.1
PATCH v5 1/3 uboot: zynqmp: generate SPL image with PMUFW binary
Luca,
Quoted 5 lines · Luca Ceresoli
In order to boot on the Xilinx ZynqMP SoCs, U-Boot SPL requires a recent PMU firmware loaded. Instruct U-Boot to add pmufw.bin to the boot.bin file together with U-Boot SPL, and the boot ROM will load both.
Quoted 8 lines
For this to work properly, a patch to U-Boot is needed. However this patch must be applied by each defconfig that wishes to use
BR2_TARGET_UBOOT_ZYNQMP_PMUFW. If it were in boot/uboot/ to be applied unconditionally, it would break the build for configs using a U-Boot version higher than 2018.7-rc1 where the patch is already applied.Signed-off-by Luca Ceresoli <[email protected]>Cc Joel Carlson <[email protected]>
My testing: I have my own branch off of 2018.05.1. I removed the v4 patches and applied these v5 patches. With minor changes to my defconfig to match the changes in this version, I did a clean build and verified my zynqmp dev board still boots. I am using U-Boot 2018.07 which already contains the patch here, so I did not use the provided patch in my build. The PMUFW I obtain is a local path using a $(BR2_EXTERNAL) variable, rather than a URI of some sort.
PATCH v5 1/3 uboot: zynqmp: generate SPL image with PMUFW binary
In reply to Luca CeresoliHello,
Quoted 5 lines · Luca Ceresoli
In order to boot on the Xilinx ZynqMP SoCs, U-Boot SPL requires a recent PMU firmware loaded. Instruct U-Boot to add pmufw.bin to the boot.bin file together with U-Boot SPL, and the boot ROM will load both.
Quoted 8 lines
For this to work properly, a patch to U-Boot is needed. However this patch must be applied by each defconfig that wishes to use
BR2_TARGET_UBOOT_ZYNQMP_PMUFW. If it were in boot/uboot/ to be applied unconditionally, it would break the build for configs using a U-Boot version higher than 2018.7-rc1 where the patch is already applied.Signed-off-by Luca Ceresoli <[email protected]>Cc Joel Carlson <[email protected]>
I have applied, with some minor changes, see below.
Quoted 8 lines
boot/uboot/Config.in +8
-0+config BR2_TARGET_UBOOT_ZYNQMP_PMUFW + string "PMU firmware location" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + Location of a PMU firmware binary. + + If not empty, instructs the U-Boot build process to generate + a boot.bin (to be loaded by the ZynqMP boot ROM) containing
boot/uboot/Config.in config BR2_TARGET_UBOOT_ZYNQ_IMAGE · line 396
Quoted 10 lines
boot/uboot/Config.in +10
-0+ both the U-Boot SPL and the PMU firmware in the + Xilinx-specific boot format. + + The value can be an absolute or relative path, and will be + used directly from where it is located, or an URI + (e.g. http://...), and it will be downloaded and used from + the download directory. + + If empty, the generated boot.bin will not contain a PMU + firmware.
I've added a note explaining that this feature requires U-Boot >= 2018.07.
Quoted 7 lines
boot/uboot/uboot.mk +7
-0+ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) + +UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW)) + +ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),) +UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW) +BR_NO_CHECK_HASH_FOR += $(notdir $(UBOOT_ZYNQMP_PMUFW))
boot/uboot/uboot.mk define UBOOT_INSTALL_IMAGES_CMDS · line 306
Quoted 10 lines
boot/uboot/uboot.mk +10
-0+define UBOOT_ZYNQMP_KCONFIG_PMUFW + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_DL_DIR)/$(notdir $(UBOOT_ZYNQMP_PMUFW))", \ + $(@D)/.config) +endef +else ifneq ($(UBOOT_ZYNQMP_PMUFW),) +define UBOOT_ZYNQMP_KCONFIG_PMUFW + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(shell readlink -f $(UBOOT_ZYNQMP_PMUFW))", \ + $(@D)/.config) +endef +endif
I've refactored this to avoid the duplication of UBOOT_ZYNQMP_KCONFIG_PMUFW. Instead, I've defined UBOOT_ZYNQMP_PMUFW_PATH which contains the path to the PMU firmware, and used it in a single definition of UBOOT_ZYNQMP_KCONFIG_PMUFW.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH v5 1/3 uboot: zynqmp: generate SPL image with PMUFW binary
Hi Thomas,
Quoted 56 lines · Thomas Petazzoni
Hello,
Quoted 5 lines · Luca Ceresoli
In order to boot on the Xilinx ZynqMP SoCs, U-Boot SPL requires a recent PMU firmware loaded. Instruct U-Boot to add pmufw.bin to the boot.bin file together with U-Boot SPL, and the boot ROM will load both.
Quoted 8 lines
For this to work properly, a patch to U-Boot is needed. However this patch must be applied by each defconfig that wishes to use
BR2_TARGET_UBOOT_ZYNQMP_PMUFW. If it were in boot/uboot/ to be applied unconditionally, it would break the build for configs using a U-Boot version higher than 2018.7-rc1 where the patch is already applied.Signed-off-by Luca Ceresoli <[email protected]>Cc Joel Carlson <[email protected]>I have applied, with some minor changes, see below.
Quoted 8 lines
boot/uboot/Config.in +8
-0+config BR2_TARGET_UBOOT_ZYNQMP_PMUFW + string "PMU firmware location" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + Location of a PMU firmware binary. + + If not empty, instructs the U-Boot build process to generate + a boot.bin (to be loaded by the ZynqMP boot ROM) containingboot/uboot/Config.in config BR2_TARGET_UBOOT_ZYNQ_IMAGE · line 396
Quoted 10 lines
boot/uboot/Config.in +10
-0+ both the U-Boot SPL and the PMU firmware in the + Xilinx-specific boot format. + + The value can be an absolute or relative path, and will be + used directly from where it is located, or an URI + (e.g. http://...), and it will be downloaded and used from + the download directory. + + If empty, the generated boot.bin will not contain a PMU + firmware.I've added a note explaining that this feature requires U-Boot >= 2018.07.
Quoted 14 lines
boot/uboot/uboot.mk +14
-0+ifeq ($(BR2_TARGET_UBOOT_ZYNQMP),y) + +UBOOT_ZYNQMP_PMUFW = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PMUFW)) + +ifneq ($(findstring ://,$(UBOOT_ZYNQMP_PMUFW)),) +UBOOT_EXTRA_DOWNLOADS += $(UBOOT_ZYNQMP_PMUFW) +BR_NO_CHECK_HASH_FOR += $(notdir $(UBOOT_ZYNQMP_PMUFW)) +define UBOOT_ZYNQMP_KCONFIG_PMUFW + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_DL_DIR)/$(notdir $(UBOOT_ZYNQMP_PMUFW))", \ + $(@D)/.config) +endef +else ifneq ($(UBOOT_ZYNQMP_PMUFW),) +define UBOOT_ZYNQMP_KCONFIG_PMUFW + $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(shell readlink -f $(UBOOT_ZYNQMP_PMUFW))", \
Quoted 8 lines
boot/uboot/uboot.mk define UBOOT_INSTALL_IMAGES_CMDS · line 306
Quoted 3 lines
boot/uboot/uboot.mk +3
-0+ $(@D)/.config) +endef +endifI've refactored this to avoid the duplication of
UBOOT_ZYNQMP_KCONFIG_PMUFW. Instead, I've definedUBOOT_ZYNQMP_PMUFW_PATHwhich contains the path to the PMU firmware, and used it in a single definition ofUBOOT_ZYNQMP_KCONFIG_PMUFW.
Good idea.
Thanks for taking care of this.
Signature · 1 line
Luca
PATCH v5 2/3 configs/zynqmp_zcu106_defconfig: add Xilinx ZCU106 board (ZynqMP SoC)
In reply to Luca CeresoliThis adds support the Xilinx ZCU106 development board.
---
Changes v4 -> v5:
- bump pmufw binary from 2017.1 to 2017.4
Changes v3 -> v4:
- specify an explicit ATF version in the defconfig and use 1.5 (Thomas)
- update readme.txt
Changes v2 -> v3:
- adapt to changed ATF option name (BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31_UBOOT)
- adapt to the new pmufw implementation in uboot (no zynqmp-pmufw-binaries package, just a downloadable file)
- patches now upstream, update patch files
Changes v1 -> v2:
- don't provide psu_init files: the xilinx master branch has a defconfig that works (with 2 patches)
--- DEVELOPERS | 2 + board/zynqmp/genimage.cfg | 28 +++++ ...64-zynqmp-zcu106-fix-SPL-MMC-booting.patch | 52 ++++++++ ...2-arm64-zynqmp-Enable-booting-to-ATF.patch | 114 ++++++++++++++++++ board/zynqmp/post-image.sh | 13 ++ board/zynqmp/readme.txt | 51 ++++++++ configs/zynqmp_zcu106_defconfig | 34 ++++++ 7 files changed, 294 insertions(+) create mode 100644 board/zynqmp/genimage.cfg create mode 100644 board/zynqmp/patches/uboot/0001-arm64-zynqmp-zcu106-fix-SPL-MMC-booting.patch create mode 100644 board/zynqmp/patches/uboot/0002-arm64-zynqmp-Enable-booting-to-ATF.patch create mode 100755 board/zynqmp/post-image.sh create mode 100644 board/zynqmp/readme.txt create mode 100644 configs/zynqmp_zcu106_defconfig
DEVELOPERS +2 -0
@@ -1162,8 +1162,10 @@ F: package/ti-sgx-um/ N: Luca Ceresoli <[email protected]> F: board/olimex/a20_olinuxino/ F: board/zynq/ +F: board/zynqmp/ F: configs/olimex_a20_olinuxino_* F: configs/zynq_zed_defconfig +F: configs/zynqmp_zcu106_defconfig F: package/agentpp/ F: package/exim/ F: package/libpjsip/
board/zynqmp/genimage.cfg new file +28 -0
@@ -0,0 +1,28 @@ +image boot.vfat { + vfat { + files = { + "boot.bin", + "u-boot.bin", + "atf-uboot.ub", + "system.dtb", + "Image" + } + } + size = 32M +} + +image sdcard.img { + hdimage { + } + + partition boot { + partition-type = 0xC + bootable = "true" + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext4" + } +}
board/zynqmp/patches/uboot/0001-arm64-zynqmp-zcu106-fix-SPL-MMC-booting.patch new file +52 -0
52 lines not on this page · raw message
board/zynqmp/patches/uboot/0002-arm64-zynqmp-Enable-booting-to-ATF.patch new file +114 -0
114 lines not on this page · raw message
board/zynqmp/post-image.sh new file +13 -0
@@ -0,0 +1,13 @@ +#!/bin/sh + +# By default U-Boot loads DTB from a file named "system.dtb", so +# let's use a symlink with that name that points to the *first* +# devicetree listed in the config. + +FIRST_DT=$(sed -nr \ + -e 's|^BR2_LINUX_KERNEL_INTREE_DTS_NAME="xilinx/([-_/[:alnum:]]*).*"$|\1|p' \ + ${BR2_CONFIG}) + +[ -z "${FIRST_DT}" ] || ln -fs ${FIRST_DT}.dtb ${BINARIES_DIR}/system.dtb + +support/scripts/genimage.sh -c board/zynqmp/genimage.cfg
board/zynqmp/readme.txt new file +51 -0
51 lines not on this page · raw message
configs/zynqmp_zcu106_defconfig new file +34 -0
@@ -0,0 +1,34 @@ +BR2_aarch64=y +BR2_GLOBAL_PATCH_DIR="board/zynqmp/patches/" +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_9=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/zynqmp/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://github.com/Xilinx/linux-xlnx.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="xilinx-v2017.4" +BR2_LINUX_KERNEL_DEFCONFIG="xilinx_zynqmp" +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="xilinx/zynqmp-zcu106-revA" +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_ARM_TRUSTED_FIRMWARE=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_URL="https://github.com/ARM-software/arm-trusted-firmware.git" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION="v1.5" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="zynqmp" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31_UBOOT=y +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_GIT=y +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="git://github.com/xilinx/u-boot-xlnx.git" +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="228801a215909365ae1dcdd799034195ad7264f7" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="xilinx_zynqmp_zcu106_revA" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/boot.bin" +BR2_TARGET_UBOOT_ZYNQMP=y +BR2_TARGET_UBOOT_ZYNQMP_PMUFW="https://github.com/lucaceresoli/zynqmp-pmufw-binaries/raw/53fdb7b6c92860ceb0ec5fd14deee302f4a84269/bin/pmufw-zcu106-default-v2017.4.bin" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y
Signature · 1 line
2.17.1
PATCH v5 2/3 configs/zynqmp_zcu106_defconfig: add Xilinx ZCU106 board (ZynqMP SoC)
Luca,
Quoted 5 lines · Luca Ceresoli
This adds support the Xilinx ZCU106 development board.
[Tested on the ES2 (Engineering Sample 2) version of the board]Signed-off-by Luca Ceresoli <[email protected]>Cc Joel Carlson <[email protected]>
Just did a basic compile check to make sure everything built successfully. I unfortunately don't have a ZCU106 board to try this on. But I wanted to do something since I was reviewing/testing patches 1 and 3 in this series as well.
PATCH v5 2/3 configs/zynqmp_zcu106_defconfig: add Xilinx ZCU106 board (ZynqMP SoC)
In reply to Luca CeresoliHello,
Quoted 5 lines · Luca Ceresoli
This adds support the Xilinx ZCU106 development board.
[Tested on the ES2 (Engineering Sample 2) version of the board]Signed-off-by Luca Ceresoli <[email protected]>Cc Joel Carlson <[email protected]>
I've applied. Just two minor nits below.
Quoted 7 lines
DEVELOPERS | 2 + board/zynqmp/genimage.cfg | 28 +++++ ...64-zynqmp-zcu106-fix-SPL-MMC-booting.patch | 52 ++++++++ ...2-arm64-zynqmp-Enable-booting-to-ATF.patch | 114 ++++++++++++++++++ board/zynqmp/post-image.sh | 13 ++ board/zynqmp/readme.txt | 51 ++++++++ configs/zynqmp_zcu106_defconfig | 34 ++++++
I've regenerated the .gitlab-ci.yml file.
Quoted 1 line
+Subject: [PATCH 1/2] arm64: zynqmp: zcu106: fix SPL MMC booting
The [PATCH 1/2] should have been just [PATCH].
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH v5 3/3 uboot: zynqmp: allow to use custom psu_init files
In reply to Luca CeresoliU-Boot SPL configures pinmuxes, clocks and other low-level devices. On the Xilinx ZynqMP SoCs the code to do this resides in a file called psu_init_gpl.c which is initially generated by the Xilinx development tools. Add an option to pass these files from the outside (e.g. in the board files).
For this to work properly, a patch to U-Boot is needed. However this patch must be applied by each defconfig using BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR. If it were in boot/uboot/ to be applied unconditionally, it would break the build for configs using a U-Boot version where the patch is already applied.
---
Changes v4 -> v5:
- Use readlink to always point to the correct file, to fix BR2_EXTERNAL (Joel)
- Define an intermediate UBOOT_ZYNQMP_PSU_INIT variable instead of calculating its qstripped value twice (Thomas)
- the patch is now upstream, update it
Changes v3 -> v4:
- don't copy the psu_init file(s) in the source tree, point to its path (which needs a patch sent upstream to work)
- depend on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG (Thomas)
- point to the file, not the directory
Changes v2 -> v3:
- Add a bool option to show/hidw all ZynqMP-specific config knobs
- Move this patch before "uboot: zynqmp: generate SPL image with PMUFW binary"
- Reword Config.in text
Changes v1 -> v2:
- split from a larger patch doing 2 things
- document the option of having psu_init_gpl.c without .h
--- ...ynqmp-pass-the-PS-init-file-as-a-kco.patch | 175 ++++++++++++++++++ boot/uboot/Config.in | 23 +++ boot/uboot/uboot.mk | 10 + 3 files changed, 208 insertions(+) create mode 100644 board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch
board/zynqmp/patches/uboot/0004-arm-arm64-zynq-zynqmp-pass-the-PS-init-file-as-a-kco.patch new file +175 -0
@@ -0,0 +1,175 @@ +From 4c9d54ab5a41d65000c8d249b6fb1b76056f1812 Mon Sep 17 00:00:00 2001 +From: Luca Ceresoli <[email protected]> +Date: Wed, 20 Jun 2018 12:11:50 +0200 +Subject: [PATCH] arm/arm64: zynq/zynqmp: pass the PS init file as a kconfig + variable + +U-Boot needs to link ps7_init_gpl.c on Zynq or psu_init_gpl.c on +ZynqMP (PS init for short). The current logic to locate this file for +both platforms is: + + 1. if a board-specific file exists in + board/xilinx/zynq[mp]/$(CONFIG_DEFAULT_DEVICE_TREE)/ps?_init_gpl.c + then use it + 2. otherwise use board/xilinx/zynq/ps?_init_gpl.c + +In the latter case the file does not exist in the U-Boot sources and +must be copied in the source tree from the outside before starting the +build. This is typical when it is generated from Xilinx tools while +developing a custom hardware. However making sure that a +board-specific file is _not_ found (and used) requires some trickery +such as removing or overwriting all PS init files (e.g.: the current +meta-xilinx yocto layer [0]). + +This generates a few problems: + + * if the source tree is shared among different out-of-tree builds, + they will pollute (and potentially corrupt) each other + * the source tree cannot be read-only + * any buildsystem must add a command to copy the PS init file binary + * overwriting or deleting files in the source tree is ugly as hell + +Simplify usage by allowing to pass the path to the desired PS init +file in kconfig variable XILINX_PS_INIT_FILE. It can be an absolute +path or relative to $(srctree). If the variable is set, the +user-specified file will always be used without being copied +around. If the the variable is left empty, for backward compatibility +fall back to the old behaviour. + +Since the issue is the same for Zynq and ZynqMP, add one kconfig +variable in a common place and use it for both. + +Also use the new kconfig help text to document all the ways to give +U-Boot the PS init file. + +Build-tested with all combinations of: + - platform: zynq or zynqmp + - PS init file: from XILINX_PS_INIT_FILE (absolute, relative path, + non-existing), in-tree board-specific, in board/xilinx/zynq[mp]/ + - building in-tree, in subdir, in other directory + +[0] https://github.com/Xilinx/meta-xilinx/blob/b2f74cc7fe5c4881589d5e440a17cb51fc66a7ab/meta-xilinx-bsp/recipes-bsp/u-boot/u-boot-spl-zynq-init.inc#L9 + +Signed-off-by: Luca Ceresoli <[email protected]> +Cc: Albert Aribaud <[email protected]> +Cc: Michal Simek <[email protected]> +Cc: Nathan Rossi <[email protected]> +Backported from upstream: https://git.denx.de/?p=u-boot.git;a=commit;h=6da4f67ad09cd8b311d77b2b04e557b7ef65b56c +--- + arch/arm/Kconfig | 1 + + board/xilinx/Kconfig | 41 +++++++++++++++++++++++++++++++++++++++++ + board/xilinx/zynq/Makefile | 10 +++++++++- + board/xilinx/zynqmp/Makefile | 10 +++++++++- + 4 files changed, 60 insertions(+), 2 deletions(-) + create mode 100644 board/xilinx/Kconfig + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 22234cde2ab6..e04979d0ef7e 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -1293,4 +1293,5 @@ source "board/technologic/ts4600/Kconfig" + source "board/vscom/baltos/Kconfig" + source "board/woodburn/Kconfig" + source "board/work-microwave/work_92105/Kconfig" ++source "board/xilinx/Kconfig" + source "board/zipitz2/Kconfig" + + source "arch/arm/Kconfig.debug" +diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig +new file mode 100644 +index 000000000000..aa3fa061edef +--- /dev/null ++++ b/board/xilinx/Kconfig +@@ -0,0 +1,41 @@ ++# Copyright (c) 2018, Luca Ceresoli <[email protected]> ++# ++# SPDX-License-Identifier: GPL-2.0 ++ ++if ARCH_ZYNQ || ARCH_ZYNQMP ++ ++config XILINX_PS_INIT_FILE ++ string "Zynq/ZynqMP PS init file(s) location" ++ help ++ On Zynq and ZynqMP U-Boot SPL (or U-Boot proper if ++ ZYNQMP_PSU_INIT_ENABLED is set) is responsible for some ++ basic initializations, such as enabling peripherals and ++ configuring pinmuxes. The PS init file (called ++ psu_init_gpl.c on ZynqMP, ps7_init_gpl.c for Zynq-7000) ++ contains the code for such initializations. ++ ++ U-Boot contains PS init files for some boards, but each of ++ them describes only one specific configuration. Users of a ++ different board, or needing a different configuration, can ++ generate custom files using the Xilinx development tools. ++ ++ There are three ways to give a PS init file to U-Boot: ++ ++ 1. Set this variable to the path, either relative to the ++ source tree or absolute, where the psu_init_gpl.c or ++ ps7_init_gpl.c file is located. U-Boot will build this ++ file. ++ ++ 2. If you leave an empty string here, U-Boot will use ++ board/xilinx/zynq/$(CONFIG_DEFAULT_DEVICE_TREE)/ps7_init_gpl.c ++ for Zynq-7000, or ++ board/xilinx/zynqmp/$(CONFIG_DEFAULT_DEVICE_TREE)/psu_init_gpl.c ++ for ZynqMP. ++ ++ 3. If the above file does not exist, U-Boot will use ++ board/xilinx/zynq/ps7_init_gpl.c for Zynq-7000, or ++ board/xilinx/zynqmp/psu_init_gpl.c for ZynqMP. This file ++ is not provided by U-Boot, you have to copy it there ++ before the build. ++ ++endif +diff --git a/board/xilinx/zynq/Makefile b/board/xilinx/zynq/Makefile +index 5a76a26720cd..03ad5f0532ee 100644 +--- a/board/xilinx/zynq/Makefile ++++ b/board/xilinx/zynq/Makefile +@@ -5,10 +5,18 @@ + + obj-y := board.o + +-hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) ++ifneq ($(CONFIG_XILINX_PS_INIT_FILE),"") ++PS_INIT_FILE := $(shell cd $(srctree); readlink -f $(CONFIG_XILINX_PS_INIT_FILE)) ++init-objs := ps_init_gpl.o ++spl/board/xilinx/zynq/ps_init_gpl.o board/xilinx/zynq/ps_init_gpl.o: $(PS_INIT_FILE) ++ $(CC) $(c_flags) -I $(srctree)/$(src) -c -o $@ $^ ++endif + ++ifeq ($(init-objs),) ++hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) + init-objs := $(if $(wildcard $(srctree)/$(src)/$(hw-platform-y)/ps7_init_gpl.c),\ + $(hw-platform-y)/ps7_init_gpl.o) ++endif + + ifeq ($(init-objs),) + ifneq ($(wildcard $(srctree)/$(src)/ps7_init_gpl.c),) +diff --git a/board/xilinx/zynqmp/Makefile b/board/xilinx/zynqmp/Makefile +index 05ccd25dcef3..960b81fc5853 100644 +--- a/board/xilinx/zynqmp/Makefile ++++ b/board/xilinx/zynqmp/Makefile +@@ -5,10 +5,18 @@ + + obj-y := zynqmp.o + +-hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) ++ifneq ($(CONFIG_XILINX_PS_INIT_FILE),"") ++PS_INIT_FILE := $(shell cd $(srctree); readlink -f $(CONFIG_XILINX_PS_INIT_FILE)) ++init-objs := ps_init_gpl.o ++spl/board/xilinx/zynqmp/ps_init_gpl.o board/xilinx/zynqmp/ps_init_gpl.o: $(PS_INIT_FILE) ++ $(CC) $(c_flags) -I $(srctree)/$(src) -c -o $@ $^ ++endif + ++ifeq ($(init-objs),) ++hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) + init-objs := $(if $(wildcard $(srctree)/$(src)/$(hw-platform-y)/psu_init_gpl.c),\ + $(hw-platform-y)/psu_init_gpl.o) ++endif + + ifeq ($(init-objs),) + ifneq ($(wildcard $(srctree)/$(src)/psu_init_gpl.c),) +-- +2.7.4 +
boot/uboot/Config.in +23 -0
@@ -395,6 +395,29 @@ config BR2_TARGET_UBOOT_ZYNQMP_PMUFW If empty, the generated boot.bin will not contain a PMU firmware. +config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE + string "Custom psu_init_gpl file" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + On ZynqMP the booloader is responsible for some basic + initializations, such as enabling peripherals and + configuring pinmuxes. The psu_init_gpl.c file (and, + optionally, psu_init_gpl.h) contains the code for such + initializations. + + Although U-Boot contains psu_init_gpl.c files for some + boards, each of them describes only one specific + configuration. Users of a different board, or needing a + different configuration, can generate custom files using the + Xilinx development tools. + + Set this variable to the path to your psu_init_gpl.c file + (e.g. "board/myboard/psu_init_gpl.c"). psu_init_gpl.h, if + needed, should be in the same directory. U-Boot will build + and link the user-provided file instead of the built-in one. + + Leave empty to use the files provided by U-Boot. + endif config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC
boot/uboot/uboot.mk +10 -0
@@ -305,6 +305,15 @@ define UBOOT_ZYNQMP_KCONFIG_PMUFW endef endif +UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)) + +ifneq ($(UBOOT_ZYNQMP_PSU_INIT),) +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT + $(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(shell readlink -f $(UBOOT_ZYNQMP_PSU_INIT))", \ + $(@D)/.config) +endef +endif + endif # BR2_TARGET_UBOOT_ZYNQMP define UBOOT_INSTALL_OMAP_IFT_IMAGE
@@ -358,6 +367,7 @@ endif define UBOOT_KCONFIG_FIXUP_CMDS $(UBOOT_ZYNQMP_KCONFIG_PMUFW) + $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) endef ifeq ($(BR2_TARGET_UBOOT_ENVIMAGE),y)
Signature · 1 line
2.17.1
PATCH v5 3/3 uboot: zynqmp: allow to use custom psu_init files
Luca,
Quoted 6 lines · Luca Ceresoli
U-Boot SPL configures pinmuxes, clocks and other low-level devices. On the Xilinx ZynqMP SoCs the code to do this resides in a file called
psu_init_gpl.cwhich is initially generated by the Xilinx development tools. Add an option to pass these files from the outside (e.g. in the board files).
Quoted 8 lines
For this to work properly, a patch to U-Boot is needed. However this patch must be applied by each defconfig using
BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR. If it were in boot/uboot/ to be applied unconditionally, it would break the build for configs using a U-Boot version where the patch is already applied.Signed-off-by Luca Ceresoli <[email protected]>Cc Joel Carlson <[email protected]>
My testing: I have a buildroot branch off of 2018.05.1. I removed v4 of these patches, applied v5 here, then did a clean build and made sure my zynqmp dev board still boots.
My U-Boot version is a branch off of 2018.07 with the upstream patch cherry-picked in, so I did not use the patch supplied with this change.
PATCH v5 3/3 uboot: zynqmp: allow to use custom psu_init files
In reply to Luca CeresoliHello,
Quoted 12 lines · Luca Ceresoli
boot/uboot/Config.in +12
-0+config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE + string "Custom psu_init_gpl file" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + On ZynqMP the booloader is responsible for some basic + initializations, such as enabling peripherals and + configuring pinmuxes. The psu_init_gpl.c file (and, + optionally, psu_init_gpl.h) contains the code for such + initializations. + + Although U-Boot contains psu_init_gpl.c files for some + boards, each of them describes only one specific
boot/uboot/Config.in config BR2_TARGET_UBOOT_ZYNQMP_PMUFW · line 419
Quoted 10 lines
boot/uboot/Config.in +10
-0+ configuration. Users of a different board, or needing a + different configuration, can generate custom files using the + Xilinx development tools. + + Set this variable to the path to your psu_init_gpl.c file + (e.g. "board/myboard/psu_init_gpl.c"). psu_init_gpl.h, if + needed, should be in the same directory. U-Boot will build + and link the user-provided file instead of the built-in one. + + Leave empty to use the files provided by U-Boot.
I've also added a comment here that explains which U-Boot upstream commit is necessary for this feature to work.
boot/uboot/uboot.mk define UBOOT_ZYNQMP_KCONFIG_PMUFW · line 315
Quoted 8 lines
boot/uboot/uboot.mk +8
-0+UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)) + +ifneq ($(UBOOT_ZYNQMP_PSU_INIT),) +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT + $(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(shell readlink -f $(UBOOT_ZYNQMP_PSU_INIT))", \ + $(@D)/.config) +endef +endif
To be "consistent" with what I did for the PMU firmware, I introduced an intermediate UBOOT_ZYNQMP_PSU_INIT_PATH variable.
Applied with those changes. Please don't hesitate to verify the resulting commits to make sure I didn't screw up anything.
Thanks for this work on ZynqMP!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH v5 3/3 uboot: zynqmp: allow to use custom psu_init files
Hi Thomas,
Quoted 42 lines · Thomas Petazzoni
Hello,
Quoted 12 lines · Luca Ceresoli
boot/uboot/Config.in +12
-0+config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE + string "Custom psu_init_gpl file" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + On ZynqMP the booloader is responsible for some basic + initializations, such as enabling peripherals and + configuring pinmuxes. The psu_init_gpl.c file (and, + optionally, psu_init_gpl.h) contains the code for such + initializations. + + Although U-Boot contains psu_init_gpl.c files for some + boards, each of them describes only one specificboot/uboot/Config.in config BR2_TARGET_UBOOT_ZYNQMP_PMUFW · line 419
Quoted 10 lines
boot/uboot/Config.in +10
-0+ configuration. Users of a different board, or needing a + different configuration, can generate custom files using the + Xilinx development tools. + + Set this variable to the path to your psu_init_gpl.c file + (e.g. "board/myboard/psu_init_gpl.c"). psu_init_gpl.h, if + needed, should be in the same directory. U-Boot will build + and link the user-provided file instead of the built-in one. + + Leave empty to use the files provided by U-Boot.I've also added a comment here that explains which U-Boot upstream commit is necessary for this feature to work.
boot/uboot/uboot.mk define UBOOT_ZYNQMP_KCONFIG_PMUFW · line 315
Quoted 8 lines
boot/uboot/uboot.mk +8
-0+UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)) + +ifneq ($(UBOOT_ZYNQMP_PSU_INIT),) +define UBOOT_ZYNQMP_KCONFIG_PSU_INIT + $(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(shell readlink -f $(UBOOT_ZYNQMP_PSU_INIT))", \ + $(@D)/.config) +endef +endifTo be "consistent" with what I did for the PMU firmware, I introduced an intermediate
UBOOT_ZYNQMP_PSU_INIT_PATHvariable.
Quoted 2 lines
Applied with those changes. Please don't hesitate to verify the resulting commits to make sure I didn't screw up anything.
Just build- and run-time tested, it works fine.
Thank you for the cleanups!
Bye,
Signature · 1 line
Luca