lede/package/boot/uboot-mediatek/Makefile
lovehackintosh 51ec2f45a6
treewide: sync with upstream (#10750)
* build: fix incomplete initramfs compression options

Requires: tools/lz4, tools/lzop

complete the wiring so that these options work:
* `CONFIG_KERNEL_INITRAMFS_COMPRESSION_LZO`
* `CONFIG_KERNEL_INITRAMFS_COMPRESSION_LZ4`

Signed-off-by: Tony Butler <spudz76@gmail.com>
[remove blocking dependencies for separate ramdisk, fix lzop options]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>

* include: sync with upstream

* toolchain/binutils: add support for version 2.40

Release notes:
    https://sourceware.org/pipermail/binutils/2023-January/125671.html

Signed-off-by: Linhui Liu <liulinhui36@gmail.com>

* toolchain/gcc: switch to version 12 by default

Also fix build error with gcc 12.

* toolchain/nasm: update to 2.16.01

ChangeLog:

 Version 2.16.01

       _This is a documentation update release only._

       (*) Fix the creation of the table of contents in the HTML version of
           the documentation.

 Version 2.16

       (*) Support for the `rdf' format has been discontinued and all the
           RDOFF utilities has been removed.

       (*) The `--reproducible' option now leaves the filename field in the
           COFF object format blank. This was always rather useless since
           it is only 18 characters long; as such debug formats have to
           carry their own filename information anyway.

       (*) Fix handling of MASM-syntax reserved memory (e.g. `dw ?') when
           used in structure definitions.

       (*) The preprocessor now supports functions, which can be less
           verbose and more convenient than the equivalent code implemented
           using directives. See section 4.4.

       (*) Fix the handling of `%00' in the preprocessor.

       (*) Fix incorrect handling of path names affecting error messages,
           dependency generation, and debug format output.

       (*) Support for the RDOFF output format and the RDOFF tools have
           been removed. The RDOFF tools had already been broken since at
           least NASM 2.14. For flat code the ELF output format
           recommended; for segmented code the `obj' (OMF) output format.

       (*) New facility: preprocessor functions. Preprocessor functions,
           which are expanded similarly to single-line macros, can greatly
           simplify code that in the past would have required a lengthy
           list of directives and intermediate macros. See section 4.4.

       (*) Single-line macros can now declare parameters (using a `&&'
           prefix) that creates a quoted string, but does _not_ requote an
           already quoted string. See section 4.2.1.

       (*) Instruction table updated per public information available as of
           November 2022.

       (*) All warnings in the preprocessor have now been assigned warning
           classes. See appendix A.

       (*) Fix the invalid use of `RELA'-type relocations instead of `REL'-
           type relocations when generating DWARF debug information for the
           `elf32' output format.

       (*) Fix the handling `at' in `istruc' when the structure contains
           local labels. See section 5.9.2.

       (*) When assembling with `--reproducible', don't encode the filename
           in the COFF header for the `coff', `win32' or `win64' output
           formats. The COFF header only has space for an 18-character
           filename, which makes this field rather useless in the first
           place. Debug output data, if enabled, is not affected.

       (*) Fix incorrect size calculation when using MASM syntax for non-
           byte reservations (e.g. `dw ?'.)

       (*) Allow forcing an instruction in 64-bit mode to have a (possibly
           redundant) REX prefix, using the syntax `{rex}' as a prefix.

       (*) Add a `{vex}' prefix to enforce VEX (AVX) encoding of an
           instruction, either using the 2- or 3-byte VEX prefixes.

       (*) The `CPU' directive has been augmented to allow control of
           generation of VEX (AVX) versus EVEX (AVX-512) instruction
           formats, see section 7.11.

       (*) Some recent instructions that previously have been only
           available using EVEX encodings are now also encodable using VEX
           (AVX) encodings. For backwards compatibility these encodings are
           not enabled by default, but can be generated either via an
           explicit `{vex}' prefix or by specifying either `CPU LATEVEX' or
           `CPU NOEVEX'; see section 7.11.

       (*) Document the already existing `%unimacro' directive. See section
           4.5.12.

       (*) Fix a code range generation bug in the DWARF debug format
           (incorrect information in the `DW_AT_high_pc' field) for the ELF
           output formats. This bug happened to cancel out with a bug in
           older versions of the GNU binutils linker, but breaks with other
           linkers and updated or other linkers that expect the spec to be
           followed.

       (*) Fix segment symbols with addends, e.g. `jmp _TEXT+10h:0' in
           output formats that support segment relocations, e.g. the `obj'
           format.

       (*) Fix various crashes and hangs on invalid input.

Signed-off-by: Linhui Liu <liulinhui36@gmail.com>

* toolchain: musl: Fix symbol loading in gdb

Fix DT_DEBUG handling on MIPS in musl libc.
With this change gdb will load the symbol files for shared libraries on MIPS too.

This patch was taken from this thread: https://www.openwall.com/lists/musl/2022/01/09/4

Signed-off-by: Hauke Mehrtens <hmehrtens@maxlinear.com>

* tools: sync with upstream

* build: fix issues with targets installed via feeds

- fix including modules.mk when a target is being replaced
- fix calling make targets from target/linux

Signed-off-by: Felix Fietkau <nbd@nbd.name>

* package: sync with upstream

Signed-off-by: Tony Butler <spudz76@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Linhui Liu <liulinhui36@gmail.com>
Signed-off-by: Hauke Mehrtens <hmehrtens@maxlinear.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Co-authored-by: Tony Butler <spudz76@gmail.com>
Co-authored-by: Hauke Mehrtens <hmehrtens@maxlinear.com>
Co-authored-by: Felix Fietkau <nbd@nbd.name>
2023-01-25 15:30:35 +08:00

324 lines
8.5 KiB
Makefile

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_VERSION:=2023.01
PKG_HASH:=69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f
PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host
include $(INCLUDE_DIR)/u-boot.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/host-build.mk
MT7621_LOWLEVEL_PRELOADER_URL:=https://raw.githubusercontent.com/mtk-openwrt/mt7621-lowlevel-preloader/a03b07c60bf1ba4add9b671d32caa102fe948180/
define Download/mt7621-stage-sram
FILE:=mt7621_stage_sram.bin
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
HASH:=1dda68aa089f0ff262e01539b990dea478952e9fb68bcc0a8cd6f76f0135c62e
endef
define Download/mt7621-stage-sram-noprint
FILE:=mt7621_stage_sram_noprint.bin
URL:=$(MT7621_LOWLEVEL_PRELOADER_URL)
HASH:=8ee419275144fc298e9444d413d98e965a55d283152a74ea6a1f8de79eb516b6
endef
ifdef CONFIG_TARGET_ramips_mt7621
ifdef CONFIG_DEBUG
$(eval $(call Download,mt7621-stage-sram))
else
$(eval $(call Download,mt7621-stage-sram-noprint))
endif
endif
define U-Boot/Default
BUILD_TARGET:=mediatek
UBOOT_IMAGE:=u-boot-mtk.bin
endef
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
define U-Boot/mt7622_rfb1
NAME:=MT7622 Reference Board 1
UBOOT_CONFIG:=mt7622_rfb
BUILD_DEVICES:=mediatek_mt7622-rfb1 mediatek_mt7622-rfb1-ubi
BUILD_SUBTARGET:=mt7622
endef
define U-Boot/mt7622_linksys_e8450
NAME:=Linksys E8450
UBOOT_CONFIG:=mt7622_linksys_e8450
BUILD_DEVICES:=linksys_e8450-ubi
BUILD_SUBTARGET:=mt7622
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=snand
BL2_DDRBLOB:=1
DEPENDS:=+trusted-firmware-a-mt7622-snand-1ddr
endef
define U-Boot/mt7622_bananapi_bpi-r64-emmc
NAME:=BananaPi R64 (eMMC)
UBOOT_CONFIG:=mt7622_bananapi_bpi-r64-emmc
BUILD_DEVICES:=bananapi_bpi-r64
BUILD_SUBTARGET:=mt7622
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
BUILD_DEVICES:=bananapi_bpi-r64
BUILD_SUBTARGET:=mt7622
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=sdmmc
BL2_DDRBLOB:=2
DEPENDS:=+trusted-firmware-a-mt7622-sdmmc-2ddr
endef
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
define U-Boot/mt7622_ubnt_unifi-6-lr
NAME:=Ubiquiti UniFi 6 LR
UBOOT_CONFIG:=mt7622_ubnt_unifi-6-lr
BUILD_DEVICES:=ubnt_unifi-6-lr-v1-ubootmod ubnt_unifi-6-lr-v2-ubootmod
BUILD_SUBTARGET:=mt7622
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=nor
BL2_DDRBLOB:=2
DEPENDS:=+trusted-firmware-a-mt7622-nor-2ddr
FIP_COMPRESS:=1
endef
define U-Boot/mt7623a_unielec_u7623
NAME:=UniElec U7623 (mt7623)
BUILD_DEVICES:=unielec_u7623-02
BUILD_SUBTARGET:=mt7623
UBOOT_CONFIG:=mt7623a_unielec_u7623_02
endef
define U-Boot/mt7623n_bpir2
NAME:=Banana Pi R2 (mt7623)
BUILD_DEVICES:=bananapi_bpi-r2
BUILD_SUBTARGET:=mt7623
UBOOT_IMAGE:=u-boot.bin
UBOOT_CONFIG:=mt7623n_bpir2
endef
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
define U-Boot/mt7629_rfb
NAME:=MT7629 Reference Board
BUILD_SUBTARGET:=mt7629
BUILD_DEVICES:=mediatek_mt7629-rfb
UBOOT_CONFIG:=mt7629_rfb
endef
define U-Boot/mt7986_rfb
NAME:=MT7986 Reference Board
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=mediatek_mt7986-rfb
UBOOT_CONFIG:=mt7986_rfb
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
endef
define U-Boot/mt7986_xiaomi_redmi-router-ax6000
NAME:=Xiaomi Redmi AX6000
BUILD_SUBTARGET:=filogic
BUILD_DEVICES:=xiaomi_redmi-router-ax6000-ubootmod
UBOOT_CONFIG:=mt7986_xiaomi_redmi-ax6000
UBOOT_IMAGE:=u-boot.fip
BL2_BOOTDEV:=spim-nand
BL2_SOC:=mt7986
BL2_DDRTYPE:=ddr4
DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4
endef
UBOOT_TARGETS := \
mt7620_mt7530_rfb \
mt7620_rfb \
mt7621_nand_rfb \
mt7621_rfb \
mt7622_bananapi_bpi-r64-emmc \
mt7622_bananapi_bpi-r64-sdmmc \
mt7622_bananapi_bpi-r64-snand \
mt7622_linksys_e8450 \
mt7622_rfb1 \
mt7622_ubnt_unifi-6-lr \
mt7623n_bpir2 \
mt7623a_unielec_u7623 \
mt7628_rfb \
ravpower_rp-wd009 \
mt7629_rfb \
mt7986_bananapi_bpi-r3-emmc \
mt7986_bananapi_bpi-r3-sdmmc \
mt7986_bananapi_bpi-r3-snand \
mt7986_bananapi_bpi-r3-nor \
mt7986_xiaomi_redmi-router-ax6000 \
mt7986_rfb
ifdef CONFIG_TARGET_mediatek
UBOOT_MAKE_FLAGS += $(UBOOT_IMAGE:.fip=.bin)
endif
define Build/fip-image
$(if $(FIP_COMPRESS),\
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 ;\
xz -f -e -k -9 -C crc32 $(PKG_BUILD_DIR)/u-boot.bin \
)
$(STAGING_DIR_HOST)/bin/fiptool create \
--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) \
--nt-fw $(PKG_BUILD_DIR)/u-boot.bin$(if $(FIP_COMPRESS),.xz) \
$(PKG_BUILD_DIR)/u-boot.fip
endef
ifdef CONFIG_TARGET_ramips_mt7621
define Build/Prepare
$(call Build/Prepare/Default)
ifdef CONFIG_DEBUG
$(CP) $(DL_DIR)/mt7621_stage_sram.bin $(PKG_BUILD_DIR)/
else
$(CP) $(DL_DIR)/mt7621_stage_sram_noprint.bin $(PKG_BUILD_DIR)/mt7621_stage_sram.bin
endif
endef
endif
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
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
ifdef CONFIG_TARGET_mediatek
define Package/u-boot/install
endef
endif
define Build/InstallDev
$(INSTALL_DIR) $(STAGING_DIR_IMAGE)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/$(UBOOT_IMAGE) $(STAGING_DIR_IMAGE)/$(BUILD_VARIANT)-$(UBOOT_IMAGE)
endef
$(eval $(call BuildPackage/U-Boot))