diff mbox series

[4/4] configs/freescale_imx93evk: new defconfig

Message ID 20231011110932.4425-5-sebastien.szymanski@armadeus.com
State Superseded
Headers show
Series i.MX91 and i.MX93 support | expand

Commit Message

Sébastien Szymanski Oct. 11, 2023, 11:09 a.m. UTC
This patch adds support for the NXP i.MX 93 11x11 EVK board [1].

[1] https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx-93-evaluation-kit:i.MX93EVK

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
---
 .../common/imx/genimage.cfg.template_imx9     | 41 +++++++++++
 .../common/imx/imx9-bootloader-prepare.sh     | 34 +++++++++
 board/freescale/common/imx/post-image.sh      |  4 +
 board/freescale/imx93evk/readme.txt           | 73 +++++++++++++++++++
 configs/freescale_imx93evk_defconfig          | 38 ++++++++++
 5 files changed, 190 insertions(+)
 create mode 100644 board/freescale/common/imx/genimage.cfg.template_imx9
 create mode 100755 board/freescale/common/imx/imx9-bootloader-prepare.sh
 create mode 100644 board/freescale/imx93evk/readme.txt
 create mode 100644 configs/freescale_imx93evk_defconfig

Comments

Nicolas Cavallari Oct. 11, 2023, 1:43 p.m. UTC | #1
Small nit:

On 11/10/2023 13:09, Sébastien Szymanski wrote:
> diff --git a/configs/freescale_imx93evk_defconfig 
> b/configs/freescale_imx93evk_defconfig new file mode 100644 index 
> 000000000000..f0e4a95930c6 --- /dev/null +++ 
> b/configs/freescale_imx93evk_defconfig @@ -0,0 +1,38 @@ +BR2_aarch64=y 
> [...]
> +BR2_DL_DIR="/home/sszy/development/buildroot-download"

You probably want to remove that line.
diff mbox series

Patch

diff --git a/board/freescale/common/imx/genimage.cfg.template_imx9 b/board/freescale/common/imx/genimage.cfg.template_imx9
new file mode 100644
index 000000000000..10e192ce5774
--- /dev/null
+++ b/board/freescale/common/imx/genimage.cfg.template_imx9
@@ -0,0 +1,41 @@ 
+# Minimal SD card image for the Freescale iMX9 boards
+#
+# We mimic the .sdcard Freescale's image format:
+# * the SD card must have 32 kB free space at the beginning,
+# * U-Boot is integrated into imx9-boot-sd.bin and is dumped as is,
+# * a FAT partition at offset 8MB is containing Image and DTB files
+# * a single root filesystem partition is required (ext2, ext3 or ext4)
+#
+
+image boot.vfat {
+  vfat {
+    label = "boot"
+    files = {
+      %FILES%
+    }
+  }
+  size = 64M
+}
+
+image sdcard.img {
+  hdimage {
+  }
+
+  partition imx-boot {
+    in-partition-table = "no"
+    image = "imx9-boot-sd.bin"
+    offset = %IMXOFFSET%
+  }
+
+  partition boot {
+    partition-type = 0xC
+    bootable = "true"
+    image = "boot.vfat"
+    offset = 8M
+  }
+
+  partition rootfs {
+    partition-type = 0x83
+    image = "rootfs.ext2"
+  }
+}
diff --git a/board/freescale/common/imx/imx9-bootloader-prepare.sh b/board/freescale/common/imx/imx9-bootloader-prepare.sh
new file mode 100755
index 000000000000..3c3757354d63
--- /dev/null
+++ b/board/freescale/common/imx/imx9-bootloader-prepare.sh
@@ -0,0 +1,34 @@ 
+#!/usr/bin/env bash
+
+main ()
+{
+	SPL_LOAD_ADDR=0x2049A000
+	ATF_LOAD_ADDR=0x204E0000
+	if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX91=y$" ${BR2_CONFIG}; then
+		SPL_LOAD_ADDR=0x204A0000
+		ATF_LOAD_ADDR=0x204C0000
+	fi
+
+	dd if=${BINARIES_DIR}/u-boot-spl.bin of=${BINARIES_DIR}/u-boot-spl-padded.bin bs=4 conv=sync
+	cat ${BINARIES_DIR}/u-boot-spl-padded.bin ${BINARIES_DIR}/ddr_fw.bin > ${BINARIES_DIR}/u-boot-spl-ddr.bin
+
+	${HOST_DIR}/bin/mkimage_imx8 -commit > ${BINARIES_DIR}/mkimg.commit
+        cat ${BINARIES_DIR}/u-boot.bin ${BINARIES_DIR}/mkimg.commit > ${BINARIES_DIR}/u-boot-hash.bin
+	rm -f ${BINARIES_DIR}/mkimg.commit
+
+	if grep -Eq "^BR2_TARGET_OPTEE_OS=y$" ${BR2_CONFIG}; then
+		${HOST_DIR}/bin/mkimage_imx8 -soc IMX9 -c -ap ${BINARIES_DIR}/bl31.bin a35 ${ATF_LOAD_ADDR} -ap ${BINARIES_DIR}/u-boot-hash.bin a35 0x80200000 -ap ${BINARIES_DIR}/tee.bin a35 0x96000000 -out ${BINARIES_DIR}/u-boot-atf-container.img
+	else
+		${HOST_DIR}/bin/mkimage_imx8 -soc IMX9 -c -ap ${BINARIES_DIR}/bl31.bin a35 ${ATF_LOAD_ADDR} -ap ${BINARIES_DIR}/u-boot-hash.bin a35 0x80200000 -out ${BINARIES_DIR}/u-boot-atf-container.img
+	fi
+
+	${HOST_DIR}/bin/mkimage_imx8 -soc IMX9 -append ${BINARIES_DIR}/ahab-container.img -c -ap ${BINARIES_DIR}/u-boot-spl-ddr.bin a35 ${SPL_LOAD_ADDR} -out ${BINARIES_DIR}/imx9-boot-sd.bin
+	
+	flashbin_size=$(wc -c ${BINARIES_DIR}/imx9-boot-sd.bin | awk '{print $1}')
+	pad_cnt=$(($((flashbin_size + 0x400 - 1)) / 0x400))
+	dd if=${BINARIES_DIR}/u-boot-atf-container.img of=${BINARIES_DIR}/imx9-boot-sd.bin bs=1K seek=${pad_cnt}
+
+	exit $?
+}
+
+main $@
diff --git a/board/freescale/common/imx/post-image.sh b/board/freescale/common/imx/post-image.sh
index c359ef6032a6..3df7e820938b 100755
--- a/board/freescale/common/imx/post-image.sh
+++ b/board/freescale/common/imx/post-image.sh
@@ -48,6 +48,10 @@  genimage_type()
 		echo "genimage.cfg.template_imx8"
 	elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8DXL=y$" ${BR2_CONFIG}; then
 		echo "genimage.cfg.template_imx8"
+	elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX91=y$" ${BR2_CONFIG}; then
+		echo "genimage.cfg.template_imx9"
+	elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX93=y$" ${BR2_CONFIG}; then
+		echo "genimage.cfg.template_imx9"
 	elif grep -Eq "^BR2_LINUX_KERNEL_INSTALL_TARGET=y$" ${BR2_CONFIG}; then
 		if grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
 		    echo "genimage.cfg.template_no_boot_part_spl"
diff --git a/board/freescale/imx93evk/readme.txt b/board/freescale/imx93evk/readme.txt
new file mode 100644
index 000000000000..f34624dd32e4
--- /dev/null
+++ b/board/freescale/imx93evk/readme.txt
@@ -0,0 +1,73 @@ 
+*********************
+NXP i.MX93 EVK board
+*********************
+
+This file documents the Buildroot support for the i.MX 93 EVK board.
+
+Build
+=====
+
+First, configure Buildroot for the i.MX 93 EVK board:
+
+  make freescale_imx93evk_defconfig
+
+Build all components:
+
+  make
+
+You will find in output/images/ the following files:
+  - ahab-container.img
+  - bl31.bin
+  - boot.vfat
+  - ddr_fw.bin
+  - Image
+  - imx93-11x11-evk.dtb
+  - imx9-boot-sd.bin
+  - lpddr4_pmu_train_fw.bin
+  - rootfs.ext2
+  - rootfs.ext4
+  - rootfs.tar
+  - sdcard.img
+  - u-boot-atf-container.img
+  - u-boot.bin
+  - u-boot-hash.bin
+  - u-boot-spl.bin
+  - u-boot-spl-ddr.bin
+  - u-boot-spl-padded.bin
+
+Create a bootable SD card
+=========================
+
+To determine the device associated to the SD card have a look in the
+/proc/partitions file:
+
+  cat /proc/partitions
+
+Buildroot prepares a bootable "sdcard.img" image in the output/images/
+directory, ready to be dumped on a SD card. Launch the following
+command as root:
+
+  dd if=output/images/sdcard.img of=/dev/<your-sd-device>
+
+*** WARNING! This will destroy all the card content. Use with care! ***
+
+For details about the medium image layout, see the definition in
+board/freescale/common/imx/genimage.cfg.template_imx9.
+
+Boot the i.MX 93 EVK board
+===============================
+
+To boot your newly created system (refer to the i.MX 8M Plus EVK Documentation
+[1] for guidance):
+- insert the SD card in the SD slot of the board;
+- Configure the switches as follows (X = "don't care"):
+SW1301: 0100 SW1301[1-4]
+- put a micro USB cable into the Debug USB Port and connect using a terminal
+  emulator at 115200 bps, 8n1;
+- power on the board.
+
+Enjoy!
+
+References
+==========
+[1] https://www.nxp.com/document/guide/getting-started-with-the-i-mx93-evk:GS-IMX93EVK
diff --git a/configs/freescale_imx93evk_defconfig b/configs/freescale_imx93evk_defconfig
new file mode 100644
index 000000000000..f0e4a95930c6
--- /dev/null
+++ b/configs/freescale_imx93evk_defconfig
@@ -0,0 +1,38 @@ 
+BR2_aarch64=y
+BR2_cortex_a55=y
+BR2_ARM_FPU_VFPV4D16=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y
+BR2_DL_DIR="/home/sszy/development/buildroot-download"
+BR2_TARGET_GENERIC_GETTY_PORT="ttyLP0"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx9-bootloader-prepare.sh board/freescale/common/imx/post-image.sh"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
+BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,nxp-imx,linux-imx,lf-6.1.22-2.0.0)/linux-imx-lf-6.1.22-2.0.0.tar.gz"
+BR2_LINUX_KERNEL_DEFCONFIG="imx_v8"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx93-11x11-evk"
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_PACKAGE_FREESCALE_IMX=y
+BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX93=y
+BR2_PACKAGE_FIRMWARE_IMX=y
+BR2_PACKAGE_FIRMWARE_SENTINEL=y
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL_LOCATION="$(call github,nxp-imx,imx-atf,lf-6.1.22-2.0.0)/imx-atf-lf-6.1.22-2.0.0.tar.gz"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx93"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL31=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL=y
+BR2_TARGET_UBOOT_CUSTOM_TARBALL_LOCATION="$(call github,nxp-imx,uboot-imx,lf-6.1.22-2.0.0)/uboot-imx-lf-6.1.22-2.0.0.tar.gz"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx93_11x11_evk"
+BR2_TARGET_UBOOT_NEEDS_DTC=y
+BR2_TARGET_UBOOT_SPL=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_IMX_MKIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y