[Buildroot] [PATCH v1 1/1] configs/zynqmp_kria_kv260_defconfig: fixes to boot.bin and u-boot.itb generation

Neal Frager neal.frager at amd.com
Tue May 10 08:59:30 UTC 2022


This patch includes the following corrections:
  - additional kria k26 u-boot configs added to uboot.fragment
  - atf moved to uart1 with ZYNQMP_CONSOLE=cadence1 define
  - uboot patch added for correct fit-dtb.blob generation for kria starter kits
  - readme.txt file updated with additional details for qspi flash programming

Please note that the u-boot patch has not been upstreamed yet.
It is being reviewed to find the best solution to handle the dtb overlays moving forward.
For this reason, this is a temporary u-boot patch designed to enable buildroot development.

This patch has been build and run tested on a kria kv260 starter kit.

Signed-off-by: Neal Frager <neal.frager at amd.com>
---
 board/zynqmp/kria/kv260/uboot.fragment        |  14 ++
 ...qmp-add-kria-fit-dtb.blob-generation.patch | 127 ++++++++++++++++++
 board/zynqmp/kria/readme.txt                  |  28 +++-
 configs/zynqmp_kria_kv260_defconfig           |   2 +
 4 files changed, 165 insertions(+), 6 deletions(-)
 create mode 100644 board/zynqmp/kria/patches/uboot/0001-arm64-zynqmp-add-kria-fit-dtb.blob-generation.patch

diff --git a/board/zynqmp/kria/kv260/uboot.fragment b/board/zynqmp/kria/kv260/uboot.fragment
index e1aca68692..23529e7fdb 100644
--- a/board/zynqmp/kria/kv260/uboot.fragment
+++ b/board/zynqmp/kria/kv260/uboot.fragment
@@ -1 +1,15 @@
 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-smk-k26-revA"
+CONFIG_SYS_SPI_U_BOOT_OFFS=0xF80000
+CONFIG_DTB_RESELECT=y
+CONFIG_MULTI_DTB_FIT=y
+CONFIG_DMA=y
+CONFIG_XILINX_DPDMA=y
+CONFIG_PHY=y
+CONFIG_PHY_XILINX_ZYNQMP=y
+CONFIG_PINCTRL=y
+CONFIG_PINCONF=y
+CONFIG_POWER_DOMAIN=y
+CONFIG_ZYNQMP_POWER_DOMAIN=y
+CONFIG_DM_RESET=y
+CONFIG_RESET_ZYNQMP=y
+CONFIG_VIDEO_ZYNQMP_DPSUB=y
diff --git a/board/zynqmp/kria/patches/uboot/0001-arm64-zynqmp-add-kria-fit-dtb.blob-generation.patch b/board/zynqmp/kria/patches/uboot/0001-arm64-zynqmp-add-kria-fit-dtb.blob-generation.patch
new file mode 100644
index 0000000000..229ed57bc0
--- /dev/null
+++ b/board/zynqmp/kria/patches/uboot/0001-arm64-zynqmp-add-kria-fit-dtb.blob-generation.patch
@@ -0,0 +1,127 @@
+From 4c2fd6d17cea1a304a3bbfb6bf8bacb9276def05 Mon Sep 17 00:00:00 2001
+From: Neal Frager <neal.frager at amd.com>
+Date: Tue, 10 May 2022 09:28:30 +0100
+Subject: [PATCH 1/1] arm64: zynqmp: add kria fit-dtb.blob generation
+
+This patch adds the support for generating a fit-dtb.blob
+for Kria K26 SOM starter kits.
+
+Signed-off-by: Neal Frager <neal.frager at amd.com>
+---
+ arch/arm/mach-zynqmp/mkimage_fit_atf.sh | 10 ++++
+ som.its                                 | 80 +++++++++++++++++++++++++
+ 2 files changed, 90 insertions(+)
+ create mode 100644 som.its
+
+diff --git a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh
+index 72a8a3eb77..18ca84c35c 100755
+--- a/arch/arm/mach-zynqmp/mkimage_fit_atf.sh
++++ b/arch/arm/mach-zynqmp/mkimage_fit_atf.sh
+@@ -112,8 +112,18 @@ __TEE
+ fi
+ 
+ MULTI_DTB=`awk '/CONFIG_MULTI_DTB_FIT / { print $3 }' include/generated/autoconf.h`
++DEFAULT_DT=`awk '/CONFIG_DEFAULT_DEVICE_TREE / { print $3 }' include/generated/autoconf.h`
+ 
+ if [ 1"$MULTI_DTB" -eq 11 ]; then
++if [[ ${DEFAULT_DT} == *"zynqmp-smk-k26-revA"* ]]; then
++	# Build overlays
++	fdtoverlay -o zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revA.dtb -i arch/arm/dts/zynqmp-smk-k26-revA.dtb arch/arm/dts/zynqmp-sck-kv-g-revA.dtbo
++	fdtoverlay -o zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revB.dtb -i arch/arm/dts/zynqmp-smk-k26-revA.dtb arch/arm/dts/zynqmp-sck-kv-g-revB.dtbo
++	fdtoverlay -o zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revA.dtb -i arch/arm/dts/zynqmp-smk-k26-revA.dtb arch/arm/dts/zynqmp-sck-kr-g-revA.dtbo
++	fdtoverlay -o zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revB.dtb -i arch/arm/dts/zynqmp-smk-k26-revA.dtb arch/arm/dts/zynqmp-sck-kr-g-revB.dtbo
++
++	tools/mkimage -E -f -q som.its -B 0x8 fit-dtb.blob
++fi
+ 	cat << __FDT_IMAGE_EOF
+ 		fdt_1 {
+ 			description = "Multi DTB fit image";
+diff --git a/som.its b/som.its
+new file mode 100644
+index 0000000000..4fd9a9e2a2
+--- /dev/null
++++ b/som.its
+@@ -0,0 +1,80 @@
++// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
++/dts-v1/;
++/ {
++	description = "SOM versions";
++	images {
++		fdt_1 {
++			description = "zynqmp-smk-k26-revA";
++			data = /incbin/("arch/arm/dts/zynqmp-smk-k26-revA.dtb");
++			type = "flat_dt";
++			arch = "arm64";
++			compression = "none";
++			hash {
++				algo = "md5";
++			};
++		};
++		fdt_2 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revA";
++			data = /incbin/("zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revA.dtb");
++			type = "flat_dt";
++			arch = "arm64";
++			compression = "none";
++			hash {
++				algo = "md5";
++			};
++		};
++		fdt_3 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revB";
++			data = /incbin/("zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revB.dtb");
++			type = "flat_dt";
++			arch = "arm64";
++			compression = "none";
++			hash {
++				algo = "md5";
++			};
++		};
++		fdt_4 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revA";
++			data = /incbin/("zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revA.dtb");
++			type = "flat_dt";
++			arch = "arm64";
++			compression = "none";
++			hash {
++				algo = "md5";
++			};
++		};
++		fdt_5 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revB";
++			data = /incbin/("zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revB.dtb");
++			type = "flat_dt";
++			arch = "arm64";
++			compression = "none";
++			hash {
++				algo = "md5";
++			};
++		};
++	};
++	configurations {
++		default = "config_1";
++		config_1 {
++			description = "zynqmp-smk-k26-revA";
++			fdt = "fdt_1";
++		};
++		config_2 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revA";
++			fdt = "fdt_2";
++		};
++		config_3 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kv-g-revB";
++			fdt = "fdt_3";
++		};
++		config_4 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revA";
++			fdt = "fdt_4";
++		};
++		config_5 {
++			description = "zynqmp-smk-k26-xcl2g-revA-sck-kr-g-revB";
++			fdt = "fdt_5";
++		};
++	};
++};
+-- 
+2.17.1
+
diff --git a/board/zynqmp/kria/readme.txt b/board/zynqmp/kria/readme.txt
index a3a4b5e65a..d64427a52c 100644
--- a/board/zynqmp/kria/readme.txt
+++ b/board/zynqmp/kria/readme.txt
@@ -56,23 +56,39 @@ Where 'sdX' is the device node of the SD.
 
 Eject the SD card, insert it in the board, and power it up.
 
-How to write the boot.bn to QSPI boot flash
-===========================================
+How to write the boot.bn and u-boot.itb to QSPI boot flash
+==========================================================
 
 The Kria SOMs are preconfigured to boot initially from QSPI.
 This makes these boards different from other ZynqMP boards
-in that the boot.bin needs to be flashed into the QSPI boot
-flash such that the U-Boot SPL can then load all of the
-remaining images from the SD card.
+in that the boot.bin and u-boot.itb files need to be flashed 
+into the QSPI boot flash such that U-Boot can then load all 
+of the remaining images from the SD card.
 
 In addition, the KV260 Starter Kit QSPI comes pre-flashed with
 a utility designed to make updating the QSPI flash memory
 easier.
 
-Instructions for using these utilities to update the boot.bin
+Instructions for using these utilities to update the files
 in QSPI flash can be found on the wiki link below.
 
 https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1641152513/Kria+K26+SOM#Boot-Firmware-Updates
 
+Additionally, it is possible to use u-boot for updating the
+QSPI with new boot.bin and u-boot.itb images with the u-boot
+commands below:
+
+Flashing u-boot.itb:
+    $ sf probe
+    $ fatload mmc 1 0x1000000 u-boot.itb
+    $ sf erase 0xf80000 (size of u-boot.itb)
+    $ sf write 0x1000000 0xf80000 (size of u-boot.itb)
+
+Flashing boot.bin:
+    $ sf probe
+    $ fatload mmc 1 0x1000000 boot.bin
+    $ sf erase 0x200000 (size of boot.bin)
+    $ sf write 0x1000000 0x200000 (size of boot.bin)
+
 It is possible to boot the Buildroot generated SD card image without
 updating the QSPI boot.bin image, so this is an optional step.
diff --git a/configs/zynqmp_kria_kv260_defconfig b/configs/zynqmp_kria_kv260_defconfig
index d4a72a0d19..42b8fdaf84 100644
--- a/configs/zynqmp_kria_kv260_defconfig
+++ b/configs/zynqmp_kria_kv260_defconfig
@@ -16,6 +16,7 @@ BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
 BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL=y
 BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION="$(call github,Xilinx,arm-trusted-firmware,xlnx_rebase_v2.6_2022.1)/xlnx_rebase_v2.6_2022.1.tar.gz"
 BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="zynqmp"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="ZYNQMP_CONSOLE=cadence1"
 BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31_UBOOT=y
 BR2_TARGET_UBOOT=y
 BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
@@ -35,3 +36,4 @@ BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y
 BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
 BR2_PACKAGE_HOST_MTOOLS=y
+BR2_GLOBAL_PATCH_DIR="board/zynqmp/kria/patches"
-- 
2.17.1




More information about the buildroot mailing list