diff mbox series

[3/3] boot/uboot: copy IMX firmware files to uboot package dir

Message ID 20210906094214.6142-4-heiko.thiery@gmail.com
State Superseded
Headers show
Series Add support to build imx8 images using mainline uboot | expand

Commit Message

Heiko Thiery Sept. 6, 2021, 9:42 a.m. UTC
If the U-Boot image is to be build with binman and one of the IMX
firmware files (ddr, hdmi) is used, the files are expected in the
toplevel directory.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
---
 boot/uboot/Config.in | 12 ++++++++++++
 boot/uboot/uboot.mk  | 27 +++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

Comments

Stephane Viau (OSS) Sept. 6, 2021, 12:45 p.m. UTC | #1
Hi Heiko, 

Thank you for the patch set.

>
>If the U-Boot image is to be build with binman and one of the IMX

s/build/built
s/IMX/i.MX

>firmware files (ddr, hdmi) is used, the files are expected in the
>toplevel directory.
>
>Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
>---
> boot/uboot/Config.in | 12 ++++++++++++
> boot/uboot/uboot.mk  | 27 +++++++++++++++++++++++++++
> 2 files changed, 39 insertions(+)
>
>diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
>index 0854fb13cc..da518db118 100644
>--- a/boot/uboot/Config.in
>+++ b/boot/uboot/Config.in
>@@ -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)

You could use "i.MX 8M." for consistency.

>+         encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot.

Are other firmware binaries also concerned (I did not check the U-Boot code) ;
such as VPU, SDMA, ... ?

BR, 
Stephane.

>+         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
>diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
>index 1a840d9cc1..cf8d6b1f39 100644
>--- a/boot/uboot/uboot.mk
>+++ b/boot/uboot/uboot.mk
>@@ -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
>--
>2.30.0
>
Fabio Estevam Sept. 6, 2021, 12:48 p.m. UTC | #2
Hi Stephane,

On Mon, Sep 6, 2021 at 9:45 AM Stephane Viau (OSS)
<stephane.viau@oss.nxp.com> wrote:

> >+         encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot.
>
> Are other firmware binaries also concerned (I did not check the U-Boot code) ;
> such as VPU, SDMA, ... ?

U-Boot does not need the VPU and SDMA firmwares, as they are only used
by the kernel.

Regards,

Fabio Estevam
Stephane Viau (OSS) Sept. 6, 2021, 12:57 p.m. UTC | #3
>Hi Stephane,

Hi Fabio, 

>
>On Mon, Sep 6, 2021 at 9:45 AM Stephane Viau (OSS)
><stephane.viau@oss.nxp.com> wrote:
>
>> >+         encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot.
>>
>> Are other firmware binaries also concerned (I did not check the U-Boot code) ;
>> such as VPU, SDMA, ... ?
>
>U-Boot does not need the VPU and SDMA firmwares, as they are only used
>by the kernel.

Indeed ; thanks!

BR,
Stephane.

>
>Regards,
>
>Fabio Estevam
>
Heiko Thiery Sept. 6, 2021, 1:20 p.m. UTC | #4
Hi Stephane,

Am Mo., 6. Sept. 2021 um 14:57 Uhr schrieb Stephane Viau (OSS)
<stephane.viau@oss.nxp.com>:
>
>
> >Hi Stephane,
>
> Hi Fabio,
>
> >
> >On Mon, Sep 6, 2021 at 9:45 AM Stephane Viau (OSS)
> ><stephane.viau@oss.nxp.com> wrote:
> >
> >> >+         encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot.
> >>
> >> Are other firmware binaries also concerned (I did not check the U-Boot code) ;
> >> such as VPU, SDMA, ... ?
> >
> >U-Boot does not need the VPU and SDMA firmwares, as they are only used
> >by the kernel.
>
> Indeed ; thanks!

As Fabio said, I think only the DDR and the HDMI firmware has to be
integrated into the uboot/spl and is used by binman to package the
e.g. "flash.bin". At least for the imx8mm and the imx8mq based board I
saw that.
diff mbox series

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 0854fb13cc..da518db118 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -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
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index 1a840d9cc1..cf8d6b1f39 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -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