From c05f27c8ae46cc6d9236a30d51f854f221d55ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Szymanski?= Date: Thu, 8 Feb 2024 13:54:23 +0100 Subject: [PATCH] configs/freescale_imx93evk: new defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Julien Olivain Tested-by: Julien Olivain [Julien: tested on NXP board i.MX93EVK, cpu rev A1, board rev B] Reviewed-by: Gary Bisson Reviewed-by: Giulio Benetti Signed-off-by: Sébastien Szymanski [Arnout: - Fix shellcheck errors. - Add hash files for ATF, linux, U-Boot. ] Signed-off-by: Arnout Vandecappelle --- .../common/imx/genimage.cfg.template_imx9 | 42 ++++++++++ .../common/imx/imx9-bootloader-prepare.sh | 43 +++++++++++ board/freescale/common/imx/post-image.sh | 4 + .../arm-trusted-firmware.hash | 2 + .../patches/linux-headers/linux-headers.hash | 1 + .../imx93evk/patches/linux/linux.hash | 3 + .../imx93evk/patches/uboot/uboot.hash | 2 + board/freescale/imx93evk/readme.txt | 77 +++++++++++++++++++ configs/freescale_imx93evk_defconfig | 40 ++++++++++ 9 files changed, 214 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/patches/arm-trusted-firmware/arm-trusted-firmware.hash create mode 120000 board/freescale/imx93evk/patches/linux-headers/linux-headers.hash create mode 100644 board/freescale/imx93evk/patches/linux/linux.hash create mode 100644 board/freescale/imx93evk/patches/uboot/uboot.hash create mode 100644 board/freescale/imx93evk/readme.txt create mode 100644 configs/freescale_imx93evk_defconfig 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 0000000000..df7ddc25b7 --- /dev/null +++ b/board/freescale/common/imx/genimage.cfg.template_imx9 @@ -0,0 +1,42 @@ +# Minimal SD card image for the NXP i.MX9 boards +# +# We mimic the .sdcard NXP'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 0000000000..a9611a81bd --- /dev/null +++ b/board/freescale/common/imx/imx9-bootloader-prepare.sh @@ -0,0 +1,43 @@ +#!/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 638da4b86c..a440bfb75c 100755 --- a/board/freescale/common/imx/post-image.sh +++ b/board/freescale/common/imx/post-image.sh @@ -50,6 +50,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/patches/arm-trusted-firmware/arm-trusted-firmware.hash b/board/freescale/imx93evk/patches/arm-trusted-firmware/arm-trusted-firmware.hash new file mode 100644 index 0000000000..98f425a89e --- /dev/null +++ b/board/freescale/imx93evk/patches/arm-trusted-firmware/arm-trusted-firmware.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 cfb927722272897f850681c78d5f129b0883a8efaba9c52d30e029086524f7ff imx-atf-lf-6.1.55-2.2.0.tar.gz diff --git a/board/freescale/imx93evk/patches/linux-headers/linux-headers.hash b/board/freescale/imx93evk/patches/linux-headers/linux-headers.hash new file mode 120000 index 0000000000..5808d92afe --- /dev/null +++ b/board/freescale/imx93evk/patches/linux-headers/linux-headers.hash @@ -0,0 +1 @@ +../linux/linux.hash \ No newline at end of file diff --git a/board/freescale/imx93evk/patches/linux/linux.hash b/board/freescale/imx93evk/patches/linux/linux.hash new file mode 100644 index 0000000000..5687ec7343 --- /dev/null +++ b/board/freescale/imx93evk/patches/linux/linux.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 eb94414f952444289c0af8ad82afa0dc2d07e08f9000ccd2cc39f11da5b494ea linux-imx-lf-6.1.55-2.2.0.tar.gz + diff --git a/board/freescale/imx93evk/patches/uboot/uboot.hash b/board/freescale/imx93evk/patches/uboot/uboot.hash new file mode 100644 index 0000000000..9bc17c3f6f --- /dev/null +++ b/board/freescale/imx93evk/patches/uboot/uboot.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 64441ee5bf3d5011e7853c028d06211b6f0439d21e147a8f36972c95a07ae9ac uboot-imx-lf-6.1.55-2.2.0.tar.gz diff --git a/board/freescale/imx93evk/readme.txt b/board/freescale/imx93evk/readme.txt new file mode 100644 index 0000000000..1173de39db --- /dev/null +++ b/board/freescale/imx93evk/readme.txt @@ -0,0 +1,77 @@ +********************* +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/ + +*** 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 93 EVK Documentation +[1] for guidance): +- insert the SD card in the SD slot of the board; +- Configure the switches as follows: +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. + +Note: the debug USB connector presents 4 UARTs (for example /dev/ttyUSB[0-3]), +the Cortex-A55 UART should be the 3rd one (in the previous example, /dev/ttyUSB2). +Refer to the documentation [1] for more details. + +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 0000000000..fa16967884 --- /dev/null +++ b/configs/freescale_imx93evk_defconfig @@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_cortex_a55=y +BR2_ARM_FPU_VFPV4D16=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y +BR2_GLOBAL_PATCH_DIR="board/freescale/imx93evk/patches" +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.55-2.2.0)/linux-imx-lf-6.1.55-2.2.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_ELE_IMX=y +BR2_PACKAGE_FIRMWARE_IMX=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.55-2.2.0)/imx-atf-lf-6.1.55-2.2.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.55-2.2.0)/uboot-imx-lf-6.1.55-2.2.0.tar.gz" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx93_11x11_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y +BR2_TARGET_UBOOT_NEEDS_GNUTLS=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