]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - Makefile
Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-mmc
[thirdparty/u-boot.git] / Makefile
index 033daf1695c0ae505e665b5206db4a0bc23584e8..2fcb704077e1764d8527f4d5035b4fdb69e62396 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 
-VERSION = 2023
-PATCHLEVEL = 10
+VERSION = 2024
+PATCHLEVEL = 07
 SUBLEVEL =
-EXTRAVERSION = -rc3
+EXTRAVERSION = -rc1
 NAME =
 
 # *DOCUMENTATION*
@@ -485,6 +485,15 @@ export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o    \
 export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
                         --exclude CVS --exclude .pc --exclude .hg --exclude .git
 
+export PYTHON_ENABLE
+
+# This is y if U-Boot should not build any Python tools or libraries. Typically
+# you would need to set this if those tools/libraries (typically binman and
+# pylibfdt) cannot be built by your environment and are provided separately.
+ifeq ($(NO_PYTHON),)
+PYTHON_ENABLE=y
+endif
+
 # ===========================================================================
 # Rules shared between *config targets and build targets
 
@@ -741,6 +750,7 @@ endif
 
 ifeq ($(CONFIG_STACKPROTECTOR),y)
 KBUILD_CFLAGS += $(call cc-option,-fstack-protector-strong)
+KBUILD_CFLAGS += $(call cc-option,-mstack-protector-guard=global)
 CFLAGS_EFI += $(call cc-option,-fno-stack-protector)
 else
 KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
@@ -825,7 +835,8 @@ UBOOTINCLUDE    := \
                                -I$(srctree)/arch/arm/thumb1/include), \
                        -I$(srctree)/arch/arm/thumb1/include)) \
        -I$(srctree)/arch/$(ARCH)/include \
-       -include $(srctree)/include/linux/kconfig.h
+       -include $(srctree)/include/linux/kconfig.h \
+       -I$(srctree)/dts/upstream/include
 
 NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
 
@@ -842,7 +853,7 @@ HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makef
 libs-$(CONFIG_API) += api/
 libs-$(HAVE_VENDOR_COMMON_LIB) += board/$(VENDOR)/common/
 libs-y += boot/
-libs-y += cmd/
+libs-$(CONFIG_CMDLINE) += cmd/
 libs-y += common/
 libs-$(CONFIG_OF_EMBED) += dts/
 libs-y += env/
@@ -877,7 +888,7 @@ libs-$(CONFIG_UT_ENV) += test/env/
 libs-$(CONFIG_UT_OPTEE) += test/optee/
 libs-$(CONFIG_UT_OVERLAY) += test/overlay/
 
-libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/)
+libs-y += $(if $(wildcard $(srctree)/board/$(BOARDDIR)/Makefile),board/$(BOARDDIR)/)
 
 libs-y := $(sort $(libs-y))
 
@@ -1144,20 +1155,45 @@ endif
        @# is enable to tell 'deprecated' that one of these symbols exists
        $(call deprecated,CONFIG_TIMER,Timer drivers,v2023.01,$(if $(strip $(CFG_SYS_TIMER_RATE)$(CFG_SYS_TIMER_COUNTER)),x))
        $(call deprecated,CONFIG_DM_SERIAL,Serial drivers,v2023.04,$(CONFIG_SERIAL))
-       $(call deprecated,CONFIG_DM_SCSI,SCSI drivers,v2023.04,$(CONFIG_SCSI))
        @# Check that this build does not override OF_HAS_PRIOR_STAGE by
        @# disabling OF_BOARD.
        $(call cmd,ofcheck,$(KCONFIG_CONFIG))
 
-PHONY += dtbs
+PHONY += dtbs dtbs_check
 dtbs: dts/dt.dtb
        @:
-dts/dt.dtb: u-boot
+dts/dt.dtb: dtbs_prepare u-boot
        $(Q)$(MAKE) $(build)=dts dtbs
 
+dtbs_prepare: prepare3
+
+ifneq ($(filter dtbs_check, $(MAKECMDGOALS)),)
+export CHECK_DTBS=y
+endif
+
+ifneq ($(CHECK_DTBS),)
+dtbs_prepare: dt_binding_check
+endif
+
+dtbs_check: dt_binding_check dtbs
+
+DT_BINDING_DIR := dts/upstream/Bindings
+dt_binding_check: scripts_dtc
+       $(Q)$(MAKE) $(build)=$(DT_BINDING_DIR) $(DT_BINDING_DIR)/processed-schema.json
+
 quiet_cmd_copy = COPY    $@
       cmd_copy = cp $< $@
 
+ifeq ($(CONFIG_OF_UPSTREAM),y)
+ifeq ($(CONFIG_ARM64),y)
+dt_dir := dts/upstream/src/arm64
+else
+dt_dir := dts/upstream/src/$(ARCH)
+endif
+else
+dt_dir := arch/$(ARCH)/dts
+endif
+
 ifeq ($(CONFIG_MULTI_DTB_FIT),y)
 
 ifeq ($(CONFIG_MULTI_DTB_FIT_LZO),y)
@@ -1183,7 +1219,7 @@ endif
 
 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
+       $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -d /dev/null
 
 MKIMAGEFLAGS_fit-dtb.blob += -B 0x8
 
@@ -1257,19 +1293,24 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE
        $(call if_changed,objcopy)
 
 %.scif: %.srec
-       $(Q)$(MAKE) $(build)=arch/arm/mach-rmobile $@
+       $(Q)$(MAKE) $(build)=arch/arm/mach-renesas $@
 
 OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
                $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
                $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),$(if $(CONFIG_OF_SEPARATE),-R .bootpg -R .resetvec))
 
 binary_size_check: u-boot-nodtb.bin FORCE
-       @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
+       @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{ print $$1 }') ; \
        map_size=$(shell cat u-boot.map | \
-               awk '/_image_copy_start/ {start = $$1} /_image_binary_end/ {end = $$1} END {if (start != "" && end != "") print "ibase=16; " toupper(end) " - " toupper(start)}' \
-               | sed 's/0X//g' \
-               | bc); \
-       if [ "" != "$$map_size" ]; then \
+               awk ' \
+                       /_image_copy_start/ { start = $$1 } \
+                       /_image_binary_end/ { end = $$1 } \
+                       END { \
+                               if (start != "" && end != "") \
+                                       print end " " start; \
+                       }' \
+               | sh -c 'read end start && echo $$((end - start))'); \
+       if [ -n "$$map_size" ]; then \
                if test $$map_size -ne $$file_size; then \
                        echo "u-boot.map shows a binary size of $$map_size" >&2 ; \
                        echo "  but u-boot-nodtb.bin shows $$file_size" >&2 ; \
@@ -1278,7 +1319,7 @@ binary_size_check: u-boot-nodtb.bin FORCE
        fi
 
 ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy)
-ifneq ($(CONFIG_SYS_MALLOC_F_LEN),)
+ifneq ($(CONFIG_SYS_MALLOC_F),)
 subtract_sys_malloc_f_len = space=$$(($${space} - $(CONFIG_SYS_MALLOC_F_LEN)))
 else
 subtract_sys_malloc_f_len = true
@@ -1319,7 +1360,7 @@ u-boot-nodtb.bin: u-boot FORCE
 
 u-boot.ldr:    u-boot
                $(CREATE_LDR_ENV)
-               $(LDR) -T $(CONFIG_CPU) -c $@ $< $(LDR_FLAGS)
+               $(LDR) -T $(CONFIG_LDR_CPU) -c $@ $< $(LDR_FLAGS)
                $(BOARD_SIZE_CHECK)
 
 # binman
@@ -1336,10 +1377,11 @@ cmd_binman = $(srctree)/tools/binman/binman $(if $(BINMAN_DEBUG),-D) \
                build -u -d u-boot.dtb -O . -m \
                --allow-missing $(if $(BINMAN_ALLOW_MISSING),--ignore-missing) \
                -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
-               -I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
+               -I $(dt_dir) -a of-list=$(CONFIG_OF_LIST) \
                $(foreach f,$(BINMAN_INDIRS),-I $(f)) \
                -a atf-bl31-path=${BL31} \
                -a tee-os-path=${TEE} \
+               -a ti-dm-path=${TI_DM} \
                -a opensbi-path=${OPENSBI} \
                -a default-dt=$(default_dt) \
                -a scp-path=$(SCP) \
@@ -1358,14 +1400,6 @@ OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
 u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
        $(call if_changed,objcopy)
 
-#
-# U-Boot entry point, needed for booting of full-blown U-Boot
-# from the SPL U-Boot version.
-#
-ifndef CFG_SYS_UBOOT_START
-CFG_SYS_UBOOT_START := $(CONFIG_TEXT_BASE)
-endif
-
 # Boards with more complex image requirements can provide an .its source file
 # or a generator script
 # NOTE: Please do not use this. We are migrating away from Makefile rules to use
@@ -1379,24 +1413,24 @@ ifneq ($(CONFIG_USE_SPL_FIT_GENERATOR),)
 U_BOOT_ITS := u-boot.its
 $(U_BOOT_ITS): $(U_BOOT_ITS_DEPS) FORCE
        $(srctree)/$(CONFIG_SPL_FIT_GENERATOR) \
-       $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@
+       $(patsubst %,$(dt_dir)/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) > $@
 endif
 endif
 
 ifdef CONFIG_SPL_LOAD_FIT
 MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
-       -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \
+       -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
        -p $(CONFIG_FIT_EXTERNAL_OFFSET) \
        -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
-       $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(DEVICE_TREE))) \
-       $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
-       $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST)))
+       $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(DEVICE_TREE))) \
+       $(patsubst %,-b $(dt_dir)/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \
+       $(patsubst %,-b $(dt_dir)/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST)))
 else
 MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
-       -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \
+       -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
        -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
 MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \
-       -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \
+       -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
        -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
 u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log
 endif
@@ -1427,7 +1461,7 @@ MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
 UBOOT_BIN := u-boot.bin
 
 MKIMAGEFLAGS_u-boot-lzma.img = -A $(ARCH) -T standalone -C lzma -O u-boot \
-       -a $(CONFIG_TEXT_BASE) -e $(CFG_SYS_UBOOT_START) \
+       -a $(CONFIG_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
        -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
 
 u-boot.bin.lzma: u-boot.bin FORCE
@@ -1802,7 +1836,8 @@ ENV_FILE := $(if $(ENV_SOURCE_FILE),$(ENV_FILE_CFG),$(wildcard $(ENV_FILE_BOARD)
 quiet_cmd_gen_envp = ENVP    $@
       cmd_gen_envp = \
        if [ -s "$(ENV_FILE)" ]; then \
-               $(CPP) -P $(CFLAGS) -x assembler-with-cpp -D__ASSEMBLY__ \
+               $(CPP) -P $(CFLAGS) -x assembler-with-cpp -undef \
+                       -D__ASSEMBLY__ \
                        -D__UBOOT_CONFIG__ \
                        -I . -I include -I $(srctree)/include \
                        -include linux/kconfig.h -include include/config.h \
@@ -1830,7 +1865,7 @@ quiet_cmd_envc = ENVC    $@
                touch $@ ; \
        fi
 
-include/generated/env.txt: $(wildcard $(ENV_FILE))
+include/generated/env.txt: $(wildcard $(ENV_FILE)) include/generated/autoconf.h
        $(call cmd,envc)
 
 # Write out the resulting environment, converted to a C string
@@ -1928,6 +1963,7 @@ define filechk_version.h
        echo \#define U_BOOT_VERSION_NUM $(VERSION); \
        echo \#define U_BOOT_VERSION_NUM_PATCH $$(echo $(PATCHLEVEL) | \
                sed -e "s/^0*//"); \
+       echo \#define HOST_ARCH $(HOST_ARCH); \
        echo \#define CC_VERSION_STRING \"$$(LC_ALL=C $(CC) --version | head -n 1)\"; \
        echo \#define LD_VERSION_STRING \"$$(LC_ALL=C $(LD) --version | head -n 1)\"; )
 endef
@@ -2155,16 +2191,17 @@ CLEAN_DIRS  += $(MODVERDIR) \
               $(foreach d, spl tpl vpl, $(patsubst %,$d/%, \
                        $(filter-out include, $(shell ls -1 $d 2>/dev/null))))
 
-CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h \
-              include/generated/env.* drivers/video/u_boot_logo.S \
+CLEAN_FILES += include/autoconf.mk* include/bmp_logo.h include/bmp_logo_data.h \
+              include/config.h include/generated/env.* drivers/video/u_boot_logo.S \
               tools/version.h 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 \
               mkimage-out.spl.mkimage mkimage.spl.mkimage imx-boot.map \
               itb.fit.fit itb.fit.itb itb.map spl.map mkimage-out.rom.mkimage \
-              mkimage.rom.mkimage rom.map simple-bin.map simple-bin-spi.map \
-              idbloader-spi.img lib/efi_loader/helloworld_efi.S
+              mkimage.rom.mkimage mkimage-in-simple-bin* rom.map simple-bin* \
+              idbloader-spi.img lib/efi_loader/helloworld_efi.S *.itb \
+              Test* capsule.*.efi-capsule capsule*.map
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl vpl \
@@ -2194,6 +2231,8 @@ clean: $(clean-dirs)
        @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
                \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
                -o -name '*.ko.*' -o -name '*.su' -o -name '*.pyc' \
+               -o -name '*.dtb' -o -name '*.dtbo' \
+               -o -name '*.dtb.S' -o -name '*.dtbo.S' \
                -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
                -o -name '*.lex.c' -o -name '*.tab.[ch]' \
                -o -name '*.asn1.[ch]' \
@@ -2201,6 +2240,7 @@ clean: $(clean-dirs)
                -o -name modules.builtin -o -name '.tmp_*.o.*' \
                -o -name 'dsdt_generated.aml' -o -name 'dsdt_generated.asl.tmp' \
                -o -name 'dsdt_generated.c' \
+               -o -name 'generated_defconfig' \
                -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
                -type f -print | xargs rm -f
 
@@ -2446,7 +2486,7 @@ cmd_genenv = \
        sed -e '/^\s*$$/d' | \
        sort -t '=' -k 1,1 -s -o $@
 
-u-boot-initial-env: $(env_h) FORCE
+u-boot-initial-env: scripts_basic $(env_h) FORCE
        $(Q)$(MAKE) $(build)=tools $(objtree)/tools/printinitialenv
        $(call if_changed,genenv)