aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorGravatar Luca Ceresoli <luca@lucaceresoli.net>2018-07-25 16:35:36 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2018-07-28 16:32:07 +0200
commite865a1f03c7c68b711a2d754cf8ffa3a168082b2 (patch)
treede7ffef2925ccfbbefdfd35df8515abe3f5c4de4 /board
parent826981d45ddbb85a92c01869cb2eccc2fb260475 (diff)
downloadbuildroot-e865a1f03c7c68b711a2d754cf8ffa3a168082b2.tar.gz
buildroot-e865a1f03c7c68b711a2d754cf8ffa3a168082b2.tar.bz2
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. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Cc: Joel Carlson <joelsoncarl@gmail.com> Reviewed-by: Joel Carlson <JoelsonCarl@gmail.com> Tested-by: Joel Carlson <JoelsonCarl@gmail.com> [Thomas: - indicate that this feature requires U-Boot 2018.07, since commit c7df098a71e05dc81cee818747759e8060b59626 is needed. - define UBOOT_ZYNQMP_KCONFIG_PMUFW only once, and instead use a variable named UBOOT_ZYNQMP_PMUFW_PATH to store the path to the PMU firmware] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'board')
-rw-r--r--board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch b/board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch
new file mode 100644
index 0000000000..95ab7b3b75
--- /dev/null
+++ b/board/zynqmp/patches/uboot/0003-arm64-zynqmp-accept-an-absolute-path-for-PMUFW_INIT_.patch
@@ -0,0 +1,68 @@
+From c7df098a71e05dc81cee818747759e8060b59626 Mon Sep 17 00:00:00 2001
+From: Luca Ceresoli <luca@lucaceresoli.net>
+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 <luca@lucaceresoli.net>
+Cc: Michal Simek <michal.simek@xilinx.com>
+Cc: Simon Glass <sjg@chromium.org>
+Cc: Emmanuel Vadot <manu@bidouilliste.com>
+Signed-off-by: Michal Simek <michal.simek@xilinx.com>
+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
+