2020-05-04 14:31:19 +00:00
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
|
|
|
2022-07-11 10:02:49 +00:00
|
|
|
PKG_VERSION:=2022.07
|
|
|
|
PKG_HASH:=92b08eb49c24da14c1adbf70a71ae8f37cc53eeb4230e859ad8b6733d13dcf5e
|
2021-01-30 13:58:16 +00:00
|
|
|
PKG_BUILD_DEPENDS:=arm-trusted-firmware-tools/host
|
2020-05-04 14:31:19 +00:00
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/u-boot.mk
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
include $(INCLUDE_DIR)/host-build.mk
|
|
|
|
|
2022-08-09 23:23:34 +00:00
|
|
|
MT7621_LOWLEVEL_PRELOADER_URL:=https://raw.githubusercontent.com/mtk-openwrt/mt7621-lowlevel-preloader/a03b07c60bf1ba4add9b671d32caa102fe948180/
|
2022-07-11 20:15:32 +00:00
|
|
|
|
|
|
|
define Download/mt7621-stage-sram
|
|
|
|
FILE:=mt7621_stage_sram.bin
|
|
|
|
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
|
|
|
|
HASH:=1dda68aa089f0ff262e01539b990dea478952e9fb68bcc0a8cd6f76f0135c62e
|
|
|
|
endef
|
|
|
|
|
2022-08-09 23:23:34 +00:00
|
|
|
define Download/mt7621-stage-sram-noprint
|
|
|
|
FILE:=mt7621_stage_sram_noprint.bin
|
|
|
|
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
|
|
|
|
HASH:=8ee419275144fc298e9444d413d98e965a55d283152a74ea6a1f8de79eb516b6
|
|
|
|
endef
|
|
|
|
|
2022-07-11 20:15:32 +00:00
|
|
|
ifdef CONFIG_TARGET_ramips_mt7621
|
2022-08-09 23:23:34 +00:00
|
|
|
ifdef CONFIG_DEBUG
|
2022-07-11 20:15:32 +00:00
|
|
|
$(eval $(call Download,mt7621-stage-sram))
|
2022-08-09 23:23:34 +00:00
|
|
|
else
|
|
|
|
$(eval $(call Download,mt7621-stage-sram-noprint))
|
|
|
|
endif
|
2022-07-11 20:15:32 +00:00
|
|
|
endif
|
|
|
|
|
2020-05-04 14:31:19 +00:00
|
|
|
define U-Boot/Default
|
|
|
|
BUILD_TARGET:=mediatek
|
|
|
|
UBOOT_IMAGE:=u-boot-mtk.bin
|
|
|
|
endef
|
|
|
|
|
2022-07-11 20:15:32 +00:00
|
|
|
define U-Boot/mt7620_rfb
|
|
|
|
NAME:=MT7620 Reference Board
|
|
|
|
UBOOT_CONFIG:=mt7620_rfb
|
|
|
|
BUILD_DEVICES:=ralink_mt7620a-evb
|
|
|
|
BUILD_TARGET:=ramips
|
|
|
|
BUILD_SUBTARGET:=mt7620
|
|
|
|
UBOOT_IMAGE:=u-boot-with-spl.bin
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7620_mt7530_rfb
|
|
|
|
NAME:=MT7620+MT7530 Reference Board
|
|
|
|
UBOOT_CONFIG:=mt7620_mt7530_rfb
|
|
|
|
BUILD_DEVICES:=ralink_mt7620a-mt7530-evb
|
|
|
|
BUILD_TARGET:=ramips
|
|
|
|
BUILD_SUBTARGET:=mt7620
|
|
|
|
UBOOT_IMAGE:=u-boot-with-spl.bin
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7621_rfb
|
|
|
|
NAME:=MT7621 Reference Board
|
|
|
|
UBOOT_CONFIG:=mt7621_rfb
|
|
|
|
BUILD_DEVICES:=mediatek_mt7621-eval-board
|
|
|
|
BUILD_TARGET:=ramips
|
|
|
|
BUILD_SUBTARGET:=mt7621
|
|
|
|
UBOOT_IMAGE:=u-boot-mt7621.bin
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7621_nand_rfb
|
|
|
|
NAME:=MT7621 Reference Board (NAND)
|
|
|
|
UBOOT_CONFIG:=mt7621_nand_rfb
|
|
|
|
BUILD_DEVICES:=mediatek_mt7621-eval-board
|
|
|
|
BUILD_TARGET:=ramips
|
|
|
|
BUILD_SUBTARGET:=mt7621
|
|
|
|
UBOOT_IMAGE:=u-boot-mt7621.bin
|
|
|
|
endef
|
|
|
|
|
2021-02-27 15:14:02 +00:00
|
|
|
define U-Boot/mt7622_rfb1
|
|
|
|
NAME:=MT7622 Reference Board 1
|
2020-05-04 14:31:19 +00:00
|
|
|
UBOOT_CONFIG:=mt7622_rfb
|
2021-03-14 19:07:00 +00:00
|
|
|
BUILD_DEVICES:=mediatek_mt7622-rfb1 mediatek_mt7622-rfb1-ubi
|
|
|
|
BUILD_SUBTARGET:=mt7622
|
2020-05-04 14:31:19 +00:00
|
|
|
endef
|
|
|
|
|
2021-01-30 13:58:16 +00:00
|
|
|
define U-Boot/mt7622_linksys_e8450
|
|
|
|
NAME:=Linksys E8450
|
|
|
|
UBOOT_CONFIG:=mt7622_linksys_e8450
|
2021-03-14 19:07:00 +00:00
|
|
|
BUILD_DEVICES:=linksys_e8450-ubi
|
|
|
|
BUILD_SUBTARGET:=mt7622
|
2021-01-30 13:58:16 +00:00
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=snand
|
|
|
|
BL2_DDRBLOB:=1
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7622-snand-1ddr
|
|
|
|
endef
|
|
|
|
|
2021-02-27 15:14:02 +00:00
|
|
|
define U-Boot/mt7622_bananapi_bpi-r64-emmc
|
|
|
|
NAME:=BananaPi R64 (eMMC)
|
|
|
|
UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-emmc
|
2021-03-14 19:07:00 +00:00
|
|
|
BUILD_DEVICES:=bananapi_bpi-r64
|
|
|
|
BUILD_SUBTARGET:=mt7622
|
2021-02-27 15:14:02 +00:00
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=emmc
|
|
|
|
BL2_DDRBLOB:=2
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7622-emmc-2ddr
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7622_bananapi_bpi-r64-sdmmc
|
|
|
|
NAME:=BananaPi R64 (SDMMC)
|
|
|
|
UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-sdmmc
|
2021-03-14 19:07:00 +00:00
|
|
|
BUILD_DEVICES:=bananapi_bpi-r64
|
|
|
|
BUILD_SUBTARGET:=mt7622
|
2021-02-27 15:14:02 +00:00
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=sdmmc
|
|
|
|
BL2_DDRBLOB:=2
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7622-sdmmc-2ddr
|
|
|
|
endef
|
|
|
|
|
2021-04-11 15:59:09 +00:00
|
|
|
define U-Boot/mt7622_bananapi_bpi-r64-snand
|
|
|
|
NAME:=BananaPi R64 (SNAND)
|
|
|
|
UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-snand
|
|
|
|
BUILD_DEVICES:=bananapi_bpi-r64
|
|
|
|
BUILD_SUBTARGET:=mt7622
|
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=snand
|
|
|
|
BL2_DDRBLOB:=2
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7622-snand-2ddr
|
|
|
|
endef
|
|
|
|
|
2021-04-02 11:05:15 +00:00
|
|
|
define U-Boot/mt7622_ubnt_unifi-6-lr
|
|
|
|
NAME:=Ubiquiti UniFi 6 LR
|
|
|
|
UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr
|
2022-06-16 18:55:02 +00:00
|
|
|
BUILD_DEVICES:=ubnt_unifi-6-lr-v1-ubootmod ubnt_unifi-6-lr-v2-ubootmod
|
2021-04-02 11:05:15 +00:00
|
|
|
BUILD_SUBTARGET:=mt7622
|
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=nor
|
|
|
|
BL2_DDRBLOB:=2
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr
|
2022-07-13 20:06:36 +00:00
|
|
|
FIP_COMPRESS:=1
|
2021-04-02 11:05:15 +00:00
|
|
|
endef
|
|
|
|
|
2020-07-13 09:37:28 +00:00
|
|
|
define U-Boot/mt7623a_unielec_u7623
|
|
|
|
NAME:=UniElec U7623 (mt7623)
|
2021-08-20 20:12:28 +00:00
|
|
|
BUILD_DEVICES:=unielec_u7623-02
|
2020-07-13 09:37:28 +00:00
|
|
|
BUILD_SUBTARGET:=mt7623
|
|
|
|
UBOOT_CONFIG:=mt7623a_unielec_u7623_02
|
|
|
|
endef
|
|
|
|
|
2020-06-11 18:32:12 +00:00
|
|
|
define U-Boot/mt7623n_bpir2
|
|
|
|
NAME:=Banana Pi R2 (mt7623)
|
2021-07-20 15:58:50 +00:00
|
|
|
BUILD_DEVICES:=bananapi_bpi-r2
|
2020-06-11 18:32:12 +00:00
|
|
|
BUILD_SUBTARGET:=mt7623
|
|
|
|
UBOOT_IMAGE:=u-boot.bin
|
|
|
|
UBOOT_CONFIG:=mt7623n_bpir2
|
|
|
|
endef
|
|
|
|
|
2022-07-11 20:15:32 +00:00
|
|
|
define U-Boot/mt7628_rfb
|
|
|
|
NAME:=MT7628 Reference Board
|
|
|
|
BUILD_DEVICES:=mediatek_mt7628an-eval-board
|
|
|
|
BUILD_TARGET:=ramips
|
|
|
|
BUILD_SUBTARGET:=mt76x8
|
|
|
|
UBOOT_CONFIG:=mt7628_rfb
|
|
|
|
UBOOT_IMAGE:=u-boot-with-spl.bin
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/ravpower_rp-wd009
|
|
|
|
NAME:=RAVPower RP-WD009
|
|
|
|
BUILD_TARGET:=ramips
|
|
|
|
BUILD_DEVICES:=ravpower_rp-wd009
|
|
|
|
BUILD_SUBTARGET:=mt76x8
|
|
|
|
UBOOT_CONFIG:=ravpower-rp-wd009-ram
|
|
|
|
UBOOT_IMAGE:=u-boot.bin
|
|
|
|
endef
|
|
|
|
|
2021-03-14 19:07:00 +00:00
|
|
|
define U-Boot/mt7629_rfb
|
|
|
|
NAME:=MT7629 Reference Board
|
2020-07-13 09:37:28 +00:00
|
|
|
BUILD_SUBTARGET:=mt7629
|
2021-03-14 19:07:00 +00:00
|
|
|
BUILD_DEVICES:=mediatek_mt7629-rfb
|
2020-07-13 09:37:28 +00:00
|
|
|
UBOOT_CONFIG:=mt7629_rfb
|
|
|
|
endef
|
|
|
|
|
2022-07-12 02:41:30 +00:00
|
|
|
define U-Boot/mt7986_rfb
|
|
|
|
NAME:=MT7986 Reference Board
|
|
|
|
BUILD_SUBTARGET:=filogic
|
|
|
|
BUILD_DEVICES:=mediatek_mt7986-rfb
|
|
|
|
UBOOT_CONFIG:=mt7986_rfb
|
2022-07-13 03:29:34 +00:00
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=sdmmc
|
|
|
|
BL2_SOC:=mt7986
|
|
|
|
BL2_DDRTYPE:=ddr4
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7986-sdmmc-ddr4
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7986_bananapi_bpi-r3-emmc
|
|
|
|
NAME:=BananaPi BPi-R3
|
|
|
|
BUILD_SUBTARGET:=filogic
|
|
|
|
BUILD_DEVICES:=bananapi_bpi-r3
|
|
|
|
UBOOT_CONFIG:=mt7986a_bpi-r3-emmc
|
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=emmc
|
|
|
|
BL2_SOC:=mt7986
|
|
|
|
BL2_DDRTYPE:=ddr4
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7986-emmc-ddr4
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7986_bananapi_bpi-r3-sdmmc
|
|
|
|
NAME:=BananaPi BPi-R3
|
|
|
|
BUILD_SUBTARGET:=filogic
|
|
|
|
BUILD_DEVICES:=bananapi_bpi-r3
|
|
|
|
UBOOT_CONFIG:=mt7986a_bpi-r3-sd
|
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=sdmmc
|
|
|
|
BL2_SOC:=mt7986
|
|
|
|
BL2_DDRTYPE:=ddr4
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7986-sdmmc-ddr4
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7986_bananapi_bpi-r3-snand
|
|
|
|
NAME:=BananaPi BPi-R3
|
|
|
|
BUILD_SUBTARGET:=filogic
|
|
|
|
BUILD_DEVICES:=bananapi_bpi-r3
|
|
|
|
UBOOT_CONFIG:=mt7986a_bpi-r3-snand
|
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=spim-nand
|
|
|
|
BL2_SOC:=mt7986
|
|
|
|
BL2_DDRTYPE:=ddr4
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4
|
|
|
|
endef
|
|
|
|
|
|
|
|
define U-Boot/mt7986_bananapi_bpi-r3-nor
|
|
|
|
NAME:=BananaPi BPi-R3
|
|
|
|
BUILD_SUBTARGET:=filogic
|
|
|
|
BUILD_DEVICES:=bananapi_bpi-r3
|
|
|
|
UBOOT_CONFIG:=mt7986a_bpi-r3-nor
|
|
|
|
UBOOT_IMAGE:=u-boot.fip
|
|
|
|
BL2_BOOTDEV:=nor
|
|
|
|
BL2_SOC:=mt7986
|
|
|
|
BL2_DDRTYPE:=ddr4
|
|
|
|
DEPENDS:=+trusted-firmware-a-mt7986-nor-ddr4
|
|
|
|
FIP_COMPRESS:=1
|
2022-07-12 02:41:30 +00:00
|
|
|
endef
|
|
|
|
|
2021-02-27 15:14:02 +00:00
|
|
|
UBOOT_TARGETS := \
|
2022-07-11 20:15:32 +00:00
|
|
|
mt7620_mt7530_rfb \
|
|
|
|
mt7620_rfb \
|
|
|
|
mt7621_nand_rfb \
|
|
|
|
mt7621_rfb \
|
2021-02-27 15:14:02 +00:00
|
|
|
mt7622_bananapi_bpi-r64-emmc \
|
|
|
|
mt7622_bananapi_bpi-r64-sdmmc \
|
2021-04-11 15:59:09 +00:00
|
|
|
mt7622_bananapi_bpi-r64-snand \
|
2021-02-27 15:14:02 +00:00
|
|
|
mt7622_linksys_e8450 \
|
|
|
|
mt7622_rfb1 \
|
2021-04-02 11:05:15 +00:00
|
|
|
mt7622_ubnt_unifi-6-lr \
|
2021-02-27 15:14:02 +00:00
|
|
|
mt7623n_bpir2 \
|
2021-03-14 19:07:00 +00:00
|
|
|
mt7623a_unielec_u7623 \
|
2022-07-11 20:15:32 +00:00
|
|
|
mt7628_rfb \
|
|
|
|
ravpower_rp-wd009 \
|
2022-07-12 02:41:30 +00:00
|
|
|
mt7629_rfb \
|
2022-07-13 03:29:34 +00:00
|
|
|
mt7986_bananapi_bpi-r3-emmc \
|
|
|
|
mt7986_bananapi_bpi-r3-sdmmc \
|
|
|
|
mt7986_bananapi_bpi-r3-snand \
|
|
|
|
mt7986_bananapi_bpi-r3-nor \
|
2022-07-12 02:41:30 +00:00
|
|
|
mt7986_rfb
|
2020-05-04 14:31:19 +00:00
|
|
|
|
2022-07-11 20:15:32 +00:00
|
|
|
ifdef CONFIG_TARGET_mediatek
|
2021-01-30 13:58:16 +00:00
|
|
|
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin)
|
2022-07-11 20:15:32 +00:00
|
|
|
endif
|
2020-05-04 14:31:19 +00:00
|
|
|
|
2021-01-30 13:58:16 +00:00
|
|
|
define Build/fip-image
|
2022-07-13 20:06:36 +00:00
|
|
|
$(if $(FIP_COMPRESS),\
|
2022-07-13 03:29:34 +00:00
|
|
|
xz -f -e -k -9 -C crc32 $(STAGING_DIR_IMAGE)/$(if $(BL2_SOC),$(BL2_SOC),$(BUILD_SUBTARGET))-$(BL2_BOOTDEV)-$(if $(BL2_DDRTYPE),$(BL2_DDRTYPE)-)$(if $(BL2_DDRBLOB),$(BL2_DDRBLOB)ddr-)bl31.bin ;\
|
2022-07-13 20:06:36 +00:00
|
|
|
xz -f -e -k -9 -C crc32 $(PKG_BUILD_DIR)/u-boot.bin \
|
|
|
|
)
|
2021-01-30 13:58:16 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/fiptool create \
|
2022-07-13 03:29:34 +00:00
|
|
|
--soc-fw $(STAGING_DIR_IMAGE)/$(if $(BL2_SOC),$(BL2_SOC),$(BUILD_SUBTARGET))-$(BL2_BOOTDEV)-$(if $(BL2_DDRTYPE),$(BL2_DDRTYPE)-)$(if $(BL2_DDRBLOB),$(BL2_DDRBLOB)ddr-)bl31.bin$(if $(FIP_COMPRESS),.xz) \
|
2022-07-13 20:06:36 +00:00
|
|
|
--nt-fw $(PKG_BUILD_DIR)/u-boot.bin$(if $(FIP_COMPRESS),.xz) \
|
2021-01-30 13:58:16 +00:00
|
|
|
$(PKG_BUILD_DIR)/u-boot.fip
|
|
|
|
endef
|
|
|
|
|
2022-07-11 20:15:32 +00:00
|
|
|
ifdef CONFIG_TARGET_ramips_mt7621
|
|
|
|
define Build/Prepare
|
|
|
|
$(call Build/Prepare/Default)
|
2022-08-09 23:23:34 +00:00
|
|
|
ifdef CONFIG_DEBUG
|
2022-07-11 20:15:32 +00:00
|
|
|
$(CP) $(DL_DIR)/mt7621_stage_sram.bin $(PKG_BUILD_DIR)/
|
2022-08-09 23:23:34 +00:00
|
|
|
else
|
|
|
|
$(CP) $(DL_DIR)/mt7621_stage_sram_noprint.bin $(PKG_BUILD_DIR)/mt7621_stage_sram.bin
|
|
|
|
endif
|
2022-07-11 20:15:32 +00:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2021-08-19 02:57:00 +00:00
|
|
|
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
|
|
|
|
endef
|
|
|
|
|
2021-01-30 13:58:16 +00:00
|
|
|
define Build/Compile
|
|
|
|
$(call Build/Compile/U-Boot)
|
|
|
|
ifeq ($(UBOOT_IMAGE),u-boot.fip))
|
|
|
|
$(call Build/fip-image)
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
|
|
|
|
# don't stage files to bindir, let target/linux/mediatek/image/*.mk do that
|
2022-07-11 20:15:32 +00:00
|
|
|
ifdef CONFIG_TARGET_mediatek
|
2021-01-30 13:58:16 +00:00
|
|
|
define Package/u-boot/install
|
|
|
|
endef
|
2022-07-11 20:15:32 +00:00
|
|
|
endif
|
2021-01-30 13:58:16 +00:00
|
|
|
|
2020-05-04 14:31:19 +00:00
|
|
|
define Build/InstallDev
|
|
|
|
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
|
2021-01-30 13:58:16 +00:00
|
|
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE)
|
2020-05-04 14:31:19 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildPackage/U-Boot))
|