Add support to build imx8 images using mainline uboot
v2 cover Add support to build imx8 images using mainline uboot
New U-Boot version support building the flash.bin bootimage using binman. For that the imx specific firmware files like (LP)DDR and HDMI firmware has to be located in the u-boot builddirectory.
Xavier Roumegue already posted a patchset [1] to add this support but did no follow up version after getting review comments.
I have taken up these comments and prepared the patchset.
[1] https://lists.buildroot.org/pipermail/buildroot/2020-November/599906.html
Heiko Thiery (3):
package/freescale-imx/firmware-imx: copy all (lp)ddr files
unconditionaly
boot/uboot: copy ATF bl31 binary to uboot package dir boot/uboot: copy IMX firmware files to uboot package dir
boot/uboot/Config.in | 12 +++++++ boot/uboot/uboot.mk | 35 +++++++++++++++++++ .../firmware-imx/firmware-imx.mk | 10 ++++++ 3 files changed, 57 insertions(+)
Signature · 6 lines
2.30.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 1/3 package/freescale-imx/firmware-imx: copy all (lp)ddr files unconditionaly
In mainline u-boot more and more imx8 boards are switched to binman to create the imx specific image (flash.bin). To support this the (lp)ddr firmware training files are needed. For this to work all files should be made available to the U-Boot build.
---
v2:
- add reviewed-by (thanks Gary)
package/freescale-imx/firmware-imx/firmware-imx.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)
package/freescale-imx/firmware-imx/firmware-imx.mk +10 -0
@@ -51,6 +51,11 @@ 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 + + # U-Boot supports creation of the combined flash.bin image. To make + # sure that U-Boot can access all available files copy them to + # the binary dir. + cp $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4*.bin $(BINARIES_DIR)/ endef endif
@@ -69,6 +74,11 @@ 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 + + # U-Boot supports creation of the combined flash.bin image. To make + # sure that U-Boot can access all available files copy them to + # the binary dir. + cp $(FIRMWARE_IMX_DDRFW_DIR)/ddr4*.bin $(BINARIES_DIR)/ endef endif
Signature · 6 lines
2.30.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 1/3] package/freescale-imx/firmware-imx: copy all (lp)ddr files unconditionaly
Hi Heiko,
Quoted 8 lines · Heiko Thiery
In mainline u-boot more and more imx8 boards are switched to binman to create the imx specific image (flash.bin). To support this the (lp)ddr firmware training files are needed. For this to work all files should be made available to the U-Boot build.
Signed-off-by Heiko Thiery <[email protected]>Reviewed-by Gary Bisson <[email protected]>
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Arnout Vandecappelle
AppliedRe: [Buildroot] [PATCH v2 1/3] package/freescale-imx/firmware-imx: copy all (lp)ddr files unconditionaly
In reply to Heiko ThieryQuoted 7 lines · Heiko Thiery
In mainline u-boot more and more imx8 boards are switched to binman to create the imx specific image (flash.bin). To support this the (lp)ddr firmware training files are needed. For this to work all files should be made available to the U-Boot build.
Signed-off-by Heiko Thiery <[email protected]>Reviewed-by Gary Bisson <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 27 lines
---
v2:
- add reviewed-by (thanks Gary)package/freescale-imx/firmware-imx/firmware-imx.mk | 10 ++++++++++ 1 file changed, 10 insertions(+)package/freescale-imx/firmware-imx/firmware-imx.mk +5
-0@@ -51,6 +51,11 @@ 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 + + # U-Boot supports creation of the combined flash.bin image. To make + # sure that U-Boot can access all available files copy them to + # the binary dir. + cp $(FIRMWARE_IMX_DDRFW_DIR)/lpddr4*.bin $(BINARIES_DIR)/ endef endif@@ -69,6 +74,11 @@ define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW $(FIRMWARE_IMX_DDRFW_DIR)/ddr4_2d_201810_fw.bin > \
package/freescale-imx/firmware-imx/firmware-imx.mk define FIRMWARE_IMX_INSTALL_IMAGE_DDR_FW · line 84
Quoted 10 lines
package/freescale-imx/firmware-imx/firmware-imx.mk +5
-0$(BINARIES_DIR)/ddr4_201810_fw.bin ln -sf $(BINARIES_DIR)/ddr4_201810_fw.bin $(BINARIES_DIR)/ddr_fw.bin + + # U-Boot supports creation of the combined flash.bin image. To make + # sure that U-Boot can access all available files copy them to + # the binary dir. + cp $(FIRMWARE_IMX_DDRFW_DIR)/ddr4*.bin $(BINARIES_DIR)/ endef endif
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 2/3 boot/uboot: copy ATF bl31 binary to uboot package dir
In reply to Heiko ThieryIf the U-Boot image is to be built with binman and the ATF binary is used, the file is expected in the toplevel directory.
--- boot/uboot/uboot.mk | 8 ++++++++ 1 file changed, 8 insertions(+)
boot/uboot/uboot.mk +8 -0
@@ -162,8 +162,16 @@ ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y) UBOOT_DEPENDENCIES += arm-trusted-firmware ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y) UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf +define UBOOT_COPY_ATF_FIRMWARE + cp $(BINARIES_DIR)/bl31.elf $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE else UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin +define UBOOT_COPY_ATF_FIRMWARE + cp $(BINARIES_DIR)/bl31.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE endif endif
Signature · 6 lines
2.30.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 2/3] boot/uboot: copy ATF bl31 binary to uboot package dir
Quoted 5 lines · Heiko Thiery
If the U-Boot image is to be built with binman and the ATF binary is used, the file is expected in the toplevel directory.
Signed-off-by Heiko Thiery <[email protected]>
This applies even if the image is built without binman:
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 2/3] boot/uboot: copy ATF bl31 binary to uboot package dir
Hi Fabio,
Am Fr., 10. Sept. 2021 um 16:27 Uhr schrieb Fabio Estevam <[email protected]>:
Quoted 9 lines · Heiko Thiery
Quoted 5 lines
If the U-Boot image is to be built with binman and the ATF binary is used, the file is expected in the toplevel directory.
Signed-off-by Heiko Thiery <[email protected]>This applies even if the image is built without binman:
I don't think that's quite right. With the old mainline uboot you could also build the flash.bin, but that was optional. The make rule 'flash.bin' was not part of 'make all'. But with the change to binman the files are now necessary, because 'make all' now also builds the flash.bin.
Quoted 1 line
Reviewed-by Fabio Estevam <[email protected]>
Signature · 5 lines
Heiko _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Fabio Estevam
reviewerRe: [Buildroot] [PATCH v2 2/3] boot/uboot: copy ATF bl31 binary to uboot package dir
Hi Heiko,
Quoted 5 lines · Heiko Thiery
I don't think that's quite right. With the old mainline uboot you could also build the flash.bin, but that was optional. The make rule 'flash.bin' was not part of 'make all'. But with the change to binman the files are now necessary, because 'make all' now also builds the flash.bin.
The need for bl31.bin present in the build directory was required even prior to the binman conversion.
For example, let's take the U-Boot 2021.01 readme for imx8mm evk:
https://source.denx.de/u-boot/u-boot/-/blob/v2021.01/doc/board/freescale/imx8mm_evk.rst
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 2/3] boot/uboot: copy ATF bl31 binary to uboot package dir
Hi Fabio,
Am Fr., 10. Sept. 2021 um 18:08 Uhr schrieb Fabio Estevam <[email protected]>:
Quoted 11 lines
Hi Heiko,
Quoted 5 lines · Heiko Thiery
I don't think that's quite right. With the old mainline uboot you could also build the flash.bin, but that was optional. The make rule 'flash.bin' was not part of 'make all'. But with the change to binman the files are now necessary, because 'make all' now also builds the flash.bin.
Quoted 5 lines
The need for bl31.bin present in the build directory was required even prior to the binman conversion.
For example, let's take the U-Boot 2021.01 readme for imx8mm evk:
https://source.denx.de/u-boot/u-boot/-/blob/v2021.01/doc/board/freescale/imx8mm_evk.rst
ah ok .. I was not aware of that. I just thought this requirement comes from building via binman.
Thank you
Signature · 5 lines
Heiko _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Arnout Vandecappelle
AppliedRe: [Buildroot] [PATCH v2 2/3] boot/uboot: copy ATF bl31 binary to uboot package dir
In reply to Heiko ThieryQuoted 4 lines · Heiko Thiery
If the U-Boot image is to be built with binman and the ATF binary is used, the file is expected in the toplevel directory.
Signed-off-by Heiko Thiery <[email protected]>
Applied to master, thanks. I've updated the commit message to reflect that it's
not related to binman.
Regards,
Arnout
Quoted 16 lines
--- boot/uboot/uboot.mk | 8 ++++++++ 1 file changed, 8 insertions(+)boot/uboot/uboot.mk +3
-0@@ -162,8 +162,16 @@ ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y) UBOOT_DEPENDENCIES += arm-trusted-firmware ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31_ELF),y) UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.elf +define UBOOT_COPY_ATF_FIRMWARE + cp $(BINARIES_DIR)/bl31.elf $(@D)/ +endef
boot/uboot/uboot.mk ifeq ($(BR2_TARGET_UBOOT_NEEDS_ATF_BL31),y) · line 177
Quoted 10 lines
boot/uboot/uboot.mk +5
-0+UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE else UBOOT_MAKE_OPTS += BL31=$(BINARIES_DIR)/bl31.bin +define UBOOT_COPY_ATF_FIRMWARE + cp $(BINARIES_DIR)/bl31.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_ATF_FIRMWARE endif endif
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v2 3/3 boot/uboot: copy IMX firmware files to uboot package dir
In reply to Heiko ThieryIf the U-Boot image is to be built with binman and one of the i.MX firmware files (ddr, hdmi) is used, the files are expected in the toplevel directory.
---
v2:
- small changes in commit messages (thanks Stephane)
- use "i.MX 8M" for consistency (thanks Stephane)
boot/uboot/Config.in | 12 ++++++++++++ boot/uboot/uboot.mk | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+)
boot/uboot/Config.in +12 -0
@@ -239,6 +239,18 @@ config BR2_TARGET_UBOOT_NEEDS_OPENSBI and that the OpenSBI variable pointing to OpenSBI binary, is passed during the Buildroot build. +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 || \ + BR2_PACKAGE_FIRMWARE_IMX_NEEDS_HDMI_FW + help + Some IMX platforms (such as iMX8m, iMX8mq, iIMX8mm, iIMX8mn) + encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot. + This option makes sure the imx firmware gets built prior to + U-Boot and copies the files from the buildroot binary dir + into the U-Boot source dir. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AIS
boot/uboot/uboot.mk +27 -0
@@ -180,6 +180,33 @@ UBOOT_DEPENDENCIES += opensbi UBOOT_MAKE_OPTS += OPENSBI=$(BINARIES_DIR)/fw_dynamic.bin endif +# New U-Boot versions can create the IMX specific boot images +# and needs the some NXP firmware blobs. +ifeq ($(BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE),y) +UBOOT_DEPENDENCIES += firmware-imx + +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_NEEDS_HDMI_FW),y) +define UBOOT_COPY_IMX_DDR_FIRMWARE + cp $(BINARIES_DIR)/signed_hdmi_imx8m.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_DDR_FIRMWARE +endif + +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y) +define UBOOT_COPY_IMX_LPDDR4_FIRMWARE + cp $(BINARIES_DIR)/lpddr4*.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_LPDDR4_FIRMWARE +endif + +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR4),y) +define UBOOT_COPY_IMX_DDR4_FIRMWARE + cp $(BINARIES_DIR)/ddr4*.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_DDR4_FIRMWARE +endif +endif + ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y) UBOOT_DEPENDENCIES += host-dtc endif
Signature · 6 lines
2.30.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 3/3] boot/uboot: copy IMX firmware files to uboot package dir
Quoted 4 lines · Heiko Thiery
If the U-Boot image is to be built with binman and one of the i.MX firmware files (ddr, hdmi) is used, the files are expected in the toplevel directory.
I would remove binman from the description as this is not binman related.
boot/uboot/Config.in config BR2_TARGET_UBOOT_NEEDS_OPENSBI · line 250
Quoted 12 lines
Signed-off-by Heiko Thiery <[email protected]>boot/uboot/Config.in +9
-0+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 || \ + BR2_PACKAGE_FIRMWARE_IMX_NEEDS_HDMI_FW + help + Some IMX platforms (such as iMX8m, iMX8mq, iIMX8mm, iIMX8mn) + encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot. + This option makes sure the imx firmware gets built prior to
The imx firmwares are binaries, so they are not built. Please adjust it to:
"This option makes sure that the imx firmwares are copied into the U-Boot source directory".
Quoted 11 lines
boot/uboot/Config.in +3
-0+ U-Boot and copies the files from the buildroot binary dir + into the U-Boot source dir. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AISboot/uboot/uboot.mk +0
-0
boot/uboot/uboot.mk UBOOT_DEPENDENCIES += opensbi · line 183
Quoted 4 lines
boot/uboot/uboot.mk +1
-0@@ -180,6 +180,33 @@ UBOOT_DEPENDENCIES += opensbi UBOOT_MAKE_OPTS += OPENSBI=$(BINARIES_DIR)/fw_dynamic.bin endif +# New U-Boot versions can create the IMX specific boot images
s/New/Mainline
boot/uboot/uboot.mk UBOOT_DEPENDENCIES += opensbi · line 184
Quoted 1 line
boot/uboot/uboot.mk +1
-0+# and needs the some NXP firmware blobs.
s/needs the some/need some
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH v2 3/3] boot/uboot: copy IMX firmware files to uboot package dir
In reply to Heiko ThieryQuoted 5 lines · Heiko Thiery
If the U-Boot image is to be built with binman and one of the i.MX firmware files (ddr, hdmi) is used, the files are expected in the toplevel directory.
Signed-off-by Heiko Thiery <[email protected]>
I was too lazy to update with all of Fabio's comments :-) so I marked as
Changes Requested.
Regards,
Arnout
Quoted 62 lines
---
v2:
- small changes in commit messages (thanks Stephane)
- use "i.MX 8M" for consistency (thanks Stephane)boot/uboot/Config.in | 12 ++++++++++++ boot/uboot/uboot.mk | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+)boot/uboot/Config.in +12
-0@@ -239,6 +239,18 @@ config BR2_TARGET_UBOOT_NEEDS_OPENSBI and that the OpenSBI variable pointing to OpenSBI binary, is passed during the Buildroot build. +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 || \ + BR2_PACKAGE_FIRMWARE_IMX_NEEDS_HDMI_FW + help + Some IMX platforms (such as iMX8m, iMX8mq, iIMX8mm, iIMX8mn) + encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot. + This option makes sure the imx firmware gets built prior to + U-Boot and copies the files from the buildroot binary dir + into the U-Boot source dir. + menu "U-Boot binary format" config BR2_TARGET_UBOOT_FORMAT_AISboot/uboot/uboot.mk +20
-0@@ -180,6 +180,33 @@ UBOOT_DEPENDENCIES += opensbi UBOOT_MAKE_OPTS += OPENSBI=$(BINARIES_DIR)/fw_dynamic.bin endif +# New U-Boot versions can create the IMX specific boot images +# and needs the some NXP firmware blobs. +ifeq ($(BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE),y) +UBOOT_DEPENDENCIES += firmware-imx + +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_NEEDS_HDMI_FW),y) +define UBOOT_COPY_IMX_DDR_FIRMWARE + cp $(BINARIES_DIR)/signed_hdmi_imx8m.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_DDR_FIRMWARE +endif + +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),y) +define UBOOT_COPY_IMX_LPDDR4_FIRMWARE + cp $(BINARIES_DIR)/lpddr4*.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_LPDDR4_FIRMWARE +endif + +ifeq ($(BR2_PACKAGE_FIRMWARE_IMX_DDR4),y)
boot/uboot/uboot.mk UBOOT_DEPENDENCIES += opensbi · line 212
Quoted 10 lines
boot/uboot/uboot.mk +7
-0+define UBOOT_COPY_IMX_DDR4_FIRMWARE + cp $(BINARIES_DIR)/ddr4*.bin $(@D)/ +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_DDR4_FIRMWARE +endif +endif + ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y) UBOOT_DEPENDENCIES += host-dtc endif
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot