Jelajahi Sumber

boot/uboot: copy IMX firmware files to uboot package dir

The mainline U-Boot can create an i.MX specific firmware image (e.g. flash.bin).
For this the i.MX firmware files (DDR, HDMI) must be in the toplevel directory.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
[yann.morin.1998@free.fr: simplify hook]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Heiko Thiery 3 tahun lalu
induk
melakukan
af99e7a5f3
2 mengubah file dengan 28 tambahan dan 0 penghapusan
  1. 11 0
      boot/uboot/Config.in
  2. 17 0
      boot/uboot/uboot.mk

+ 11 - 0
boot/uboot/Config.in

@@ -239,6 +239,17 @@ config BR2_TARGET_UBOOT_NEEDS_OPENSBI
 	  and that the OpenSBI variable pointing to OpenSBI binary,
 	  and that the OpenSBI variable pointing to OpenSBI binary,
 	  is passed during the Buildroot build.
 	  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 i.MX8 platforms (such as i.MX8 M, i.MX 8M Mini, i.MX 8M Nano)
+	  encapsulate NXP specific firmware (DDR, HDMI) inside U-Boot.
+	  This option makes sure that the i.MX firmwares are copied into
+	  the U-Boot source directory.
+
 menu "U-Boot binary format"
 menu "U-Boot binary format"
 
 
 config BR2_TARGET_UBOOT_FORMAT_AIS
 config BR2_TARGET_UBOOT_FORMAT_AIS

+ 17 - 0
boot/uboot/uboot.mk

@@ -180,6 +180,23 @@ UBOOT_DEPENDENCIES += opensbi
 UBOOT_MAKE_OPTS += OPENSBI=$(BINARIES_DIR)/fw_dynamic.bin
 UBOOT_MAKE_OPTS += OPENSBI=$(BINARIES_DIR)/fw_dynamic.bin
 endif
 endif
 
 
+# Mainline U-Boot versions can create the i.MX specific boot images
+# and need some NXP firmware blobs.
+ifeq ($(BR2_TARGET_UBOOT_NEEDS_IMX_FIRMWARE),y)
+UBOOT_DEPENDENCIES += firmware-imx
+UBOOT_IMX_FW_FILES = \
+	$(if $(BR2_PACKAGE_FIRMWARE_IMX_NEEDS_HDMI_FW),signed_hdmi_imx8m.bin) \
+	$(if $(BR2_PACKAGE_FIRMWARE_IMX_LPDDR4),lpddr4*.bin) \
+	$(if $(BR2_PACKAGE_FIRMWARE_IMX_DDR4),ddr4*.bin)
+
+define UBOOT_COPY_IMX_FW_FILES
+	$(foreach fw,$(UBOOT_IMX_FW_FILES),\
+		cp $(BINARIES_DIR)/$(fw) $(@D)/
+	)
+endef
+UBOOT_PRE_BUILD_HOOKS += UBOOT_COPY_IMX_DDR_FIRMWARE
+endif
+
 ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y)
 ifeq ($(BR2_TARGET_UBOOT_NEEDS_DTC),y)
 UBOOT_DEPENDENCIES += host-dtc
 UBOOT_DEPENDENCIES += host-dtc
 endif
 endif