]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
uboot-airoha: move FIP generation to target and enable autoselection
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 16 Jul 2026 18:38:44 +0000 (20:38 +0200)
committerRobert Marko <robimarko@gmail.com>
Sat, 8 Aug 2026 15:10:12 +0000 (17:10 +0200)
Move FIP handling to target now that we compile ATF. This is to have always
in sync new ATF and new U-Boot if one of the 2 is already compiled.

Also add HIDDEN ops to enable autoselection of the U-Boot for the required
target. This is needed to prevent user to deselect the U-Boot package
causing failure on ARTIFACTS generation.

Drop precompiled BL2 and BL31 as they can be now compiled from source.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24257
Signed-off-by: Robert Marko <robimarko@gmail.com>
package/boot/uboot-airoha/Makefile
package/boot/uboot-airoha/files/an7581-bl2.bin [deleted file]
package/boot/uboot-airoha/files/an7581-bl31.bin [deleted file]
package/boot/uboot-airoha/files/an7583-bl2.bin [deleted file]
package/boot/uboot-airoha/files/an7583-bl31.bin [deleted file]
target/linux/airoha/image/an7581.mk
target/linux/airoha/image/an7583.mk

index b3577e1eaa5c7a96e8c6810386c64fca1bdd28ea..98419e3c6677530a1a35b42359ae81050d62dd22 100644 (file)
@@ -14,6 +14,7 @@ include $(INCLUDE_DIR)/host-build.mk
 define U-Boot/Default
   BUILD_TARGET:=airoha
   LZMA_COMPRESS:=1
+  HIDDEN:=1
 endef
 
 define U-Boot/an7581_gemtek_w1700k
@@ -21,7 +22,6 @@ define U-Boot/an7581_gemtek_w1700k
   UBOOT_CONFIG:=an7581_w1700k
   BUILD_DEVICES:=gemtek_w1700k-ubi
   BUILD_SUBTARGET:=an7581
-  UBOOT_IMAGE:=u-boot.bin
 endef
 
 define U-Boot/an7581_nokia_valyrian
@@ -29,7 +29,6 @@ define U-Boot/an7581_nokia_valyrian
   UBOOT_CONFIG:=an7581_nokia_valyrian
   BUILD_DEVICES:=nokia_valyrian
   BUILD_SUBTARGET:=an7581
-  UBOOT_IMAGE:=u-boot.fip
   BL2_IMAGE:=an7581-bl2.bin
   BL31_IMAGE:=an7581-bl31.bin
 endef
@@ -39,7 +38,6 @@ define U-Boot/an7581_nokia_xg-040g-md
   UBOOT_CONFIG:=an7581_nokia_xg-040g-md
   BUILD_DEVICES:=nokia_xg-040g-md-ubi
   BUILD_SUBTARGET:=an7581
-  UBOOT_IMAGE:=u-boot.fip
   BL2_IMAGE:=an7581-bl2.bin
   BL31_IMAGE:=an7581-bl31.bin
 endef
@@ -47,21 +45,21 @@ endef
 define U-Boot/an7581_rfb
   NAME:=AN7581 Reference Board
   UBOOT_CONFIG:=an7581_evb
-  BUILD_DEVICES:=airoha_an7581-evb
+  BUILD_DEVICES:=airoha_an7581-evb airoha_an7581-evb-emmc-eagle airoha_an7581-evb-emmc-kite
   BUILD_SUBTARGET:=an7581
-  UBOOT_IMAGE:=u-boot.fip
   BL2_IMAGE:=an7581-bl2.bin
   BL31_IMAGE:=an7581-bl31.bin
+  DEPENDS:=+trusted-firmware-a-an7581-bl31
 endef
 
 define U-Boot/an7583_rfb
   NAME:=AN7583 Reference Board
   UBOOT_CONFIG:=an7583_evb
-  BUILD_DEVICES:=airoha_an7583-evb
+  BUILD_DEVICES:=airoha_an7583-evb airoha_an7583-evb-emmc
   BUILD_SUBTARGET:=an7583
-  UBOOT_IMAGE:=u-boot.fip
   BL2_IMAGE:=an7583-bl2.bin
   BL31_IMAGE:=an7583-bl31.bin
+  DEPENDS:=+trusted-firmware-a-an7583-bl31
 endef
 
 define U-Boot/en7523_rfb
@@ -69,7 +67,6 @@ define U-Boot/en7523_rfb
   UBOOT_CONFIG:=en7523_evb
   BUILD_DEVICES:=airoha_en7523-evb
   BUILD_SUBTARGET:=en7523
-  UBOOT_IMAGE:=u-boot.fip
   BL2_IMAGE:=en7523-bl2.bin
   BL31_IMAGE:=en7523-bl31.bin
 endef
@@ -89,22 +86,6 @@ UBOOT_CUSTOMIZE_CONFIG := \
        --enable SERIAL_RX_BUFFER \
        --set-val SERIAL_RX_BUFFER_SIZE 256
 
-define Build/fip-image-bl2
-       $(STAGING_DIR_HOST)/bin/fiptool create \
-               --tb-fw files/$(BL2_IMAGE) \
-               $(PKG_BUILD_DIR)/bl2.fip
-endef
-
-define Build/fip-image
-       $(if $(LZMA_COMPRESS), $(STAGING_DIR_HOST)/bin/lzma e \
-               files/$(BL31_IMAGE) \
-               $(PKG_BUILD_DIR)/bl31.bin.lzma)
-       $(STAGING_DIR_HOST)/bin/fiptool create \
-               --soc-fw $(PKG_BUILD_DIR)/bl31.bin$(if $(LZMA_COMPRESS),.lzma) \
-               --nt-fw $(PKG_BUILD_DIR)/u-boot.bin$(if $(LZMA_COMPRESS),.lzma) \
-               $(PKG_BUILD_DIR)/u-boot.fip
-endef
-
 define Build/Configure
        $(call Build/Configure/U-Boot)
        sed -i 's/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/' $(PKG_BUILD_DIR)/.config
@@ -114,11 +95,7 @@ define Build/Compile
        $(call Build/Compile/U-Boot)
        $(if $(LZMA_COMPRESS), $(STAGING_DIR_HOST)/bin/lzma e \
                $(PKG_BUILD_DIR)/u-boot.bin \
-               $(PKG_BUILD_DIR)/u-boot.bin.lzma)
-ifeq ($(UBOOT_IMAGE),u-boot.fip)
-       $(call Build/fip-image-bl2)
-       $(call Build/fip-image)
-endif
+               $(PKG_BUILD_DIR)/u-boot.lzma)
 endef
 
 # don't stage files to bindir, let target/linux/airoha/image/*.mk do that
@@ -127,15 +104,10 @@ endef
 
 define Build/InstallDev
        $(INSTALL_DIR) $(STAGING_DIR_IMAGE)
-ifeq ($(UBOOT_IMAGE),u-boot.fip)
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/bl2.fip $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl2.fip
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/u-boot.fip $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-bl31-u-boot.fip
-else
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/u-boot.bin$(if $(LZMA_COMPRESS),.lzma) \
-               $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot.bin$(if $(LZMA_COMPRESS),.lzma)
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/u-boot.$(if $(LZMA_COMPRESS),lzma,bin) \
+               $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot.$(if $(LZMA_COMPRESS),lzma,bin)
        $(INSTALL_DATA) $(PKG_BUILD_DIR)/u-boot.dtb \
                $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-u-boot.dtb
-endif
 endef
 
 $(eval $(call BuildPackage/U-Boot))
diff --git a/package/boot/uboot-airoha/files/an7581-bl2.bin b/package/boot/uboot-airoha/files/an7581-bl2.bin
deleted file mode 100644 (file)
index a500445..0000000
Binary files a/package/boot/uboot-airoha/files/an7581-bl2.bin and /dev/null differ
diff --git a/package/boot/uboot-airoha/files/an7581-bl31.bin b/package/boot/uboot-airoha/files/an7581-bl31.bin
deleted file mode 100644 (file)
index f57a377..0000000
Binary files a/package/boot/uboot-airoha/files/an7581-bl31.bin and /dev/null differ
diff --git a/package/boot/uboot-airoha/files/an7583-bl2.bin b/package/boot/uboot-airoha/files/an7583-bl2.bin
deleted file mode 100644 (file)
index b7c3604..0000000
Binary files a/package/boot/uboot-airoha/files/an7583-bl2.bin and /dev/null differ
diff --git a/package/boot/uboot-airoha/files/an7583-bl31.bin b/package/boot/uboot-airoha/files/an7583-bl31.bin
deleted file mode 100644 (file)
index 016a238..0000000
Binary files a/package/boot/uboot-airoha/files/an7583-bl31.bin and /dev/null differ
index ba38318edd1128c9f315d70dc7a78312484cc7c2..c33949a67aacd6a07ca6305aafd75f3f495019be 100644 (file)
@@ -5,10 +5,17 @@ define Build/an7581-emmc-bl2-bl31-uboot
 endef
 
 define Build/an7581-preloader
+  $(STAGING_DIR_HOST)/bin/fiptool create \
+               --tb-fw $(STAGING_DIR_IMAGE)/an7581-bl2.bin \
+               $(STAGING_DIR_IMAGE)/an7581_$1-bl2.fip
   cat $(STAGING_DIR_IMAGE)/an7581_$1-bl2.fip >> $@
 endef
 
 define Build/an7581-bl31-uboot
+  $(STAGING_DIR_HOST)/bin/fiptool create \
+               --soc-fw $(STAGING_DIR_IMAGE)/an7581-bl31.lzma \
+               --nt-fw $(STAGING_DIR_IMAGE)/an7581_$1-u-boot.lzma \
+               $(STAGING_DIR_IMAGE)/an7581_$1-bl31-u-boot.fip
   cat $(STAGING_DIR_IMAGE)/an7581_$1-bl31-u-boot.fip >> $@
 endef
 
@@ -65,8 +72,8 @@ define Device/airoha_an7581-evb-emmc-eagle
   DEVICE_DTS := an7581-evb-emmc-eagle
   DEVICE_PACKAGES := airoha-en7581-mt7996-npu-firmware \
                    kmod-mt7996-firmware wpad-basic-mbedtls
-  ARTIFACT/preloader.bin := an7581-preloader rfb
-  ARTIFACT/bl31-uboot.fip := an7581-bl31-uboot rfb
+  ARTIFACT/preloader.bin := an7581-preloader rfb-emmc-eagle
+  ARTIFACT/bl31-uboot.fip := an7581-bl31-uboot rfb-emmc-eagle
   ARTIFACTS := preloader.bin bl31-uboot.fip
 endef
 TARGET_DEVICES += airoha_an7581-evb-emmc-eagle
@@ -77,8 +84,8 @@ define Device/airoha_an7581-evb-emmc-kite
   DEVICE_DTS := an7581-evb-emmc-kite
   DEVICE_PACKAGES := airoha-en7581-npu-firmware \
                    kmod-mt7992-firmware wpad-basic-mbedtls
-  ARTIFACT/preloader.bin := an7581-preloader rfb
-  ARTIFACT/bl31-uboot.fip := an7581-bl31-uboot rfb
+  ARTIFACT/preloader.bin := an7581-preloader rfb-emmc-kite
+  ARTIFACT/bl31-uboot.fip := an7581-bl31-uboot rfb-emmc-kite
   ARTIFACTS := preloader.bin bl31-uboot.fip
 endef
 TARGET_DEVICES += airoha_an7581-evb-emmc-kite
index e8533269d5e83f95ab151a7e0a6ec760b97a1669..fe9dc092b3112f358dd02c79c5ca07b74897df17 100644 (file)
@@ -1,8 +1,15 @@
 define Build/an7583-preloader
+  $(STAGING_DIR_HOST)/bin/fiptool create \
+               --tb-fw $(STAGING_DIR_IMAGE)/an7583-bl2.bin \
+               $(STAGING_DIR_IMAGE)/an7583_$1-bl2.fip
   cat $(STAGING_DIR_IMAGE)/an7583_$1-bl2.fip >> $@
 endef
 
 define Build/an7583-bl31-uboot
+  $(STAGING_DIR_HOST)/bin/fiptool create \
+               --soc-fw $(STAGING_DIR_IMAGE)/an7583-bl31.lzma \
+               --nt-fw $(STAGING_DIR_IMAGE)/an7583_$1-u-boot.lzma \
+               $(STAGING_DIR_IMAGE)/an7583_$1-bl31-u-boot.fip
   cat $(STAGING_DIR_IMAGE)/an7583_$1-bl31-u-boot.fip >> $@
 endef