board/freescale/imx: Add helper to generate fw binary
PATCH 1/3 board/freescale/imx: Add helper to generate fw binary
This script aims to create an imx compatible boot image embedding mainline components, using only upstream uboot mkimage tool, avoiding dependencies on proprietary imx mkimage.
Mainline u-boot can generate a bootable image, but SPL soc proprietary firmware dependencies have to be copied on uboot root dir.
This script prevents additional buildroot uboot recipe hacking to handle custom SoC uboot build process.
The script actions summary is:
- Append DDR4 firmware to uboot spl binary
- Generate imx mkimage configuration file, extracting entry points from relevant elf files on the fly.
- Generate imx boot image using uboot upstream mkimage tool
--- .../common/imx/imx8-generate-fw-image.sh | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 board/freescale/common/imx/imx8-generate-fw-image.sh
board/freescale/common/imx/imx8-generate-fw-image.sh new file +52 -0
@@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +get_entry() +{ + local elf_file=$1 + readelf -h "$elf_file" | sed -e '/Entry/!d;s/.*:.*\(0x[0-9a-fA-F]\)/\1/g' +} + +gen_cfg_file() +{ +cat <<EOF > "$CFG_OUTFILE" +#define __ASSEMBLY__ + +FIT +BOOT_FROM sd +LOADER ${SPL_DDR_BIN} ${SPL_ENTRY} +SECOND_LOADER ${UBOOT_BIN} ${UBOOT_ENTRY} 0x60000 + +EOF +} + +gen_1stloader_bin() +{ + SPL_BIN_PAD="$(mktemp --suffix spl_pad.bin)" + dd if="${SPL_BIN}" of="${SPL_BIN_PAD}" bs=4 conv=sync + cat "${SPL_BIN_PAD}" "${DDR_FW_BIN}" > "${SPL_DDR_BIN}" +} + +gen_fw_image() +{ + "${HOST_DIR}"/bin/mkimage -n "${CFG_OUTFILE}" -T imx8mimage -e "${SPL_ENTRY}" -d "${UBOOT_BIN}" "${FLASH_BIN}" + +} +main() +{ + UBOOT_BIN="${BINARIES_DIR}/u-boot.itb" + UBOOT_ELF="${BINARIES_DIR}/u-boot" + SPL_DDR_BIN="${BINARIES_DIR}/u-boot-spl-ddr.bin" + SPL_BIN="${BINARIES_DIR}/u-boot-spl.bin" + SPL_ELF="${BINARIES_DIR}/u-boot-spl" + CFG_OUTFILE="${BINARIES_DIR}/bootimage.cfg" + FLASH_BIN="${BINARIES_DIR}/imx8-boot-sd.bin" + UBOOT_ENTRY="$(get_entry "${UBOOT_ELF}")" + SPL_ENTRY="$(get_entry "${SPL_ELF}")" + DDR_FW_BIN="${BINARIES_DIR}/lpddr4_pmu_train_fw.bin" + + gen_1stloader_bin + gen_cfg_file + gen_fw_image +} + +main "$@"
Signature · 1 line
2.25.1
PATCH 2/3 configs/imx8mmevk: new defconfig
Introduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
--- .gitlab-ci.yml | 1 + DEVELOPERS | 3 +++ board/freescale/imx8mmevk/readme.txt | 35 ++++++++++++++++++++++-- configs/imx8mmevk_defconfig | 40 ++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
.gitlab-ci.yml +1 -0
@@ -210,6 +210,7 @@ imx6ulevk_defconfig: { extends: .defconfig } imx6ulpico_defconfig: { extends: .defconfig } imx7d-sdb_defconfig: { extends: .defconfig } imx7dpico_defconfig: { extends: .defconfig } +imx8mmevk_defconfig: { extends: .defconfig } imx8mmpico_defconfig: { extends: .defconfig } imx8mpico_defconfig: { extends: .defconfig } lafrite_defconfig: { extends: .defconfig }
DEVELOPERS +3 -0
@@ -2637,6 +2637,9 @@ F: package/python-pyusb/ N: Wojciech Nizi?ski <[email protected]> F: package/fwup/ +N: Xavier Roumegue <[email protected]> +F: configs/imx8mmevk_defconfig + N: Yann E. MORIN <[email protected]> F: board/friendlyarm/nanopi-neo/ F: configs/nanopi_neo_defconfig
board/freescale/imx8mmevk/readme.txt +33 -2
@@ -5,8 +5,8 @@ Freescale i.MX8MM EVK board This file documents the Buildroot support for the Freescale i.MX8MM EVK board. -Build -===== +Building with NXP ATF, U-Boot and kernel +======================================== First, configure Buildroot for the i.MX8MM EVK board:
@@ -32,6 +32,37 @@ You will find in output/images/ the following files: - u-boot-nodtb.bin - u-boot-spl-ddr.bin +Building with mainline ATF, U-Boot and kernel +============================================= +First, configure Buildroot for the i.MX8MM EVK board: + + make imx8mmevk_defconfig + +Build all components: + + make + +You will find in output/images/ the following files: + - bl31.bin + - bootimage.cfg + - boot.vfat + - Image + - imx8-boot-sd.bin + - imx8mm-evk.dtb + - lpddr4_pmu_train_fw.bin + - rootfs.ext2 + - rootfs.ext4 + - rootfs.tar + - sdcard.img + - signed_hdmi_imx8m.bin + - u-boot + - u-boot.bin + - u-boot.itb + - u-boot-nodtb.bin + - u-boot-spl + - u-boot-spl.bin + - u-boot-spl-ddr.bin + Create a bootable SD card =========================
configs/imx8mmevk_defconfig new file +40 -0
@@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-generate-fw-image.sh board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.6.7" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.04" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FORMAT_ITB=y +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-nodtb.bin" +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ATF_LOAD_ADDR=0x920000" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
Signature · 1 line
2.25.1
PATCH 3/3 configs/imx8mqevk: new defconfig
In reply to Xavier RoumegueIntroduce NXP imx8mq evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
--- .gitlab-ci.yml | 1 + DEVELOPERS | 1 + board/freescale/imx8mqevk/readme.txt | 35 ++++++++++++++++++++++-- configs/imx8mqevk_defconfig | 40 ++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 configs/imx8mqevk_defconfig
.gitlab-ci.yml +1 -0
@@ -213,6 +213,7 @@ imx7dpico_defconfig: { extends: .defconfig } imx8mmevk_defconfig: { extends: .defconfig } imx8mmpico_defconfig: { extends: .defconfig } imx8mpico_defconfig: { extends: .defconfig } +imx8mqevk_defconfig: { extends: .defconfig } lafrite_defconfig: { extends: .defconfig } lego_ev3_defconfig: { extends: .defconfig } licheepi_zero_defconfig: { extends: .defconfig }
DEVELOPERS +1 -0
@@ -2639,6 +2639,7 @@ F: package/fwup/ N: Xavier Roumegue <[email protected]> F: configs/imx8mmevk_defconfig +F: configs/imx8mqevk_defconfig N: Yann E. MORIN <[email protected]> F: board/friendlyarm/nanopi-neo/
board/freescale/imx8mqevk/readme.txt +33 -2
@@ -5,8 +5,8 @@ Freescale i.MX8MQ EVK board This file documents the Buildroot support for the Freescale i.MX8MQ EVK board. -Build -===== +Building with NXP ATF, U-Boot and kernel +======================================== First, configure Buildroot for the i.MX8MQ EVK board:
@@ -33,6 +33,37 @@ You will find in output/images/ the following files: - u-boot-nodtb.bin - u-boot-spl-ddr.bin +Building with mainline ATF, U-Boot and kernel +============================================= +First, configure Buildroot for the i.MX8MQ EVK board: + + make imx8mqevk_defconfig + +Build all components: + + make + +You will find in output/images/ the following files: + - bl31.bin + - bootimage.cfg + - boot.vfat + - Image + - imx8-boot-sd.bin + - imx8mq-evk.dtb + - lpddr4_pmu_train_fw.bin + - rootfs.ext2 + - rootfs.ext4 + - rootfs.tar + - sdcard.img + - signed_hdmi_imx8m.bin + - u-boot + - u-boot.bin + - u-boot.itb + - u-boot-nodtb.bin + - u-boot-spl + - u-boot-spl.bin + - u-boot-spl-ddr.bin + Create a bootable SD card =========================
configs/imx8mqevk_defconfig new file +40 -0
@@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/imx8-generate-fw-image.sh board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.6.7" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mq-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mq" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.04" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mq_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FORMAT_ITB=y +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-nodtb.bin" +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ATF_LOAD_ADDR=0x910000" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
Signature · 1 line
2.25.1
PATCH 1/3 board/freescale/imx: Add helper to generate fw binary
In reply to Xavier RoumegueHello Xavier,
Quoted 10 lines · On Mon, 27 Apr 2020 23:34:00 +0200 Xavier Roumegue <[email protected]> wrote:
This script aims to create an imx compatible boot image embedding mainline components, using only upstream uboot mkimage tool, avoiding dependencies on proprietary imx mkimage.
Mainline u-boot can generate a bootable image, but SPL soc proprietary firmware dependencies have to be copied on uboot root dir.
This script prevents additional buildroot uboot recipe hacking to handle custom SoC uboot build process.
Quoted 7 lines
The script actions summary is:
- Append DDR4 firmware to uboot spl binary
- Generate imx mkimage configuration file, extracting entry points from relevant elf files on the fly.
- Generate imx boot image using uboot upstream mkimage toolSigned-off-by Xavier Roumegue <[email protected]>
Thanks for this proposal. Could you share a bit more details about the upstream U-Boot i.MX8 image generation logic? How does it work, how do you trigger it, which FW binaries need to be copied to the U-Boot build directory, etc. ?
Quoted 1 line
.../common/imx/imx8-generate-fw-image.sh | 52 +++++++++++++++++++
We should perhaps find better names to distinguish imx8-bootloader-prepare.sh from imx8-generate-fw-image.sh, and make it clear which one is for which situation.
Also, is your script suitable for all i.MX8? I see upstream U-Boot has separate image tools for i.MX8 and i.MX8M.
Thanks for your feedback,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/3 board/freescale/imx: Add helper to generate fw binary
Hi Xavier,
Quoted 21 lines · Thomas Petazzoni
Hello Xavier,
Quoted 16 lines · On Mon, 27 Apr 2020 23:34:00 +0200 Xavier Roumegue <[email protected]> wrote:
This script aims to create an imx compatible boot image embedding mainline components, using only upstream uboot mkimage tool, avoiding dependencies on proprietary imx mkimage.
Mainline u-boot can generate a bootable image, but SPL soc proprietary firmware dependencies have to be copied on uboot root dir.
This script prevents additional buildroot uboot recipe hacking to handle custom SoC uboot build process.
The script actions summary is:
- Append DDR4 firmware to uboot spl binary
- Generate imx mkimage configuration file, extracting entry points from relevant elf files on the fly.
- Generate imx boot image using uboot upstream mkimage tool
Quoted 6 lines
Quoted 1 line
Signed-off-by Xavier Roumegue <[email protected]>Thanks for this proposal. Could you share a bit more details about the upstream U-Boot i.MX8 image generation logic? How does it work, how do you trigger it, which FW binaries need to be copied to the U-Boot build directory, etc. ?
Same, thanks for this proposal. However I'm not sure adding another script to basically do the same thing is the preferred option. The main difference being that it uses the U-Boot mkimage instead of imx-mkimage.
Ideally I'd like to be able to use the flash.bin U-Boot target so that we get rid of those post-build scripts for good.
Thomas, what U-Boot needs (for imx8m) are the DDR/HDMI firmware files from firmware-imx package. The main issue actually is that U-Boot looks for those binaries at its root. If we could make it point to $BINARIES_DIR instead, we could use 'flash.bin' target with U-Boot custom dependencies
[1] (if this patch gets accepted) to ensure firmware-imx was built beforehand.
Otherwise, if we decide to keep a post-build script, I'd rather have only one, preferrably this one as it doesn't depend on imx-mkimage. But as Fabio mentioned, it also needs to support 8QXP/8QM, then we could replaces imx8-bootloader-prepare.sh and also remove imx-mkimage package.
Let me know your thoughts.
Regards,
Gary
[1] http://patchwork.ozlabs.org/project/buildroot/patch/20200425000629.2068191-1-heiko at sntech.de/
Fabio Estevam
reviewerPATCH 1/3 board/freescale/imx: Add helper to generate fw binary
Quoted 15 lines · Gary Bisson
Same, thanks for this proposal. However I'm not sure adding another script to basically do the same thing is the preferred option. The main difference being that it uses the U-Boot mkimage instead of imx-mkimage.
Ideally I'd like to be able to use the flash.bin U-Boot target so that we get rid of those post-build scripts for good.
Thomas, what U-Boot needs (for imx8m) are the DDR/HDMI firmware files from firmware-imx package. The main issue actually is that U-Boot looks for those binaries at its root. If we could make it point to $BINARIES_DIR instead, we could use 'flash.bin' target with U-Boot custom dependencies
[1] (if this patch gets accepted) to ensure firmware-imx was built beforehand.
Quoted 6 lines
Otherwise, if we decide to keep a post-build script, I'd rather have only one, preferrably this one as it doesn't depend on imx-mkimage. But as Fabio mentioned, it also needs to support 8QXP/8QM, then we could replaces
imx8-bootloader-prepare.shand also remove imx-mkimage package.Let me know your thoughts.
In case it helps, Jon Nettleton also worked on adding Buildroot support for i.MX8M booting mainline U-Boot at:
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
Glad to see Xavier's patch and looking forward to being able to generate a Buildroot image for i.MX8M/8X that can boot mainline U-Boot and kernel.
Thanks
PATCH 1/3 board/freescale/imx: Add helper to generate fw binary
In reply to Thomas PetazzoniQuoted 21 lines · Thomas Petazzoni
Hello Xavier,
Quoted 16 lines · On Mon, 27 Apr 2020 23:34:00 +0200 Xavier Roumegue <[email protected]> wrote:
This script aims to create an imx compatible boot image embedding mainline components, using only upstream uboot mkimage tool, avoiding dependencies on proprietary imx mkimage.
Mainline u-boot can generate a bootable image, but SPL soc proprietary firmware dependencies have to be copied on uboot root dir.
This script prevents additional buildroot uboot recipe hacking to handle custom SoC uboot build process.
The script actions summary is:
- Append DDR4 firmware to uboot spl binary
- Generate imx mkimage configuration file, extracting entry points from relevant elf files on the fly.
- Generate imx boot image using uboot upstream mkimage tool
Quoted 6 lines
Quoted 1 line
Signed-off-by Xavier Roumegue <[email protected]>Thanks for this proposal. Could you share a bit more details about the upstream U-Boot i.MX8 image generation logic? How does it work, how do you trigger it, which FW binaries need to be copied to the U-Boot build directory, etc. ?
Hello Thomas,
iMX8 Upstream uboot adds a custom target 'flash.bin', a bootable medium once written to 33k offset.
1) On iMX8m[mqn], the (lp)ddr4 firmware, and hdmi fw for iMX8mq, have to be copied in the uboot build dir prior to execute the build.
Additional SoC firmwares (system and security controllers) have to be copied for iMX8X and iMX8QM.
2) (lp)ddr4 firmware is appended to uboot spl thanks to tools/imx8m_image.sh.
3) A config file per imx platform (*.cfg) is describing the imx mkimage parameters, ..i.e. loaders file paths and entry points, SoC firmwares, boot rom options, etc..
4) Final loader is uboot.itb, generated as dependency of flash.bin for iMX platforms, and using an its file generated by arch/arm/mach-imx/mkimage_fit_atf.sh. ATF, TEE images have as well to be copied to uboot build dir, and their entry points can be specified through environment variables.
5) Generate 'flash.bin'
The proposed script is taking care of 2), 3) and 5), with intention to support all iMX8 platforms generating the mkimage config file on the fly and relying on buildroot recipes to copy the required firmwares in images directory.
Current proposal does not generate the uboot FIT image, but this would likely be an enhancement I would like to bring once 3) is achieved for all iMX8.
Quoted 6 lines
Quoted 2 lines
.../common/imx/imx8-generate-fw-image.sh | 52 +++++++++++++++++++We should perhaps find better names to distinguish
imx8-bootloader-prepare.shfromimx8-generate-fw-image.sh, and make it clear which one is for which situation.
Would 'imx8-generate-upstream-image.sh' be more adapted ?
Quoted 3 lines
Also, is your script suitable for all i.MX8? I see upstream U-Boot has separate image tools for i.MX8 and i.MX8M.
The current script supports only iMX8MM and iMX8MQ, but the concept is to generate mkimage configuration file compatible with imx u-boot mkimage. So, this scales up to any SoC supported by mainline u-boot.
Xavier
Quoted 8 lines
Thanks for your feedback,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH 1/3 board/freescale/imx: Add helper to generate fw binary
Hello Xavier,
Quoted 18 lines · On Tue, 28 Apr 2020 23:50:46 +0200 Xavier Roumegue <[email protected]> wrote:
Hello Thomas,
iMX8 Upstream uboot adds a custom target 'flash.bin', a bootable medium once written to 33k offset.1) On iMX8m[mqn], the (lp)ddr4 firmware, and hdmi fw for iMX8mq, have to be copied in the uboot build dir prior to execute the build.
Additional SoC firmwares (system and security controllers) have to be copied for iMX8X and iMX8QM.2) (lp)ddr4 firmware is appended to uboot spl thanks to
tools/imx8m_image.sh.
3) A config file per imx platform (*.cfg) is describing the imx mkimage parameters, ..i.e. loaders file paths and entry points, SoC firmwares, boot rom options, etc..
4) Final loader is uboot.itb, generated as dependency of flash.bin for iMX platforms, and using an its file generated byarch/arm/mach-imx/mkimage_fit_atf.sh. ATF, TEE images have as well to be copied to uboot build dir, and their entry points can be specified through environment variables.
Quoted 8 lines
5) Generate 'flash.bin'
The proposed script is taking care of 2), 3) and 5), with intention to support all iMX8 platforms generating the mkimage config file on the fly and relying on buildroot recipes to copy the required firmwares in images directory.
Current proposal does not generate the uboot FIT image, but this would likely be an enhancement I would like to bring once 3) is achieved for all iMX8.
Thanks a lot for providing those additional details, and sorry for the long delay. After looking into this a bit, I really think we should leverage more what U-Boot upstream is doing, and not re-invent all this image creation logic.
So in fact, I do like better what
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
is doing. The only gotcha is that it uses BINDIR to point to BINARIES_DIR, but BINDIR doesn't exist in upstream U-Boot, it seems to be some SolidRun-specific change that we can't rely on.
But since this patch is also adding a BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE, we can definitely add some logic in uboot.mk to copy the i.MX firmware files within the U-Boot source directory prior to the build. Yes, it's more logic in uboot.mk, but I find that better than more logic in yet another custom shell script in board/.
Do you think you could rework your patch in this direction ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
v2 cover Add imx8mm platform using only upstream components
This patch set aims to add support for booting imx8m platforms with upstream BSP components, avoiding the use of proprietary imx-mkimage tool.
Uboot is using its embedded mkimage tool and a per platform configuration file to generate the boot medium thanks to additional imx specific makefile targets.
Delegating the bootable image generation to uboot requires proprietary SoC firmwares either involved in the boot flow or eventually requiring authentication to be copied in the uboot build directory.
As per Thomas proposal, this patch set mainly adds an option to copy a files list, from binaries folder to uboot build directory as dependency of uboot build step.
This was inspired from SolidRun patch below:
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
but this was adapted to prevent uboot patches and generalize the approach to any platforms.
Changes v1 -> v2:
- Initial patch set proposal was using a dedicated board script to generate the boot image as buildroot step, templatizing the configuration file used to define the boot image and reusing the firmwares from the binaries folder.
- imx8mq platform does not boot with hdmi fw embedded in the boot image and recent arm trusted firmware, so imx8mq config file is removed since a change to uboot mkimage configuration file is required.
Xavier Roumegue (8):
package/freescale-imx/firmware-imx: Add option to install all ddr fw
files
boot/uboot: Add option to install fw files list to uboot build
directory
freescale-imx/firmware-imx: Copy of all DDR files if uboot needs fw. boot/uboot/imx8: Add new target needed for mainline u-boot board/freescale/common/imx: Add Support for uboot 'flash.bin' image board/freescale/common/imx8: Use post build generated uboot image if
present
board/freescale/common/imx8: Templatize uboot image name configs/imx8mmevk: new defconfig
DEVELOPERS | 3 ++ .../common/imx/genimage.cfg.template_imx8 | 2 +- board/freescale/common/imx/post-image.sh | 6 +++- board/freescale/imx8mmevk/readme.txt | 29 ++++++++++++++-- boot/uboot/Config.in | 19 +++++++++++ boot/uboot/uboot.mk | 15 ++++++++ configs/imx8mmevk_defconfig | 34 +++++++++++++++++++ package/freescale-imx/firmware-imx/Config.in | 4 +++ .../firmware-imx/firmware-imx.mk | 12 +++++++ 9 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
--
2.28.0
v3 cover Add imx8mm platform using only upstream components
This patch set aims to add support for booting imx8m platforms with upstream BSP components, avoiding the use of proprietary imx-mkimage tool.
Uboot is using its embedded mkimage tool and a per platform configuration file to generate the boot medium thanks to additional imx specific makefile targets.
Delegating the bootable image generation to uboot requires proprietary SoC firmwares either involved in the boot flow or eventually requiring authentication to be copied in the uboot build directory.
As per Thomas proposal, this patch set mainly adds an option to copy a files list, from binaries folder to uboot build directory as dependency of uboot build step.
This was inspired from SolidRun patch below:
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
but this was adapted to prevent uboot patches and generalize the approach to any platforms.
Changes v1 -> v2:
- Initial patch set proposal was using a dedicated board script to generate the boot image as buildroot step, templatizing the configuration file used to define the boot image and reusing the firmwares from the binaries folder.
- imx8mq platform does not boot with hdmi fw embedded in the boot image and recent arm trusted firmware, so imx8mq config file is removed since a change to uboot mkimage configuration file is required.
Changes v2 -> v3:
- Use custom version for kernel, uboot (Suggested by Fabio Estevam)
Xavier Roumegue (8):
package/freescale-imx/firmware-imx: Add option to install all ddr fw
files
boot/uboot: Add option to install fw files list to uboot build
directory
freescale-imx/firmware-imx: Copy of all DDR files if uboot needs fw. boot/uboot/imx8: Add new target needed for mainline u-boot board/freescale/common/imx: Add Support for uboot 'flash.bin' image board/freescale/common/imx8: Use post build generated uboot image if
present
board/freescale/common/imx8: Templatize uboot image name configs/imx8mmevk: new defconfig
DEVELOPERS | 3 ++ .../common/imx/genimage.cfg.template_imx8 | 2 +- board/freescale/common/imx/post-image.sh | 6 ++- board/freescale/imx8mmevk/readme.txt | 29 +++++++++++++- boot/uboot/Config.in | 19 +++++++++ boot/uboot/uboot.mk | 15 +++++++ configs/imx8mmevk_defconfig | 40 +++++++++++++++++++ package/freescale-imx/firmware-imx/Config.in | 4 ++ .../firmware-imx/firmware-imx.mk | 12 ++++++ 9 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
--
2.28.0
PATCH v3 1/8 package/freescale-imx/firmware-imx: Add option to install all ddr fw files
In reply to Xavier RoumegueSelecting this option will copy all ([lp]ddr4.bin) DDR training files to BINARIES_DIR.
--- package/freescale-imx/firmware-imx/Config.in | 3 +++ package/freescale-imx/firmware-imx/firmware-imx.mk | 12 ++++++++++++ 2 files changed, 15 insertions(+)
package/freescale-imx/firmware-imx/Config.in +3 -0
@@ -81,6 +81,9 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN help The DMEM firmware will be padded to this length +config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE + bool + endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW endif # BR2_PACKAGE_FIRMWARE_IMX
package/freescale-imx/firmware-imx/firmware-imx.mk +12 -0
@@ -36,6 +36,16 @@ define FIRMWARE_IMX_PREPARE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(3)).bin endef +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE),y) +define FIRMWARE_IMX_COPY_DDR_FW + cp $(1) $(BINARIES_DIR)/ +endef +else +define FIRMWARE_IMX_COPY_DDR_FW + true +endef +endif + ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y) FIRMWARE_IMX_DDRFW_DIR = $(@D)/firmware/ddr/synopsys
@@ -51,6 +61,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4_pmu_train_2d_fw.bin > \ $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin ln -sf $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4*.bin) endef endif
@@ -69,6 +80,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/ddr4_2d_201810_fw.bin > \ $(BINARIES_DIR)/ddr4_201810_fw.bin ln -sf $(BINARIES_DIR)/ddr4_201810_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/ddr4*.bin) endef endif
Signature · 1 line
2.28.0
PATCH v3 1/8 package/freescale-imx/firmware-imx: Add option to install all ddr fw files
Hi Xavier,
Quoted 21 lines
________________________________________
From: buildroot <[email protected]> on behalf of Xavier Roumegue <[email protected]>
Sent: Monday, November 9, 2020 2:23 PM
To: buildroot at buildroot.org; Thomas Petazzoni
Cc: Gary Bisson; Xavier Roumegue; Fabio Estevam; Gilles Talis; Refik Tuzakli; Julien Olivain
Subject: [Buildroot] [PATCH v3 1/8] package/freescale-imx/firmware-imx: Add option to install all ddr fw filesSelecting this option will copy all ([lp]ddr4.bin) DDR training files to
BINARIES_DIR.Signed-off-by Xavier Roumegue <[email protected]>---
package/freescale-imx/firmware-imx/Config.in | 3 +++package/freescale-imx/firmware-imx/firmware-imx.mk| 12 ++++++++++++2 files changed, 15 insertions(+)package/freescale-imx/firmware-imx/Config.in +0
-0
package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN · line 85
Quoted 5 lines
package/freescale-imx/firmware-imx/Config.in +2
-0@@ -81,6 +81,9 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN help The DMEM firmware will be padded to this length +config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE + bool
Can you please fix the 'make check-package' error?
The same applies to a few of your other patches from the series.
Quoted 49 lines
package/freescale-imx/firmware-imx/Config.in +1
-0+endif #
BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FWendif #
BR2_PACKAGE_FIRMWARE_IMXpackage/freescale-imx/firmware-imx/firmware-imx.mk +0
-0@@ -36,6 +36,16 @@ define FIRMWARE_IMX_PREPARE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(3)).binendef
package/freescale-imx/firmware-imx/firmware-imx.mk +10
-0+ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE),y) +define FIRMWARE_IMX_COPY_DDR_FW + cp $(1) $(BINARIES_DIR)/ +endef +else +define FIRMWARE_IMX_COPY_DDR_FW + true +endef +endif +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y)
FIRMWARE_IMX_DDRFW_DIR= $(@D)/firmware/ddr/synopsyspackage/freescale-imx/firmware-imx/firmware-imx.mk +1
-0@@ -51,6 +61,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4_pmu_train_2d_fw.bin > \ $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin ln -sf $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4*.bin)endef
endifpackage/freescale-imx/firmware-imx/firmware-imx.mk +1
-0@@ -69,6 +80,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/ddr4_2d_201810_fw.bin > \ $(BINARIES_DIR)/ddr4_201810_fw.bin ln -sf $(BINARIES_DIR)/ddr4_201810_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/ddr4*.bin)endef
endif--
2.28.0_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
v4 cover Add imx8mm platform using only upstream components
In reply to Xavier RoumegueThis patch set aims to add support for booting imx8m platforms with upstream BSP components, avoiding the use of proprietary imx-mkimage tool.
Uboot is using its embedded mkimage tool and a per platform configuration file to generate the boot medium thanks to additional imx specific makefile targets.
Delegating the bootable image generation to uboot requires proprietary SoC firmwares either involved in the boot flow or eventually requiring authentication to be copied in the uboot build directory.
As per Thomas proposal, this patch set mainly adds an option to copy a files list, from binaries folder to uboot build directory as dependency of uboot build step.
This was inspired from SolidRun patch below:
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
but this was adapted to prevent uboot patches and generalize the approach to any platforms.
Changes v1 -> v2:
- Initial patch set proposal was using a dedicated board script to generate the boot image as buildroot step, templatizing the configuration file used to define the boot image and reusing the firmwares from the binaries folder.
- imx8mq platform does not boot with hdmi fw embedded in the boot image and recent arm trusted firmware, so imx8mq config file is removed since a change to uboot mkimage configuration file is required.
Changes v2 -> v3:
- Use custom version for kernel, uboot (Suggested by Fabio Estevam)
Changes v3 -> v4:
- Fix check-package reported issues (Reported by Stephane Viau)
Xavier Roumegue (8):
package/freescale-imx/firmware-imx: Add option to install all ddr fw
files
boot/uboot: Add option to install fw files list to uboot build
directory
package/freescale-imx/firmware-imx: Copy of all DDR files if uboot
needs fw.
boot/uboot/imx8: Add new target needed for mainline u-boot board/freescale/common/imx: Add Support for uboot 'flash.bin' image board/freescale/common/imx8: Use post build generated uboot image if
present
board/freescale/common/imx8: Templatize uboot image name configs/imx8mmevk: new defconfig
DEVELOPERS | 3 ++ .../common/imx/genimage.cfg.template_imx8 | 2 +- board/freescale/common/imx/post-image.sh | 6 ++- board/freescale/imx8mmevk/readme.txt | 29 +++++++++++++- boot/uboot/Config.in | 20 ++++++++++ boot/uboot/uboot.mk | 15 +++++++ configs/imx8mmevk_defconfig | 40 +++++++++++++++++++ package/freescale-imx/firmware-imx/Config.in | 4 ++ .../firmware-imx/firmware-imx.mk | 12 ++++++ 9 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
--
2.29.2
v4 cover Add imx8mm platform using only upstream components
Hi Xavier,
Am Mi., 25. Nov. 2020 um 19:30 Uhr schrieb Xavier Roumegue <[email protected]>:
Quoted 11 lines
This patch set aims to add support for booting imx8m platforms with upstream BSP components, avoiding the use of proprietary imx-mkimage tool.
Uboot is using its embedded mkimage tool and a per platform configuration file to generate the boot medium thanks to additional imx specific makefile targets.
Delegating the bootable image generation to uboot requires proprietary SoC firmwares either involved in the boot flow or eventually requiring authentication to be copied in the uboot build directory.
Quoted 8 lines
As per Thomas proposal, this patch set mainly adds an option to copy a files list, from binaries folder to uboot build directory as dependency of uboot build step.
This was inspired from SolidRun patch below:
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
but this was adapted to prevent uboot patches and generalize the approach to any platforms.
I gave the whole series a try. I was successfully able to create the U-Boot flash.bin for an imx8mq SOC.
So it works for me. Thank you.
Signature · 1 line
Heiko
v4 cover Add imx8mm platform using only upstream components
In reply to Xavier RoumegueHello Xavier,
Quoted 11 lines · On Wed, 25 Nov 2020 19:30:09 +0100 Xavier Roumegue <[email protected]> wrote:
DEVELOPERS | 3 ++ .../common/imx/genimage.cfg.template_imx8 | 2 +- board/freescale/common/imx/post-image.sh | 6 ++- board/freescale/imx8mmevk/readme.txt | 29 +++++++++++++- boot/uboot/Config.in | 20 ++++++++++ boot/uboot/uboot.mk | 15 +++++++ configs/imx8mmevk_defconfig | 40 +++++++++++++++++++ package/freescale-imx/firmware-imx/Config.in | 4 ++ .../firmware-imx/firmware-imx.mk | 12 ++++++ 9 files changed, 127 insertions(+), 4 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
Sorry for the long delay on this patch series, but I finally took some time to look into it. Unfortunately, I'm still not quite happy about how things are handled. I will reply to individual patches to explain what I dislike and how I believe it should be changed.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/8 package/freescale-imx/firmware-imx: Add option to install all ddr fw files
In reply to Xavier RoumegueSelecting this option will copy all ([lp]ddr4.bin) DDR training files to BINARIES_DIR.
---
Changes v3 -> v4:
- Fix indentation issue (detected by Stephane Viau)
--- package/freescale-imx/firmware-imx/Config.in | 3 +++ package/freescale-imx/firmware-imx/firmware-imx.mk | 12 ++++++++++++ 2 files changed, 15 insertions(+)
package/freescale-imx/firmware-imx/Config.in +3 -0
@@ -81,6 +81,9 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN help The DMEM firmware will be padded to this length +config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE + bool + endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW endif # BR2_PACKAGE_FIRMWARE_IMX
package/freescale-imx/firmware-imx/firmware-imx.mk +12 -0
@@ -36,6 +36,16 @@ define FIRMWARE_IMX_PREPARE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(3)).bin endef +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE),y) +define FIRMWARE_IMX_COPY_DDR_FW + cp $(1) $(BINARIES_DIR)/ +endef +else +define FIRMWARE_IMX_COPY_DDR_FW + true +endef +endif + ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y) FIRMWARE_IMX_DDRFW_DIR = $(@D)/firmware/ddr/synopsys
@@ -51,6 +61,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4_pmu_train_2d_fw.bin > \ $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin ln -sf $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4*.bin) endef endif
@@ -69,6 +80,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/ddr4_2d_201810_fw.bin > \ $(BINARIES_DIR)/ddr4_201810_fw.bin ln -sf $(BINARIES_DIR)/ddr4_201810_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/ddr4*.bin) endef endif
Signature · 1 line
2.29.2
PATCH v4 1/8 package/freescale-imx/firmware-imx: Add option to install all ddr fw files
HI Xavier,
Am Mi., 25. Nov. 2020 um 19:31 Uhr schrieb Xavier Roumegue <[email protected]>:
Quoted 5 lines
Selecting this option will copy all ([lp]ddr4.bin) DDR training files to
BINARIES_DIR.Signed-off-by Xavier Roumegue <[email protected]>
Signature · 1 line
Heiko
PATCH v4 1/8 package/freescale-imx/firmware-imx: Add option to install all ddr fw files
In reply to Xavier RoumegueHi Xavier,
Thanks for your contribution.
Quoted 57 lines · Xavier Roumegue
Selecting this option will copy all ([lp]ddr4.bin) DDR training files to
BINARIES_DIR.Signed-off-by Xavier Roumegue <[email protected]>Tested-by Heiko Thiery <[email protected]>---
Changes v3 -> v4:
- Fix indentation issue (detected by Stephane Viau)--- package/freescale-imx/firmware-imx/Config.in | 3 +++ package/freescale-imx/firmware-imx/firmware-imx.mk | 12 ++++++++++++ 2 files changed, 15 insertions(+)package/freescale-imx/firmware-imx/Config.in +3
-0@@ -81,6 +81,9 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN help The DMEM firmware will be padded to this length +config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE + bool + endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW endif # BR2_PACKAGE_FIRMWARE_IMXpackage/freescale-imx/firmware-imx/firmware-imx.mk +11
-0@@ -36,6 +36,16 @@ define FIRMWARE_IMX_PREPARE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(3)).bin endef +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE),y) +define FIRMWARE_IMX_COPY_DDR_FW + cp $(1) $(BINARIES_DIR)/ +endef +else +define FIRMWARE_IMX_COPY_DDR_FW + true +endef +endif + ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y) FIRMWARE_IMX_DDRFW_DIR = $(@D)/firmware/ddr/synopsys@@ -51,6 +61,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4_pmu_train_2d_fw.bin > \ $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin ln -sf $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4*.bin) endef endif
package/freescale-imx/firmware-imx/firmware-imx.mk define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW · line 83
Quoted 4 lines
package/freescale-imx/firmware-imx/firmware-imx.mk +1
-0@@ -69,6 +80,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/ddr4_2d_201810_fw.bin > \ $(BINARIES_DIR)/ddr4_201810_fw.bin ln -sf $(BINARIES_DIR)/ddr4_201810_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/ddr4*.bin)
Overvall I'm not against this but have a few remarks:
1- Wouldn't it be just easier to copy the ddr binaries in BINARIES_DIR without adding another option for it?
My take is that we should make that copy without adding FIRMWARE_IMX_COPY_DDR_FW. We could even remove ddr_fw.bin generation from here and leave it to imx8-bootloader-prepare.sh to do it. And as a second step the best would be to get rid of this script when everybody moved to U-Boot flash.bin generation.
Maybe Thomas has some insights as to what is the preferred option.
2- If we keep that option to make the copy, maybe just merge this patch with "Copy of all DDR files if uboot needs fw." and move the squashed commit _after_ UBOOT_NEEDS_FW patch.
Regards,
Gary
PATCH v4 1/8 package/freescale-imx/firmware-imx: Add option to install all ddr fw files
In reply to Xavier RoumegueHello,
Quoted 4 lines · On Wed, 25 Nov 2020 19:30:10 +0100 Xavier Roumegue <[email protected]> wrote:
Selecting this option will copy all ([lp]ddr4.bin) DDR training files to
BINARIES_DIR.Signed-off-by Xavier Roumegue <[email protected]>
The commit log is very limited, but I think I figured out what's going
on: the upstream U-Boot script tools/imx8m_image.sh needs the "raw" DDR firmware files provided by upstream firmware-imx, and not the already "mungled" files generated by Buildroot firmware-imx.mk.
So overall, I think the right direction to take would be to make firmware-imx.mk simply install the raw firmware files to $(BINARIES_DIR). From there, we would have two paths:
- For (old ?) NXP-specific U-Boot, board/freescale/common/imx/imx8-bootloader-prepare.sh would take care of doing the munging of those firmware files.
- For upstream U-Boot, the munging of those firmware files is directly done by the U-Boot build system.
So, I'd like to see a first patch that makes firmware-imx.mk just install the raw firmware files (either DDR4 or LPDDR4) to $(BINARIES_DIR) and that changes board/freescale/common/imx/imx8-bootloader-prepare.sh to do the munging that was previously done by firmware-imx.mk.
With this, no need for this obscureBR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE option.
One question: firmware-imx has multiple "versions" of each firmware file, for example:
-rw-r--r-- 1 thomas thomas 1668 16 nov. 10:10 lpddr4_pmu_train_1d_dmem_201904.bin -rw-r--r-- 1 thomas thomas 1660 16 nov. 10:10 lpddr4_pmu_train_1d_dmem_202006.bin -rw-r--r-- 1 thomas thomas 1668 16 nov. 10:10 lpddr4_pmu_train_1d_dmem.bin
Our current firmware-imx.mk uses the 201810 version for DDR4, but upstream U-Boot uses the variant with no version in its name. Is it important ?
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 2/8 boot/uboot: Add option to install fw files list to uboot build directory
In reply to Xavier RoumegueThis copies a list of fw files, which have to be installed by others packages to BINARIES_DIR to uboot build directory.
Some platforms, such as imx8, require firmware files located in the build directory to generate a bootable image.
---
Changes v3 -> v4:
- Fix indentation issue (detected by Stephane Viau)
--- boot/uboot/Config.in | 15 +++++++++++++++ boot/uboot/uboot.mk | 9 +++++++++ 2 files changed, 24 insertions(+)
boot/uboot/Config.in +15 -0
@@ -229,6 +229,21 @@ config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF endchoice +config BR2_TARGET_UBOOT_NEEDS_FW + bool "U-Boot needs FW files" + help + Some platforms (such as iMX8) requires subsystem firmware + files encapsulated within the u-boot payload such as this + configure properly the memory subystem or those later + require authentication from boot ROM. + +config BR2_TARGET_UBOOT_FW_FILES + string "Firmware files list" + depends on BR2_TARGET_UBOOT_NEEDS_FW + help + Specify the list of files to be copied in the u-boot + build directory from the binary folder. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AIS
boot/uboot/uboot.mk +9 -0
@@ -428,6 +428,15 @@ define UBOOT_KCONFIG_FIXUP_CMDS $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) endef +ifeq ($(BR2_TARGET_UBOOT_NEEDS_FW),y) +define UBOOT_COPY_TARGET_FW + $(foreach f,$(BR2_TARGET_UBOOT_FW_FILES), \ + cp -f $(BINARIES_DIR)/$(call qstrip,$(f)) $(@D)/ + ) +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_TARGET_FW +endif + ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy) #
Signature · 1 line
2.29.2
PATCH v4 2/8 boot/uboot: Add option to install fw files list to uboot build directory
Am Mi., 25. Nov. 2020 um 19:31 Uhr schrieb Xavier Roumegue <[email protected]>:
Quoted 7 lines
This copies a list of fw files, which have to be installed by others packages to
BINARIES_DIRto uboot build directory.
Some platforms, such as imx8, require firmware files located in the build directory to generate a bootable image.Signed-off-by Xavier Roumegue <[email protected]>
Quoted 55 lines
---
Changes v3 -> v4:
- Fix indentation issue (detected by Stephane Viau)--- boot/uboot/Config.in | 15 +++++++++++++++ boot/uboot/uboot.mk | 9 +++++++++ 2 files changed, 24 insertions(+)boot/uboot/Config.in +15
-0@@ -229,6 +229,21 @@ config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF endchoice +config BR2_TARGET_UBOOT_NEEDS_FW + bool "U-Boot needs FW files" + help + Some platforms (such as iMX8) requires subsystem firmware + files encapsulated within the u-boot payload such as this + configure properly the memory subystem or those later + require authentication from boot ROM. + +config BR2_TARGET_UBOOT_FW_FILES + string "Firmware files list" + depends on BR2_TARGET_UBOOT_NEEDS_FW + help + Specify the list of files to be copied in the u-boot + build directory from the binary folder. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AISboot/uboot/uboot.mk +9
-0@@ -428,6 +428,15 @@ define UBOOT_KCONFIG_FIXUP_CMDS $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) endef +ifeq ($(BR2_TARGET_UBOOT_NEEDS_FW),y) +define UBOOT_COPY_TARGET_FW + $(foreach f,$(BR2_TARGET_UBOOT_FW_FILES), \ + cp -f $(BINARIES_DIR)/$(call qstrip,$(f)) $(@D)/ + ) +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_TARGET_FW +endif + ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy) #
Signature · 1 line
Heiko
PATCH v4 2/8 boot/uboot: Add option to install fw files list to uboot build directory
In reply to Xavier RoumegueHello,
Quoted 27 lines · On Wed, 25 Nov 2020 19:30:11 +0100 Xavier Roumegue <[email protected]> wrote:
This copies a list of fw files, which have to be installed by others packages to
BINARIES_DIRto uboot build directory.
Some platforms, such as imx8, require firmware files located in the build directory to generate a bootable image.Signed-off-by Xavier Roumegue <[email protected]>---
Changes v3 -> v4:
- Fix indentation issue (detected by Stephane Viau)--- boot/uboot/Config.in | 15 +++++++++++++++ boot/uboot/uboot.mk | 9 +++++++++ 2 files changed, 24 insertions(+)boot/uboot/Config.in +4
-0@@ -229,6 +229,21 @@ config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF endchoice +config BR2_TARGET_UBOOT_NEEDS_FW + bool "U-Boot needs FW files" + help + Some platforms (such as iMX8) requires subsystem firmware
boot/uboot/Config.in config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF · line 245
Quoted 10 lines
boot/uboot/Config.in +10
-0+ files encapsulated within the u-boot payload such as this + configure properly the memory subystem or those later + require authentication from boot ROM. + +config BR2_TARGET_UBOOT_FW_FILES + string "Firmware files list" + depends on BR2_TARGET_UBOOT_NEEDS_FW + help + Specify the list of files to be copied in the u-boot + build directory from the binary folder.
These options don't work, because the firmware files would typically be provided by another package... and without adding a dependency from U-Boot on this other package, it won't work. I know you've added this dependency on the other BR2_TARGET_UBOOT_FORMAT_IMX_FIT option, but I think this is wrong, as flash.bin is not necessarily IMX related.
So instead, I would prefer a patch that adds a simple option:
config BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE
bool "U-Boot needs firmware-imx" depends on BR2_PACKAGE_FIRMWARE_IMX depends on BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
and in the .mk file:
ifeq ($(BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE),y)UBOOT_DEPENDENCIES += firmware-imx
define UBOOT_COPY_IMX_DDR_FIRMWARE
cp $(BINARIES_DIR)/... $(@D)/
endefUBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_DDR_FIRMWARE endif
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 3/8 package/freescale-imx/firmware-imx: Copy of all DDR files if uboot needs fw.
In reply to Xavier Roumegue--- package/freescale-imx/firmware-imx/Config.in | 1 + 1 file changed, 1 insertion(+)
package/freescale-imx/firmware-imx/Config.in +1 -0
@@ -83,6 +83,7 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE bool + default y if BR2_TARGET_UBOOT_NEEDS_FW endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
Signature · 1 line
2.29.2
PATCH v4 3/8 package/freescale-imx/firmware-imx: Copy of all DDR files if uboot needs fw.
Hi Xavier,
Am Mi., 25. Nov. 2020 um 19:31 Uhr schrieb Xavier Roumegue <[email protected]>:
Quoted 2 lines
Signed-off-by Xavier Roumegue <[email protected]>
Quoted 16 lines
--- package/freescale-imx/firmware-imx/Config.in | 1 + 1 file changed, 1 insertion(+)package/freescale-imx/firmware-imx/Config.in +1
-0@@ -83,6 +83,7 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE bool + default y if BR2_TARGET_UBOOT_NEEDS_FW endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
Signature · 1 line
Heiko
PATCH v4 3/8 package/freescale-imx/firmware-imx: Copy of all DDR files if uboot needs fw.
In reply to Xavier RoumegueQuoted 10 lines · On Wed, 25 Nov 2020 19:30:12 +0100 Xavier Roumegue <[email protected]> wrote:
Signed-off-by Xavier Roumegue <[email protected]>--- package/freescale-imx/firmware-imx/Config.in | 1 + 1 file changed, 1 insertion(+)package/freescale-imx/firmware-imx/Config.in +0
-0
package/freescale-imx/firmware-imx/Config.in config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN · line 86
Quoted 4 lines
package/freescale-imx/firmware-imx/Config.in +1
-0@@ -83,6 +83,7 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE bool + default y if BR2_TARGET_UBOOT_NEEDS_FW
See my proposal on PATCH 2/8, which makes this change unnecessary.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 4/8 boot/uboot/imx8: Add new target needed for mainline u-boot
In reply to Xavier RoumegueMainline u-boot support for the iMX8M based boards is no longer using the external imx-mkimage command and instead building the fit image directly inside U-Boot.
This fit image usually embeds ddr/hdmi firmware for iMX8M target.
Inspired from
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
--- boot/uboot/Config.in | 5 +++++ boot/uboot/uboot.mk | 6 ++++++ 2 files changed, 11 insertions(+)
boot/uboot/Config.in +5 -0
@@ -281,6 +281,11 @@ config BR2_TARGET_UBOOT_FORMAT_DTB_IMX config BR2_TARGET_UBOOT_FORMAT_ITB bool "u-boot.itb" +config BR2_TARGET_UBOOT_FORMAT_IMX_FIT + bool "flash.bin" + select BR2_PACKAGE_FIRMWARE_IMX + select BR2_TARGET_UBOOT_NEEDS_FW + config BR2_TARGET_UBOOT_FORMAT_KWB bool "u-boot.kwb (Marvell)" depends on BR2_arm
boot/uboot/uboot.mk +6 -0
@@ -101,6 +101,12 @@ UBOOT_BINS += u-boot.imx UBOOT_MAKE_TARGET += u-boot.imx endif +ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX_FIT),y) +UBOOT_BINS = flash.bin +UBOOT_MAKE_TARGET += flash.bin +UBOOT_DEPENDENCIES += firmware-imx +endif + ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y) UBOOT_BINS += u-boot.sb UBOOT_MAKE_TARGET += u-boot.sb
Signature · 1 line
2.29.2
PATCH v4 4/8 boot/uboot/imx8: Add new target needed for mainline u-boot
Hi Xavier,
Am Mi., 25. Nov. 2020 um 19:31 Uhr schrieb Xavier Roumegue <[email protected]>:
Quoted 11 lines
Mainline u-boot support for the iMX8M based boards is no longer using the external imx-mkimage command and instead building the fit image directly inside U-Boot.
This fit image usually embeds ddr/hdmi firmware for iMX8M target.
Inspired from
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572Signed-off-by Xavier Roumegue <[email protected]>
Quoted 38 lines
--- boot/uboot/Config.in | 5 +++++ boot/uboot/uboot.mk | 6 ++++++ 2 files changed, 11 insertions(+)boot/uboot/Config.in +5
-0@@ -281,6 +281,11 @@ config BR2_TARGET_UBOOT_FORMAT_DTB_IMX config BR2_TARGET_UBOOT_FORMAT_ITB bool "u-boot.itb" +config BR2_TARGET_UBOOT_FORMAT_IMX_FIT + bool "flash.bin" + select BR2_PACKAGE_FIRMWARE_IMX + select BR2_TARGET_UBOOT_NEEDS_FW + config BR2_TARGET_UBOOT_FORMAT_KWB bool "u-boot.kwb (Marvell)" depends on BR2_armboot/uboot/uboot.mk +6
-0@@ -101,6 +101,12 @@ UBOOT_BINS += u-boot.imx UBOOT_MAKE_TARGET += u-boot.imx endif +ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX_FIT),y) +UBOOT_BINS = flash.bin +UBOOT_MAKE_TARGET += flash.bin +UBOOT_DEPENDENCIES += firmware-imx +endif + ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y) UBOOT_BINS += u-boot.sb UBOOT_MAKE_TARGET += u-boot.sb
Signature · 1 line
Heiko
PATCH v4 4/8 boot/uboot/imx8: Add new target needed for mainline u-boot
In reply to Xavier RoumegueHi Xavier,
Quoted 21 lines · Xavier Roumegue
Mainline u-boot support for the iMX8M based boards is no longer using the external imx-mkimage command and instead building the fit image directly inside U-Boot.
This fit image usually embeds ddr/hdmi firmware for iMX8M target.
Inspired from
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572Signed-off-by Xavier Roumegue <[email protected]>Tested-by Heiko Thiery <[email protected]>--- boot/uboot/Config.in | 5 +++++ boot/uboot/uboot.mk | 6 ++++++ 2 files changed, 11 insertions(+)boot/uboot/Config.in +0
-0
boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_DTB_IMX · line 284
Quoted 4 lines
boot/uboot/Config.in +1
-0@@ -281,6 +281,11 @@ config BR2_TARGET_UBOOT_FORMAT_DTB_IMX config BR2_TARGET_UBOOT_FORMAT_ITB bool "u-boot.itb" +config BR2_TARGET_UBOOT_FORMAT_IMX_FIT
I know this was copied from SolidRun but I'm not a fan of the IMX_FIT name. True flash.bin includes a FIT image but SPL/FW etc are outside of it, it's not just a FIT image.
Maybe NXP will do another boot image format in the future that will also include a FIT image but the rest would be different.
Since the U-Boot target is simply "flash.bin" I would name it UBOOT_FORMAT_FLASH_BIN.
boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_DTB_IMX · line 286
Quoted 2 lines
boot/uboot/Config.in +2
-0+ bool "flash.bin" + select BR2_PACKAGE_FIRMWARE_IMX
You can't do that unfortunately, you need to either have a test around that option or add a depends on BR2_PACKAGE_FREESCALE_IMX.
Otherwise it will give this:
WARNING: unmet direct dependencies detected for BR2_PACKAGE_FIRMWARE_IMX
Depends on [n]: BR2_PACKAGE_FREESCALE_IMX [=n] && (BR2_arm [=y] || BR2_aarch64 [=n]) Selected by [y]:
- BR2_TARGET_UBOOT_FORMAT_IMX_FIT [=y] && BR2_TARGET_UBOOT [=y]
Regards,
Gary
PATCH v4 4/8 boot/uboot/imx8: Add new target needed for mainline u-boot
In reply to Xavier RoumegueQuoted 20 lines · On Wed, 25 Nov 2020 19:30:13 +0100 Xavier Roumegue <[email protected]> wrote:
Mainline u-boot support for the iMX8M based boards is no longer using the external imx-mkimage command and instead building the fit image directly inside U-Boot.
This fit image usually embeds ddr/hdmi firmware for iMX8M target.
Inspired from
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572Signed-off-by Xavier Roumegue <[email protected]>--- boot/uboot/Config.in | 5 +++++ boot/uboot/uboot.mk | 6 ++++++ 2 files changed, 11 insertions(+)boot/uboot/Config.in +0
-0
boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_DTB_IMX · line 287
Quoted 7 lines
boot/uboot/Config.in +4
-0@@ -281,6 +281,11 @@ config BR2_TARGET_UBOOT_FORMAT_DTB_IMX config BR2_TARGET_UBOOT_FORMAT_ITB bool "u-boot.itb" +config BR2_TARGET_UBOOT_FORMAT_IMX_FIT + bool "flash.bin" + select BR2_PACKAGE_FIRMWARE_IMX + select BR2_TARGET_UBOOT_NEEDS_FW
I concur with Gary here, this should be just:
config BR2_TARGET_UBOOT_FORMAT_FLASH_BIN
bool "flash.bin"
and it should just trigger the build of the "flash.bin" target. The dependency on i.MX firmware should be handled by the separate U-Boot option I have proposed in reply to your PATCH 2/8.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 5/8 board/freescale/common/imx: Add Support for uboot 'flash.bin' image
In reply to Xavier Roumegue--- board/freescale/common/imx/post-image.sh | 2 ++ 1 file changed, 2 insertions(+)
board/freescale/common/imx/post-image.sh +2 -0
@@ -70,6 +70,8 @@ uboot_image() echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y$" ${BR2_CONFIG}; then + echo "flash.bin" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.img" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMG=y$" ${BR2_CONFIG}; then
Signature · 1 line
2.29.2
PATCH v4 5/8 board/freescale/common/imx: Add Support for uboot 'flash.bin' image
Hi Xavier,
Am Mi., 25. Nov. 2020 um 19:32 Uhr schrieb Xavier Roumegue <[email protected]>:
Quoted 2 lines
Signed-off-by Xavier Roumegue <[email protected]>
Quoted 17 lines
--- board/freescale/common/imx/post-image.sh | 2 ++ 1 file changed, 2 insertions(+)board/freescale/common/imx/post-image.sh +2
-0@@ -70,6 +70,8 @@ uboot_image() echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y$" ${BR2_CONFIG}; then + echo "flash.bin" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.img" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMG=y$" ${BR2_CONFIG}; then
Signature · 1 line
Heiko
PATCH v4 6/8 board/freescale/common/imx8: Use post build generated uboot image if present
In reply to Xavier RoumegueStick the uboot image filename to "imx8-boot-sd.bin" in case the final uboot image, embedding fw files, is generated thanks to a post build script.
This takes precedence over all uboot images generating during uboot build.
This should help to remove the dedicated imx8 config template file
--- board/freescale/common/imx/post-image.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
board/freescale/common/imx/post-image.sh +3 -1
@@ -66,7 +66,9 @@ imx_offset() uboot_image() { - if grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then + if [ -e "${BINARIES_DIR}"/imx8-boot-sd.bin ]; then + echo "imx8-boot-sd.bin" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx"
Signature · 1 line
2.29.2
PATCH v4 6/8 board/freescale/common/imx8: Use post build generated uboot image if present
Hi Xavier,
Am Mi., 25. Nov. 2020 um 19:32 Uhr schrieb Xavier Roumegue <[email protected]>:
Quoted 11 lines
Stick the uboot image filename to "imx8-boot-sd.bin" in case the final uboot image, embedding fw files, is generated thanks to a post build script.
This takes precedence over all uboot images generating during uboot build.
This should help to remove the dedicated imx8 config template file
Signed-off-by Xavier Roumegue <[email protected]>
Quoted 19 lines
--- board/freescale/common/imx/post-image.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)board/freescale/common/imx/post-image.sh +3
-1@@ -66,7 +66,9 @@ imx_offset() uboot_image() { - if grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then + if [ -e "${BINARIES_DIR}"/imx8-boot-sd.bin ]; then + echo "imx8-boot-sd.bin" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx"
Signature · 1 line
Heiko
PATCH v4 6/8 board/freescale/common/imx8: Use post build generated uboot image if present
In reply to Xavier RoumegueQuoted 7 lines · On Wed, 25 Nov 2020 19:30:15 +0100 Xavier Roumegue <[email protected]> wrote:
Stick the uboot image filename to "imx8-boot-sd.bin" in case the final uboot image, embedding fw files, is generated thanks to a post build script.
This takes precedence over all uboot images generating during uboot build.
Quoted 6 lines
This should help to remove the dedicated imx8 config template file
Signed-off-by Xavier Roumegue <[email protected]>--- board/freescale/common/imx/post-image.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
I don't really understand what the purpose of this change is. Indeed, you're not removing the dedicated imx8 config template file in your patch series. And even your defconfig calls board/freescale/common/imx/post-image.sh, which based on:
elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=y$" ${BR2_CONFIG}; then
echo "genimage.cfg.template_imx8"will use the imx8 config template file for genimage.
So I'm rather confused by what's going on here.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 6/8 board/freescale/common/imx8: Use post build generated uboot image if present
Quoted 11 lines · On Sat, 23 Jan 2021 23:36:28 +0100 Thomas Petazzoni…
I don't really understand what the purpose of this change is. Indeed, you're not removing the dedicated imx8 config template file in your patch series. And even your defconfig calls
board/freescale/common/imx/post-image.sh, which based on:elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=y$" ${BR2_CONFIG}; then echo "genimage.cfg.template_imx8"will use the imx8 config template file for genimage.
So I'm rather confused by what's going on here.
Ah, I think that I see. The bootloader image name for i.MX8 always used to be imx8-boot-sd.bin, so it was hardcoded in genimage.cfg.template_imx8. But now, it might be imx8-boot-sd.bin for old vendor U-Boot, or flash.bin for new upstream U-Boot.
And since you have no way to know which one is used, this patch is proposing to rely on the existence of imx8-boot-sd.bin to decide if it should be used or not.
I am not a huge fan of the proposed solution, but I don't have a very nice proposal to make. We could extend post-image.sh to check if we're on an i.MX8 platform, and if so, if BR2_TARGET_UBOOT_FLASH_BIN=y, use flash.bin, otherwise use imx8-boot-sd.bin, but maybe that's getting over-complicated.
So I think, let's stick with your solution, but with a better commit log that explains what's going on.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 7/8 board/freescale/common/imx8: Templatize uboot image name
In reply to Xavier Roumegue--- board/freescale/common/imx/genimage.cfg.template_imx8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/imx/genimage.cfg.template_imx8 +1 -1
@@ -23,7 +23,7 @@ image sdcard.img { partition imx-boot { in-partition-table = "no" - image = "imx8-boot-sd.bin" + image = "%UBOOTBIN%" offset = %IMXOFFSET% }
Signature · 1 line
2.29.2
PATCH v4 8/8 configs/imx8mmevk: new defconfig
In reply to Xavier RoumegueIntroduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
--- DEVELOPERS | 3 +++ board/freescale/imx8mmevk/readme.txt | 29 ++++++++++++++++++-- configs/imx8mmevk_defconfig | 40 ++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
DEVELOPERS +3 -0
@@ -2684,6 +2684,9 @@ F: package/fwup/ N: Yair Ben Avraham <[email protected]> F: package/gloox/ +N: Xavier Roumegue <[email protected]> +F: configs/imx8mmevk_defconfig + N: Yann E. MORIN <[email protected]> F: board/friendlyarm/nanopi-neo/ F: configs/nanopi_neo_defconfig
board/freescale/imx8mmevk/readme.txt +27 -2
@@ -5,8 +5,8 @@ Freescale i.MX8MM EVK board This file documents the Buildroot support for the Freescale i.MX8MM EVK board. -Build -===== +Building with NXP ATF, U-Boot and kernel +======================================== First, configure Buildroot for the i.MX8MM EVK board:
@@ -32,6 +32,31 @@ You will find in output/images/ the following files: - u-boot-nodtb.bin - u-boot-spl-ddr.bin +Building with mainline ATF, U-Boot and kernel +============================================= +First, configure Buildroot for the i.MX8MM EVK board: + + make imx8mmevk_defconfig + +Build all components: + + make + +You will find in output/images/ the following files: + - bl31.bin + - boot.vfat + - ddr_fw.bin + - flash.bin + - Image + - imx8mm-evk.dtb + - [lp]ddr4_*.bin + - rootfs.ext2 + - rootfs.ext4 + - rootfs.tar + - sdcard.img + - u-boot-spl + - u-boot-spl.bin + Create a bootable SD card =========================
configs/imx8mmevk_defconfig new file +40 -0
@@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_8=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.18" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FW_FILES="lpddr4*.bin" +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ATF_LOAD_ADDR=0x920000" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
Signature · 1 line
2.29.2
PATCH v4 8/8 configs/imx8mmevk: new defconfig
Hello Xavier, all,
Successfully tested on my imx8mm evk board.
Le mer. 25 nov. 2020 ? 19:31, Xavier Roumegue <[email protected]> a ?crit :
Quoted 124 lines
Introduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
Signed-off-by Xavier Roumegue <[email protected]>Tested-by Julien Olivain <[email protected]>Reviewed-by Fabio Estevam <[email protected]>--- DEVELOPERS | 3 +++ board/freescale/imx8mmevk/readme.txt | 29 ++++++++++++++++++-- configs/imx8mmevk_defconfig | 40 ++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 configs/imx8mmevk_defconfigDEVELOPERS +3
-0@@ -2684,6 +2684,9 @@ F: package/fwup/ N: Yair Ben Avraham <[email protected]> F: package/gloox/ +N: Xavier Roumegue <[email protected]> +F: configs/imx8mmevk_defconfig + N: Yann E. MORIN <[email protected]> F: board/friendlyarm/nanopi-neo/ F: configs/nanopi_neo_defconfigboard/freescale/imx8mmevk/readme.txt +27
-2@@ -5,8 +5,8 @@ Freescale i.MX8MM EVK board This file documents the Buildroot support for the Freescale i.MX8MM EVK board. -Build -===== +Building with NXP ATF, U-Boot and kernel +======================================== First, configure Buildroot for the i.MX8MM EVK board:@@ -32,6 +32,31 @@ You will find in output/images/ the following files: - u-boot-nodtb.bin - u-boot-spl-ddr.bin +Building with mainline ATF, U-Boot and kernel +============================================= +First, configure Buildroot for the i.MX8MM EVK board: + + make imx8mmevk_defconfig + +Build all components: + + make + +You will find in output/images/ the following files: + - bl31.bin + - boot.vfat + - ddr_fw.bin + - flash.bin + - Image + - imx8mm-evk.dtb + - [lp]ddr4_*.bin + - rootfs.ext2 + - rootfs.ext4 + - rootfs.tar + - sdcard.img + - u-boot-spl + - u-boot-spl.bin + Create a bootable SD card =========================configs/imx8mmevk_defconfig new file +40
-1@@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_8=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.18" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FW_FILES="lpddr4*.bin" +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ATF_LOAD_ADDR=0x920000" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y --
Quoted 2 lines
2.29.2
PATCH v3 2/8 boot/uboot: Add option to install fw files list to uboot build directory
In reply to Xavier RoumegueThis copies a list of fw files, which have to be installed by others packages to BINARIES_DIR to uboot build directory.
Some platforms, such as imx8, require firmware files located in the build directory to generate a bootable image.
--- boot/uboot/Config.in | 14 ++++++++++++++ boot/uboot/uboot.mk | 9 +++++++++ 2 files changed, 23 insertions(+)
boot/uboot/Config.in +14 -0
@@ -229,6 +229,20 @@ config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF endchoice +config BR2_TARGET_UBOOT_NEEDS_FW + bool "U-Boot needs FW files" + help + Some platforms (such as iMX8) requires subsystem firmware files + encapsulated within the u-boot payload such as this configure properly the + memory subystem or those later require authentication from boot ROM. + +config BR2_TARGET_UBOOT_FW_FILES + depends on BR2_TARGET_UBOOT_NEEDS_FW + string "Firmware files list" + help + Specify the list of files to be copied in the u-boot build directory from + the binary folder. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AIS
boot/uboot/uboot.mk +9 -0
@@ -428,6 +428,15 @@ define UBOOT_KCONFIG_FIXUP_CMDS $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) endef +ifeq ($(BR2_TARGET_UBOOT_NEEDS_FW),y) +define UBOOT_COPY_TARGET_FW + $(foreach f,$(BR2_TARGET_UBOOT_FW_FILES), \ + cp -f $(BINARIES_DIR)/$(call qstrip,$(f)) $(@D)/ + ) +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_TARGET_FW +endif + ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy) #
Signature · 1 line
2.28.0
PATCH v3 3/8 freescale-imx/firmware-imx: Copy of all DDR files if uboot needs fw.
In reply to Xavier Roumegue--- package/freescale-imx/firmware-imx/Config.in | 1 + 1 file changed, 1 insertion(+)
package/freescale-imx/firmware-imx/Config.in +1 -0
@@ -83,6 +83,7 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE bool + default y if BR2_TARGET_UBOOT_NEEDS_FW endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
Signature · 1 line
2.28.0
PATCH v3 4/8 boot/uboot/imx8: Add new target needed for mainline u-boot
In reply to Xavier RoumegueMainline u-boot support for the iMX8M based boards is no longer using the external imx-mkimage command and instead building the fit image directly inside U-Boot.
This fit image usually embeds ddr/hdmi firmware for iMX8M target.
Inspired from
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
--- boot/uboot/Config.in | 5 +++++ boot/uboot/uboot.mk | 6 ++++++ 2 files changed, 11 insertions(+)
boot/uboot/Config.in +5 -0
@@ -280,6 +280,11 @@ config BR2_TARGET_UBOOT_FORMAT_DTB_IMX config BR2_TARGET_UBOOT_FORMAT_ITB bool "u-boot.itb" +config BR2_TARGET_UBOOT_FORMAT_IMX_FIT + bool "flash.bin" + select BR2_PACKAGE_FIRMWARE_IMX + select BR2_TARGET_UBOOT_NEEDS_FW + config BR2_TARGET_UBOOT_FORMAT_KWB bool "u-boot.kwb (Marvell)" depends on BR2_arm
boot/uboot/uboot.mk +6 -0
@@ -101,6 +101,12 @@ UBOOT_BINS += u-boot.imx UBOOT_MAKE_TARGET += u-boot.imx endif +ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX_FIT),y) +UBOOT_BINS = flash.bin +UBOOT_MAKE_TARGET += flash.bin +UBOOT_DEPENDENCIES += firmware-imx +endif + ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y) UBOOT_BINS += u-boot.sb UBOOT_MAKE_TARGET += u-boot.sb
Signature · 1 line
2.28.0
PATCH v3 5/8 board/freescale/common/imx: Add Support for uboot 'flash.bin' image
In reply to Xavier Roumegue--- board/freescale/common/imx/post-image.sh | 2 ++ 1 file changed, 2 insertions(+)
board/freescale/common/imx/post-image.sh +2 -0
@@ -70,6 +70,8 @@ uboot_image() echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y$" ${BR2_CONFIG}; then + echo "flash.bin" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.img" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMG=y$" ${BR2_CONFIG}; then
Signature · 1 line
2.28.0
PATCH v3 6/8 board/freescale/common/imx8: Use post build generated uboot image if present
In reply to Xavier RoumegueStick the uboot image filename to "imx8-boot-sd.bin" in case the final uboot image, embedding fw files, is generated thanks to a post build script.
This takes precedence over all uboot images generating during uboot build.
This should help to remove the dedicated imx8 config template file
--- board/freescale/common/imx/post-image.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
board/freescale/common/imx/post-image.sh +3 -1
@@ -66,7 +66,9 @@ imx_offset() uboot_image() { - if grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then + if [ -e "${BINARIES_DIR}"/imx8-boot-sd.bin ]; then + echo "imx8-boot-sd.bin" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx"
Signature · 1 line
2.28.0
PATCH v3 7/8 board/freescale/common/imx8: Templatize uboot image name
In reply to Xavier Roumegue--- board/freescale/common/imx/genimage.cfg.template_imx8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/imx/genimage.cfg.template_imx8 +1 -1
@@ -23,7 +23,7 @@ image sdcard.img { partition imx-boot { in-partition-table = "no" - image = "imx8-boot-sd.bin" + image = "%UBOOTBIN%" offset = %IMXOFFSET% }
Signature · 1 line
2.28.0
PATCH v3 8/8 configs/imx8mmevk: new defconfig
In reply to Xavier RoumegueIntroduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
---
Changes v2 -> v3:
- Set a custom version to uboot/kernel (Suggested by Fabio Estevam)
--- DEVELOPERS | 3 +++ board/freescale/imx8mmevk/readme.txt | 29 ++++++++++++++++++-- configs/imx8mmevk_defconfig | 40 ++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
DEVELOPERS +3 -0
@@ -2690,6 +2690,9 @@ F: package/fwup/ N: Yair Ben Avraham <[email protected]> F: package/gloox/ +N: Xavier Roumegue <[email protected]> +F: configs/imx8mmevk_defconfig + N: Yann E. MORIN <[email protected]> F: board/friendlyarm/nanopi-neo/ F: configs/nanopi_neo_defconfig
board/freescale/imx8mmevk/readme.txt +27 -2
@@ -5,8 +5,8 @@ Freescale i.MX8MM EVK board This file documents the Buildroot support for the Freescale i.MX8MM EVK board. -Build -===== +Building with NXP ATF, U-Boot and kernel +======================================== First, configure Buildroot for the i.MX8MM EVK board:
@@ -32,6 +32,31 @@ You will find in output/images/ the following files: - u-boot-nodtb.bin - u-boot-spl-ddr.bin +Building with mainline ATF, U-Boot and kernel +============================================= +First, configure Buildroot for the i.MX8MM EVK board: + + make imx8mmevk_defconfig + +Build all components: + + make + +You will find in output/images/ the following files: + - bl31.bin + - boot.vfat + - ddr_fw.bin + - flash.bin + - Image + - imx8mm-evk.dtb + - [lp]ddr4_*.bin + - rootfs.ext2 + - rootfs.ext4 + - rootfs.tar + - sdcard.img + - u-boot-spl + - u-boot-spl.bin + Create a bootable SD card =========================
configs/imx8mmevk_defconfig new file +40 -0
@@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_8=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.18" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FW_FILES="lpddr4*.bin" +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ATF_LOAD_ADDR=0x920000" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
Signature · 1 line
2.28.0
PATCH v3 8/8 configs/imx8mmevk: new defconfig
Hi,
Quoted 6 lines · Xavier Roumegue
Introduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
Signed-off-by Xavier Roumegue <[email protected]>
Quoted 119 lines
---
Changes v2 -> v3:
- Set a custom version to uboot/kernel (Suggested by Fabio Estevam)--- DEVELOPERS | 3 +++ board/freescale/imx8mmevk/readme.txt | 29 ++++++++++++++++++-- configs/imx8mmevk_defconfig | 40 ++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 configs/imx8mmevk_defconfigDEVELOPERS +3
-0@@ -2690,6 +2690,9 @@ F: package/fwup/ N: Yair Ben Avraham <[email protected]> F: package/gloox/ +N: Xavier Roumegue <[email protected]> +F: configs/imx8mmevk_defconfig + N: Yann E. MORIN <[email protected]> F: board/friendlyarm/nanopi-neo/ F: configs/nanopi_neo_defconfigboard/freescale/imx8mmevk/readme.txt +27
-2@@ -5,8 +5,8 @@ Freescale i.MX8MM EVK board This file documents the Buildroot support for the Freescale i.MX8MM EVK board. -Build -===== +Building with NXP ATF, U-Boot and kernel +======================================== First, configure Buildroot for the i.MX8MM EVK board:@@ -32,6 +32,31 @@ You will find in output/images/ the following files: - u-boot-nodtb.bin - u-boot-spl-ddr.bin +Building with mainline ATF, U-Boot and kernel +============================================= +First, configure Buildroot for the i.MX8MM EVK board: + + make imx8mmevk_defconfig + +Build all components: + + make + +You will find in output/images/ the following files: + - bl31.bin + - boot.vfat + - ddr_fw.bin + - flash.bin + - Image + - imx8mm-evk.dtb + - [lp]ddr4_*.bin + - rootfs.ext2 + - rootfs.ext4 + - rootfs.tar + - sdcard.img + - u-boot-spl + - u-boot-spl.bin + Create a bootable SD card =========================configs/imx8mmevk_defconfig new file +40
-0@@ -0,0 +1,40 @@ +BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_8=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.18" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_VERSION=y +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10" +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FW_FILES="lpddr4*.bin" +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ATF_LOAD_ADDR=0x920000" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
Fabio Estevam
reviewerPATCH v3 8/8 configs/imx8mmevk: new defconfig
In reply to Xavier RoumegueHi Xavier,
Quoted 11 lines · Xavier Roumegue
Introduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
Signed-off-by Xavier Roumegue <[email protected]>---
Changes v2 -> v3:
- Set a custom version to uboot/kernel (Suggested by Fabio Estevam)
It looks good now:
Looking forward to seeing this patch series applied :-)
Thanks for your work!
PATCH v2 1/8 package/freescale-imx/firmware-imx: Add option to install all ddr fw files
In reply to Thomas PetazzoniSelecting this option will copy all ([lp]ddr4.bin) DDR training files to BINARIES_DIR.
--- package/freescale-imx/firmware-imx/Config.in | 3 +++ package/freescale-imx/firmware-imx/firmware-imx.mk | 12 ++++++++++++ 2 files changed, 15 insertions(+)
package/freescale-imx/firmware-imx/Config.in +3 -0
@@ -81,6 +81,9 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN help The DMEM firmware will be padded to this length +config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE + bool + endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW endif # BR2_PACKAGE_FIRMWARE_IMX
package/freescale-imx/firmware-imx/firmware-imx.mk +12 -0
@@ -36,6 +36,16 @@ define FIRMWARE_IMX_PREPARE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/$(strip $(3)).bin endef +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE),y) +define FIRMWARE_IMX_COPY_DDR_FW + cp $(1) $(BINARIES_DIR)/ +endef +else +define FIRMWARE_IMX_COPY_DDR_FW + true +endef +endif + ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y) FIRMWARE_IMX_DDRFW_DIR = $(@D)/firmware/ddr/synopsys
@@ -51,6 +61,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4_pmu_train_2d_fw.bin > \ $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin ln -sf $(BINARIES_DIR)/lpddr4_pmu_train_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4*.bin) endef endif
@@ -69,6 +80,7 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/ddr4_2d_201810_fw.bin > \ $(BINARIES_DIR)/ddr4_201810_fw.bin ln -sf $(BINARIES_DIR)/ddr4_201810_fw.bin $(BINARIES_DIR)/ddr_fw.bin + $(call FIRMWARE_IMX_COPY_DDR_FW, $(FIRMWARE_IMX_DDRFW_DIR)/ddr4*.bin) endef endif
Signature · 1 line
2.28.0
PATCH v2 2/8 boot/uboot: Add option to install fw files list to uboot build directory
In reply to Thomas PetazzoniThis copies a list of fw files, which have to be installed by others packages to BINARIES_DIR to uboot build directory.
Some platforms, such as imx8, require firmware files located in the build directory to generate a bootable image.
--- boot/uboot/Config.in | 14 ++++++++++++++ boot/uboot/uboot.mk | 9 +++++++++ 2 files changed, 23 insertions(+)
boot/uboot/Config.in +14 -0
@@ -229,6 +229,20 @@ config BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF endchoice +config BR2_TARGET_UBOOT_NEEDS_FW + bool "U-Boot needs FW files" + help + Some platforms (such as iMX8) requires subsystem firmware files + encapsulated within the u-boot payload such as this configure properly the + memory subystem or those later require authentication from boot ROM. + +config BR2_TARGET_UBOOT_FW_FILES + depends on BR2_TARGET_UBOOT_NEEDS_FW + string "Firmware files list" + help + Specify the list of files to be copied in the u-boot build directory from + the binary folder. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AIS
boot/uboot/uboot.mk +9 -0
@@ -428,6 +428,15 @@ define UBOOT_KCONFIG_FIXUP_CMDS $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) endef +ifeq ($(BR2_TARGET_UBOOT_NEEDS_FW),y) +define UBOOT_COPY_TARGET_FW + $(foreach f,$(BR2_TARGET_UBOOT_FW_FILES), \ + cp -f $(BINARIES_DIR)/$(call qstrip,$(f)) $(@D)/ + ) +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_TARGET_FW +endif + ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy) #
Signature · 1 line
2.28.0
PATCH v2 3/8 freescale-imx/firmware-imx: Copy of all DDR files if uboot needs fw.
In reply to Thomas Petazzoni--- package/freescale-imx/firmware-imx/Config.in | 1 + 1 file changed, 1 insertion(+)
package/freescale-imx/firmware-imx/Config.in +1 -0
@@ -83,6 +83,7 @@ config BR2_PACKAGE_FIRMWARE_IMX_DMEM_LEN config BR2_PACKAGE_FIRMWARE_IMX_DDR_FW_MULTIPLE bool + default y if BR2_TARGET_UBOOT_NEEDS_FW endif # BR2_PACKAGE_FIRMWARE_IMX_NEEDS_DDR_FW
Signature · 1 line
2.28.0
PATCH v2 4/8 boot/uboot/imx8: Add new target needed for mainline u-boot
In reply to Thomas PetazzoniMainline u-boot support for the iMX8M based boards is no longer using the external imx-mkimage command and instead building the fit image directly inside U-Boot.
This fit image usually embeds ddr/hdmi firmware for iMX8M target.
Inspired from
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
--- boot/uboot/Config.in | 5 +++++ boot/uboot/uboot.mk | 6 ++++++ 2 files changed, 11 insertions(+)
boot/uboot/Config.in +5 -0
@@ -280,6 +280,11 @@ config BR2_TARGET_UBOOT_FORMAT_DTB_IMX config BR2_TARGET_UBOOT_FORMAT_ITB bool "u-boot.itb" +config BR2_TARGET_UBOOT_FORMAT_IMX_FIT + bool "flash.bin" + select BR2_PACKAGE_FIRMWARE_IMX + select BR2_TARGET_UBOOT_NEEDS_FW + config BR2_TARGET_UBOOT_FORMAT_KWB bool "u-boot.kwb (Marvell)" depends on BR2_arm
boot/uboot/uboot.mk +6 -0
@@ -101,6 +101,12 @@ UBOOT_BINS += u-boot.imx UBOOT_MAKE_TARGET += u-boot.imx endif +ifeq ($(BR2_TARGET_UBOOT_FORMAT_IMX_FIT),y) +UBOOT_BINS = flash.bin +UBOOT_MAKE_TARGET += flash.bin +UBOOT_DEPENDENCIES += firmware-imx +endif + ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y) UBOOT_BINS += u-boot.sb UBOOT_MAKE_TARGET += u-boot.sb
Signature · 1 line
2.28.0
PATCH v2 5/8 board/freescale/common/imx: Add Support for uboot 'flash.bin' image
In reply to Thomas Petazzoni--- board/freescale/common/imx/post-image.sh | 2 ++ 1 file changed, 2 insertions(+)
board/freescale/common/imx/post-image.sh +2 -0
@@ -70,6 +70,8 @@ uboot_image() echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y$" ${BR2_CONFIG}; then + echo "flash.bin" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.img" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMG=y$" ${BR2_CONFIG}; then
Signature · 1 line
2.28.0
PATCH v2 6/8 board/freescale/common/imx8: Use post build generated uboot image if present
In reply to Thomas PetazzoniStick the uboot image filename to "imx8-boot-sd.bin" in case the final uboot image, embedding fw files, is generated thanks to a post build script.
This takes precedence over all uboot images generating during uboot build.
This should help to remove the dedicated imx8 config template file
--- board/freescale/common/imx/post-image.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
board/freescale/common/imx/post-image.sh +3 -1
@@ -66,7 +66,9 @@ imx_offset() uboot_image() { - if grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then + if [ -e "${BINARIES_DIR}"/imx8-boot-sd.bin ]; then + echo "imx8-boot-sd.bin" + elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then echo "u-boot-dtb.imx" elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then echo "u-boot.imx"
Signature · 1 line
2.28.0
PATCH v2 7/8 board/freescale/common/imx8: Templatize uboot image name
In reply to Thomas Petazzoni--- board/freescale/common/imx/genimage.cfg.template_imx8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/freescale/common/imx/genimage.cfg.template_imx8 +1 -1
@@ -23,7 +23,7 @@ image sdcard.img { partition imx-boot { in-partition-table = "no" - image = "imx8-boot-sd.bin" + image = "%UBOOTBIN%" offset = %IMXOFFSET% }
Signature · 1 line
2.28.0
PATCH v2 8/8 configs/imx8mmevk: new defconfig
In reply to Thomas PetazzoniIntroduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
--- DEVELOPERS | 3 +++ board/freescale/imx8mmevk/readme.txt | 29 ++++++++++++++++++++++-- configs/imx8mmevk_defconfig | 34 ++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 configs/imx8mmevk_defconfig
DEVELOPERS +3 -0
@@ -2690,6 +2690,9 @@ F: package/fwup/ N: Yair Ben Avraham <[email protected]> F: package/gloox/ +N: Xavier Roumegue <[email protected]> +F: configs/imx8mmevk_defconfig + N: Yann E. MORIN <[email protected]> F: board/friendlyarm/nanopi-neo/ F: configs/nanopi_neo_defconfig
board/freescale/imx8mmevk/readme.txt +27 -2
@@ -5,8 +5,8 @@ Freescale i.MX8MM EVK board This file documents the Buildroot support for the Freescale i.MX8MM EVK board. -Build -===== +Building with NXP ATF, U-Boot and kernel +======================================== First, configure Buildroot for the i.MX8MM EVK board:
@@ -32,6 +32,31 @@ You will find in output/images/ the following files: - u-boot-nodtb.bin - u-boot-spl-ddr.bin +Building with mainline ATF, U-Boot and kernel +============================================= +First, configure Buildroot for the i.MX8MM EVK board: + + make imx8mmevk_defconfig + +Build all components: + + make + +You will find in output/images/ the following files: + - bl31.bin + - boot.vfat + - ddr_fw.bin + - flash.bin + - Image + - imx8mm-evk.dtb + - [lp]ddr4_*.bin + - rootfs.ext2 + - rootfs.ext4 + - rootfs.tar + - sdcard.img + - u-boot-spl + - u-boot-spl.bin + Create a bootable SD card =========================
configs/imx8mmevk_defconfig new file +34 -0
@@ -0,0 +1,34 @@ +BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FW_FILES="lpddr4*.bin" +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl" +BR2_TARGET_UBOOT_CUSTOM_MAKEOPTS="ATF_LOAD_ADDR=0x920000" +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS_FIT_SUPPORT=y
Signature · 1 line
2.28.0
Fabio Estevam
reviewerPATCH v2 8/8 configs/imx8mmevk: new defconfig
Hi Xavier,
Quoted 5 lines · Xavier Roumegue
Introduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
Thanks for working on this series!
configs/imx8mmevk_defconfig line 9
Quoted 9 lines
configs/imx8mmevk_defconfig new file +9
-0+BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
You missed to pass the specific kernel version like:
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.7"
Quoted 9 lines
configs/imx8mmevk_defconfig new file +9
-0+BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm"
configs/imx8mmevk_defconfig line 28
Quoted 10 lines
configs/imx8mmevk_defconfig new file +10
-0+BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FW_FILES="lpddr4*.bin" +# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl"
You missed to pass the specific U-Boot version like:
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10"
Thanks
PATCH v2 8/8 configs/imx8mmevk: new defconfig
On Sat, Nov 07, 2020 at 09:05:10PM -0300, Fabio Estevam wrote:
Hi Fabio,
Quoted 39 lines
Hi Xavier,
Quoted 5 lines · Xavier Roumegue
Introduce NXP imx8mm evk board configuration that uses mainline atf, uboot and kernel.
Mainline uboot mkimage tool generates the boot image.
Thanks for working on this series!
configs/imx8mmevk_defconfig line 9
Quoted 9 lines
configs/imx8mmevk_defconfig new file +9
-0+BR2_aarch64=y +BR2_ARM_FPU_VFPV3=y +BR2_TARGET_GENERIC_GETTY_PORT="ttymxc1" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/freescale/common/imx/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="freescale/imx8mm-evk" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=yYou missed to pass the specific kernel version like:
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.8.7"Quoted 14 lines
configs/imx8mmevk_defconfig new file +14
-0+BR2_PACKAGE_FREESCALE_IMX=y +BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=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_VERSION=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.3" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="imx8mm" +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="imx8mm_evk" +BR2_TARGET_UBOOT_NEEDS_DTC=y +BR2_TARGET_UBOOT_NEEDS_ATF_BL31=y +BR2_TARGET_UBOOT_FW_FILES="lpddr4*.bin"
Quoted 8 lines
configs/imx8mmevk_defconfig line 28
Quoted 5 lines
configs/imx8mmevk_defconfig new file +5
-0+# BR2_TARGET_UBOOT_FORMAT_BIN is not set +BR2_TARGET_UBOOT_FORMAT_ELF=y +BR2_TARGET_UBOOT_FORMAT_IMX_FIT=y +BR2_TARGET_UBOOT_SPL=y +BR2_TARGET_UBOOT_SPL_NAME="spl/u-boot-spl.bin spl/u-boot-spl"You missed to pass the specific U-Boot version like:
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2020.10"
Thanks for catching my mistake.
Patch series updated to v3
Xavier
PATCH 1/3 board/freescale/imx: Add helper to generate fw binary
In reply to Thomas PetazzoniOn Tue, Nov 03, 2020 at 11:39:34PM +0100, Thomas Petazzoni wrote:
Hello Thomas,
Quoted 43 lines
Hello Xavier,
Quoted 18 lines · On Tue, 28 Apr 2020 23:50:46 +0200 Xavier Roumegue <[email protected]> wrote:
Hello Thomas,
iMX8 Upstream uboot adds a custom target 'flash.bin', a bootable medium once written to 33k offset.1) On iMX8m[mqn], the (lp)ddr4 firmware, and hdmi fw for iMX8mq, have to be copied in the uboot build dir prior to execute the build.
Additional SoC firmwares (system and security controllers) have to be copied for iMX8X and iMX8QM.2) (lp)ddr4 firmware is appended to uboot spl thanks to
tools/imx8m_image.sh.
3) A config file per imx platform (*.cfg) is describing the imx mkimage parameters, ..i.e. loaders file paths and entry points, SoC firmwares, boot rom options, etc..
4) Final loader is uboot.itb, generated as dependency of flash.bin for iMX platforms, and using an its file generated byarch/arm/mach-imx/mkimage_fit_atf.sh. ATF, TEE images have as well to be copied to uboot build dir, and their entry points can be specified through environment variables.Quoted 8 lines
5) Generate 'flash.bin'
The proposed script is taking care of 2), 3) and 5), with intention to support all iMX8 platforms generating the mkimage config file on the fly and relying on buildroot recipes to copy the required firmwares in images directory.
Current proposal does not generate the uboot FIT image, but this would likely be an enhancement I would like to bring once 3) is achieved for all iMX8.
Thanks a lot for providing those additional details, and sorry for the long delay. After looking into this a bit, I really think we should leverage more what U-Boot upstream is doing, and not re-invent all this image creation logic.
So in fact, I do like better what
https://github.com/SolidRun/buildroot/commit/0f2b2971e836b508bf9c2dac34426a59a9d83572
is doing. The only gotcha is that it uses BINDIR to point toBINARIES_DIR, but BINDIR doesn't exist in upstream U-Boot, it seems to be some SolidRun-specific change that we can't rely on.
Quoted 8 lines
But since this patch is also adding a
BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE, we can definitely add some logic in uboot.mk to copy the i.MX firmware files within the U-Boot source directory prior to the build. Yes, it's more logic in uboot.mk, but I find that better than more logic in yet another custom shell script in board/.Do you think you could rework your patch in this direction ?
I reworked the patch series as per your suggestion.
I tried to be as much generic as possible on the uboot recipe patch.
Please, let me know your thoughts, in case this needs additional rework.. I would like to carry on with upstream configurations on imx8m[qnp] evk boards.
Thanks.
Xavier