X-Git-Url: https://repo.jachan.dev/J-u-boot.git/blobdiff_plain/83befb446664af32ce18f0e42e99a353e6622e58..99cffa233c730a432ae157742840b8877a5a9c90:/Makefile diff --git a/Makefile b/Makefile index ca2432c8ce9..194f93b3553 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ # SPDX-License-Identifier: GPL-2.0+ -VERSION = 2021 -PATCHLEVEL = 07 +VERSION = 2022 +PATCHLEVEL = 01 SUBLEVEL = -EXTRAVERSION = +EXTRAVERSION = -rc1 NAME = # *DOCUMENTATION* @@ -299,9 +299,7 @@ KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) # have older compilers as their default, so we make it explicit for # these that our host tools are GNU11 (i.e. C11 w/ GNU extensions). CSTD_FLAG := -std=gnu11 -ifeq ($(HOSTOS),linux) KBUILD_HOSTCFLAGS += $(CSTD_FLAG) -endif ifeq ($(HOSTOS),cygwin) KBUILD_HOSTCFLAGS += -ansi @@ -327,14 +325,14 @@ os_x_before = $(shell if [ $(DARWIN_MAJOR_VERSION) -le $(1) -a \ $(DARWIN_MINOR_VERSION) -le $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) os_x_after = $(shell if [ $(DARWIN_MAJOR_VERSION) -ge $(1) -a \ - $(DARWIN_MINOR_VERSION) -ge $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) + $(DARWIN_MINOR_VERSION) -ge $(2) ] ; then echo "$(3)"; else echo "$(4)"; fi ;) # Snow Leopards build environment has no longer restrictions as described above HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") KBUILD_HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") -# macOS Mojave (10.14.X) +# macOS Mojave (10.14.X) # Undefined symbols for architecture x86_64: "_PyArg_ParseTuple" KBUILD_HOSTLDFLAGS += $(call os_x_after, 10, 14, "-lpython -dynamclib", "") endif @@ -415,7 +413,13 @@ PERL = perl PYTHON ?= python PYTHON2 = python2 PYTHON3 ?= python3 -DTC ?= $(objtree)/scripts/dtc/dtc + +# The devicetree compiler and pylibfdt are automatically built unless DTC is +# provided. If DTC is provided, it is assumed the pylibfdt is available too. +DTC_INTREE := $(objtree)/scripts/dtc/dtc +DTC ?= $(DTC_INTREE) +DTC_MIN_VERSION := 010406 + CHECK = sparse CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ @@ -802,31 +806,21 @@ c_flags := $(KBUILD_CFLAGS) $(cpp_flags) HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n) -libs-y += lib/ +libs-$(CONFIG_API) += api/ libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/ +libs-y += boot/ +libs-y += cmd/ +libs-y += common/ libs-$(CONFIG_OF_EMBED) += dts/ +libs-y += env/ +libs-y += lib/ libs-y += fs/ libs-y += net/ libs-y += disk/ libs-y += drivers/ -libs-y += drivers/dma/ -libs-y += drivers/gpio/ -libs-y += drivers/i2c/ -libs-y += drivers/net/ -libs-y += drivers/net/phy/ -libs-y += drivers/power/ \ - drivers/power/domain/ \ - drivers/power/fuel_gauge/ \ - drivers/power/mfd/ \ - drivers/power/pmic/ \ - drivers/power/battery/ \ - drivers/power/regulator/ -libs-y += drivers/spi/ -libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ libs-$(CONFIG_SYS_FSL_MMDC) += drivers/ddr/fsl/ libs-$(CONFIG_$(SPL_)ALTERA_SDRAM) += drivers/ddr/altera/ -libs-y += drivers/serial/ libs-y += drivers/usb/cdns3/ libs-y += drivers/usb/dwc3/ libs-y += drivers/usb/common/ @@ -841,10 +835,6 @@ libs-y += drivers/usb/musb/ libs-y += drivers/usb/musb-new/ libs-y += drivers/usb/phy/ libs-y += drivers/usb/ulpi/ -libs-y += cmd/ -libs-y += common/ -libs-y += env/ -libs-$(CONFIG_API) += api/ ifdef CONFIG_POST libs-y += post/ endif @@ -958,7 +948,7 @@ INPUTS-$(CONFIG_BINMAN_STANDALONE_FDT) += u-boot.dtb ifeq ($(CONFIG_SPL_FRAMEWORK),y) INPUTS-$(CONFIG_OF_SEPARATE) += u-boot-dtb.img endif -INPUTS-$(CONFIG_OF_HOSTFILE) += u-boot.dtb +INPUTS-$(CONFIG_SANDBOX) += u-boot.dtb ifneq ($(CONFIG_SPL_TARGET),) INPUTS-$(CONFIG_SPL) += $(CONFIG_SPL_TARGET:"%"=%) endif @@ -1008,6 +998,9 @@ LDFLAGS_u-boot += $(LDFLAGS_FINAL) # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. LDFLAGS_u-boot += $(call ld-option, --no-dynamic-linker) +# ld.lld support +LDFLAGS_u-boot += -z notext + LDFLAGS_u-boot += --build-id=none ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),) @@ -1102,7 +1095,7 @@ endif ifeq ($(CONFIG_DEPRECATED),y) $(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.") endif -ifeq ($(CONFIG_OF_EMBED),y) +ifeq ($(CONFIG_OF_EMBED)$(CONFIG_EFI_APP),y) @echo >&2 "===================== WARNING ======================" @echo >&2 "CONFIG_OF_EMBED is enabled. This option should only" @echo >&2 "be used for debugging purposes. Please use" @@ -1128,7 +1121,7 @@ endif $(call deprecated,CONFIG_WDT,DM watchdog,v2019.10,\ $(CONFIG_WATCHDOG)$(CONFIG_HW_WATCHDOG)) $(call deprecated,CONFIG_DM_ETH,Ethernet drivers,v2020.07,$(CONFIG_NET)) - $(call deprecated,CONFIG_DM_I2C,I2C drivers,v2022.04,$(CONFIG_I2C)) + $(call deprecated,CONFIG_DM_I2C,I2C drivers,v2022.04,$(CONFIG_SYS_I2C_LEGACY)) @# Check that this build does not use CONFIG options that we do not @# know about unless they are in Kconfig. All the existing CONFIG @# options are whitelisted, so new ones should not be added. @@ -1170,6 +1163,8 @@ MKIMAGEFLAGS_fit-dtb.blob = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a 0 -e 0 -E \ $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -d /dev/null +MKIMAGEFLAGS_fit-dtb.blob += -B 0x8 + ifneq ($(EXT_DTB),) u-boot-fit-dtb.bin: u-boot-nodtb.bin $(EXT_DTB) $(call if_changed,cat) @@ -1305,10 +1300,6 @@ u-boot.ldr: u-boot # Use 'make BINMAN_VERBOSE=3' to set vebosity level default_dt := $(if $(DEVICE_TREE),$(DEVICE_TREE),$(CONFIG_DEFAULT_DEVICE_TREE)) -# Tell binman whether we have a devicetree for SPL and TPL -have_spl_dt := $(if $(CONFIG_SPL_OF_PLATDATA),,$(CONFIG_SPL_OF_CONTROL)) -have_tpl_dt := $(if $(CONFIG_TPL_OF_PLATDATA),,$(CONFIG_TPL_OF_CONTROL)) - quiet_cmd_binman = BINMAN $@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ --toolpath $(objtree)/tools \ @@ -1322,7 +1313,8 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \ -a scp-path=$(SCP) \ -a spl-bss-pad=$(if $(CONFIG_SPL_SEPARATE_BSS),,1) \ -a tpl-bss-pad=$(if $(CONFIG_TPL_SEPARATE_BSS),,1) \ - -a spl-dtb=$(have_spl_dt) -a tpl-dtb=$(have_tpl_dt) \ + -a spl-dtb=$(CONFIG_SPL_OF_REAL) \ + -a tpl-dtb=$(CONFIG_TPL_OF_REAL) \ $(BINMAN_$(@F)) OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex @@ -1351,9 +1343,6 @@ $(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) else ifneq ($(CONFIG_USE_SPL_FIT_GENERATOR),) U_BOOT_ITS := u-boot.its -ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-imx/mkimage_fit_atf.sh") -U_BOOT_ITS_DEPS += u-boot-nodtb.bin -endif ifeq ($(CONFIG_SPL_FIT_GENERATOR),"arch/arm/mach-rockchip/make_fit_atf.py") U_BOOT_ITS_DEPS += u-boot endif @@ -1422,7 +1411,7 @@ u-boot-lzma.img: u-boot.bin.lzma FORCE u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl u-boot-ivt.img: \ $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin \ - $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \ + $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX)$(CONFIG_BINMAN_STANDALONE_FDT),dts/dt.dtb) \ ,$(UBOOT_BIN)) FORCE $(call if_changed,mkimage) $(BOARD_SIZE_CHECK) @@ -1432,16 +1421,17 @@ MKIMAGEFLAGS_u-boot.itb = else MKIMAGEFLAGS_u-boot.itb = -E endif +MKIMAGEFLAGS_u-boot.itb += -B 0x8 ifdef U_BOOT_ITS u-boot.itb: u-boot-nodtb.bin \ - $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_OF_HOSTFILE),dts/dt.dtb) \ + $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SANDBOX),dts/dt.dtb) \ $(U_BOOT_ITS) FORCE $(call if_changed,mkfitimage) $(BOARD_SIZE_CHECK) endif -u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE +u-boot-spl.kwb: u-boot.bin spl/u-boot-spl.bin FORCE $(call if_changed,mkimage) u-boot.sha1: u-boot.bin @@ -1736,7 +1726,7 @@ u-boot-keep-syms-lto_c := $(patsubst %.o,%.c,$(u-boot-keep-syms-lto)) quiet_cmd_keep_syms_lto = KSL $@ cmd_keep_syms_lto = \ - NM=$(NM) $(srctree)/scripts/gen_ll_addressable_symbols.sh $^ >$@ + $(srctree)/scripts/gen_ll_addressable_symbols.sh $(NM) $^ > $@ quiet_cmd_keep_syms_lto_cc = KSLCC $@ cmd_keep_syms_lto_cc = \ @@ -1754,7 +1744,7 @@ endif # May be overridden by arch/$(ARCH)/config.mk ifdef CONFIG_LTO quiet_cmd_u-boot__ ?= LTO $@ - cmd_u-boot__ ?= \ + cmd_u-boot__ ?= \ $(CC) -nostdlib -nostartfiles \ $(LTO_FINAL_LDFLAGS) $(c_flags) \ $(KBUILD_LDFLAGS:%=-Wl,%) $(LDFLAGS_u-boot:%=-Wl,%) -o $@ \ @@ -1767,12 +1757,16 @@ quiet_cmd_u-boot__ ?= LTO $@ -Wl,-Map,u-boot.map; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) else +# Note: Linking efi-x86_app64 causes a segfault in the linker at present +# when using x86_64-linux-gnu-ld.bfd +# For now, disable --whole-archive which makes things link, although not +# correctly quiet_cmd_u-boot__ ?= LD $@ cmd_u-boot__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ -T u-boot.lds $(u-boot-init) \ - --whole-archive \ + $(if $(CONFIG_EFI_APP_64BIT),,--whole-archive) \ $(u-boot-main) \ - --no-whole-archive \ + $(if $(CONFIG_EFI_APP_64BIT),,--no-whole-archive) \ $(PLATFORM_LIBS) -Map u-boot.map; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) endif @@ -1905,8 +1899,6 @@ define filechk_timestamp.h LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DATE "%b %d %C%y"'; \ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TIME "%T"'; \ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_TZ "%z"'; \ - LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ - LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \ LC_ALL=C $${DATE} -u -d "$${SOURCE_DATE}" +'#define U_BOOT_EPOCH %s'; \ else \ return 42; \ @@ -1915,8 +1907,6 @@ define filechk_timestamp.h LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ LC_ALL=C date +'#define U_BOOT_TZ "%z"'; \ - LC_ALL=C date +'#define U_BOOT_DMI_DATE "%m/%d/%Y"'; \ - LC_ALL=C date +'#define U_BOOT_BUILD_DATE 0x%Y%m%d'; \ LC_ALL=C date +'#define U_BOOT_EPOCH %s'; \ fi) endef @@ -1973,9 +1963,29 @@ endif endif +# Check dtc and pylibfdt, if DTC is provided, else build them PHONY += scripts_dtc scripts_dtc: scripts_basic - $(Q)$(MAKE) $(build)=scripts/dtc + $(Q)if test "$(DTC)" = "$(DTC_INTREE)"; then \ + $(MAKE) $(build)=scripts/dtc; \ + else \ + if ! $(DTC) -v >/dev/null; then \ + echo '*** Failed to check dtc version: $(DTC)'; \ + false; \ + else \ + if test "$(call dtc-version)" -lt $(DTC_MIN_VERSION); then \ + echo '*** Your dtc is too old, please upgrade to dtc $(DTC_MIN_VERSION) or newer'; \ + false; \ + else \ + if [ -n "$(CONFIG_PYLIBFDT)" ]; then \ + if ! echo "import libfdt" | $(PYTHON3) 2>/dev/null; then \ + echo '*** pylibfdt does not seem to be available with $(PYTHON3)'; \ + false; \ + fi; \ + fi; \ + fi; \ + fi; \ + fi # --------------------------------------------------------------------------- quiet_cmd_cpp_lds = LDS $@ @@ -2095,14 +2105,14 @@ CLEAN_DIRS += $(MODVERDIR) \ $(filter-out include, $(shell ls -1 $d 2>/dev/null)))) CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \ - boot* u-boot* MLO* SPL System.map fit-dtb.blob* \ + u-boot* MLO* SPL System.map fit-dtb.blob* \ u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \ lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \ idbloader.img flash.bin flash.log defconfig keep-syms-lto.c # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config include/generated spl tpl \ - .tmp_objdiff doc/output + .tmp_objdiff doc/output include/asm # Remove include/asm symlink created by U-Boot before v2014.01 MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \