X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=Makefile;h=149f83994814bdac3570a6d92bc421906c4a8c8a;hb=1e389a434aa9821330523002ee7b50d1147e0fef;hp=61b94c5a6e2eb10c4b930dd10ae495b8ef7e1c55;hpb=ba742b839c524f7723799d750a540ad3fe70ca7f;p=oweals%2Fu-boot.git diff --git a/Makefile b/Makefile index 61b94c5a6e..149f839948 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ # SPDX-License-Identifier: GPL-2.0+ -VERSION = 2019 -PATCHLEVEL = 10 +VERSION = 2020 +PATCHLEVEL = 07 SUBLEVEL = -EXTRAVERSION = +EXTRAVERSION = -rc4 NAME = # *DOCUMENTATION* @@ -17,6 +17,25 @@ NAME = # o Look for make include files relative to root of kernel src MAKEFLAGS += -rR --include-dir=$(CURDIR) +# Determine host architecture +include include/host_arch.h +MK_ARCH="${shell uname -m}" +unexport HOST_ARCH +ifeq ("x86_64", $(MK_ARCH)) + export HOST_ARCH=$(HOST_ARCH_X86_64) +else ifneq (,$(findstring $(MK_ARCH), "i386" "i486" "i586" "i686")) + export HOST_ARCH=$(HOST_ARCH_X86) +else ifneq (,$(findstring $(MK_ARCH), "aarch64" "armv8l")) + export HOST_ARCH=$(HOST_ARCH_AARCH64) +else ifeq ("armv7l", $(MK_ARCH)) + export HOST_ARCH=$(HOST_ARCH_ARM) +else ifeq ("riscv32", $(MK_ARCH)) + export HOST_ARCH=$(HOST_ARCH_RISCV32) +else ifeq ("riscv64", $(MK_ARCH)) + export HOST_ARCH=$(HOST_ARCH_RISCV64) +endif +undefine MK_ARCH + # Avoid funny character set dependencies unexport LC_ALL LC_COLLATE=C @@ -252,11 +271,17 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ else if [ -x /bin/bash ]; then echo /bin/bash; \ else echo sh; fi ; fi) +HOST_LFS_CFLAGS := $(shell getconf LFS_CFLAGS 2>/dev/null) +HOST_LFS_LDFLAGS := $(shell getconf LFS_LDFLAGS 2>/dev/null) +HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) + HOSTCC = cc HOSTCXX = c++ -HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ - $(if $(CONFIG_TOOLS_DEBUG),-g) -HOSTCXXFLAGS = -O2 +KBUILD_HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \ + $(if $(CONFIG_TOOLS_DEBUG),-g) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) +KBUILD_HOSTCXXFLAGS := -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) +KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) +KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) # With the move to GCC 6, we have implicitly upgraded our language # standard to GNU11 (see https://gcc.gnu.org/gcc-5/porting_to.html). @@ -265,11 +290,11 @@ HOSTCXXFLAGS = -O2 # these that our host tools are GNU11 (i.e. C11 w/ GNU extensions). CSTD_FLAG := -std=gnu11 ifeq ($(HOSTOS),linux) -HOSTCFLAGS += $(CSTD_FLAG) +KBUILD_HOSTCFLAGS += $(CSTD_FLAG) endif ifeq ($(HOSTOS),cygwin) -HOSTCFLAGS += -ansi +KBUILD_HOSTCFLAGS += -ansi endif # Mac OS X / Darwin's C preprocessor is Apple specific. It @@ -296,17 +321,17 @@ os_x_after = $(shell if [ $(DARWIN_MAJOR_VERSION) -ge $(1) -a \ # Snow Leopards build environment has no longer restrictions as described above HOSTCC = $(call os_x_before, 10, 5, "cc", "gcc") -HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") -HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") +KBUILD_HOSTCFLAGS += $(call os_x_before, 10, 4, "-traditional-cpp") +KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 5, "-multiply_defined suppress") # since Lion (10.7) ASLR is on by default, but we use linker generated lists # in some host tools which is a problem then ... so disable ASLR for these # tools -HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie") +KBUILD_HOSTLDFLAGS += $(call os_x_before, 10, 7, "", "-Xlinker -no_pie") # macOS Mojave (10.14.X) # Undefined symbols for architecture x86_64: "_PyArg_ParseTuple" -HOSTLDFLAGS += $(call os_x_after, 10, 14, "-lpython -dynamclib", "") +KBUILD_HOSTLDFLAGS += $(call os_x_after, 10, 14, "-lpython -dynamclib", "") endif # Decide whether to build built-in, modular, or both. @@ -346,7 +371,7 @@ define size_check limit=$$( printf "%d" $2 ); \ if test $$actual -gt $$limit; then \ echo "$1 exceeds file size limit:" >&2; \ - echo " limit: $$(printf %#x bytes $$limit) bytes" >&2; \ + echo " limit: $$(printf %#x $$limit) bytes" >&2; \ echo " actual: $$(printf %#x $$actual) bytes" >&2; \ echo " excess: $$(printf %#x $$((actual - limit))) bytes" >&2;\ exit 1; \ @@ -398,6 +423,23 @@ KBUILD_CFLAGS := -Wall -Wstrict-prototypes \ -fno-builtin -ffreestanding $(CSTD_FLAG) KBUILD_CFLAGS += -fshort-wchar -fno-strict-aliasing KBUILD_AFLAGS := -D__ASSEMBLY__ +KBUILD_LDFLAGS := + +ifeq ($(cc-name),clang) +ifneq ($(CROSS_COMPILE),) +CLANG_TARGET := --target=$(notdir $(CROSS_COMPILE:%-=%)) +GCC_TOOLCHAIN_DIR := $(dir $(shell which $(LD))) +CLANG_PREFIX := --prefix=$(GCC_TOOLCHAIN_DIR) +GCC_TOOLCHAIN := $(realpath $(GCC_TOOLCHAIN_DIR)/..) +endif +ifneq ($(GCC_TOOLCHAIN),) +CLANG_GCC_TC := --gcc-toolchain=$(GCC_TOOLCHAIN) +endif +KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) +KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC) $(CLANG_PREFIX) +KBUILD_CFLAGS += $(call cc-option, -no-integrated-as) +KBUILD_AFLAGS += $(call cc-option, -no-integrated-as) +endif # Don't generate position independent code KBUILD_CFLAGS += $(call cc-option,-fno-PIE) @@ -409,14 +451,16 @@ UBOOTVERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SU export VERSION PATCHLEVEL SUBLEVEL UBOOTRELEASE UBOOTVERSION export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR -export CONFIG_SHELL HOSTCC HOSTCFLAGS HOSTLDFLAGS CROSS_COMPILE AS LD CC -export CPP AR NM LDR STRIP OBJCOPY OBJDUMP +export CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE AS LD CC +export CPP AR NM LDR STRIP OBJCOPY OBJDUMP KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS export MAKE LEX YACC AWK PERL PYTHON PYTHON2 PYTHON3 -export HOSTCXX HOSTCXXFLAGS CHECK CHECKFLAGS DTC DTC_FLAGS +export HOSTCXX KBUILD_HOSTCXXFLAGS CHECK CHECKFLAGS DTC DTC_FLAGS -export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS LDFLAGS +export KBUILD_CPPFLAGS NOSTDINC_FLAGS UBOOTINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS export KBUILD_CFLAGS KBUILD_AFLAGS +export CC_VERSION_TEXT := $(shell $(CC) --version | head -n 1) + # When compiling out-of-tree modules, put MODVERDIR in the module # tree rather than in the kernel tree. The kernel tree might # even be read-only. @@ -464,10 +508,11 @@ endif version_h := include/generated/version_autogenerated.h timestamp_h := include/generated/timestamp_autogenerated.h defaultenv_h := include/generated/defaultenv_autogenerated.h +dt_h := include/generated/dt.h no-dot-config-targets := clean clobber mrproper distclean \ help %docs check% coccicheck \ - ubootversion backup tests check qcheck + ubootversion backup tests check qcheck tcheck config-targets := 0 mixed-targets := 0 @@ -635,6 +680,9 @@ endif KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks) +# disable stringop warnings in gcc 8+ +KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) + # change __FILE__ to the relative path from the srctree KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) @@ -653,19 +701,25 @@ endif endif KBUILD_CFLAGS += $(call cc-option,-Wno-format-nonliteral) +KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) + ifeq ($(cc-name),clang) KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,) KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier) KBUILD_CFLAGS += $(call cc-disable-warning, gnu) KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) +# Quiet clang warning: comparison of unsigned expression < 0 is always false +KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare) +# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the +# source of a reference will be _MergedGlobals and not on of the whitelisted names. +# See modpost pattern 2 +KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,) KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior) -endif +else -# turn jbsr into jsr for m68k -ifeq ($(ARCH),m68k) -ifeq ($(findstring 3.4,$(shell $(CC) --version)),3.4) -KBUILD_AFLAGS += -Wa,-gstabs,-S -endif +# These warnings generated too much noise in a regular build. +# Use make W=1 to enable them (see scripts/Makefile.extrawarn) +KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable) endif # Prohibit date/time macros, which would make the build non-deterministic @@ -681,16 +735,17 @@ KBUILD_CFLAGS += $(KCFLAGS) # Use UBOOTINCLUDE when you must reference the include/ directory. # Needed to be compatible with the O= option UBOOTINCLUDE := \ - -Iinclude \ - $(if $(KBUILD_SRC), -I$(srctree)/include) \ - $(if $(CONFIG_$(SPL_)SYS_THUMB_BUILD), \ - $(if $(CONFIG_HAS_THUMB2),, \ - -I$(srctree)/arch/$(ARCH)/thumb1/include),) \ - -I$(srctree)/arch/$(ARCH)/include \ - -include $(srctree)/include/linux/kconfig.h + -Iinclude \ + $(if $(KBUILD_SRC), -I$(srctree)/include) \ + $(if $(CONFIG_$(SPL_)SYS_THUMB_BUILD), \ + $(if $(CONFIG_HAS_THUMB2), \ + $(if $(CONFIG_CPU_V7M), \ + -I$(srctree)/arch/arm/thumb1/include), \ + -I$(srctree)/arch/arm/thumb1/include)) \ + -I$(srctree)/arch/$(ARCH)/include \ + -include $(srctree)/include/linux/kconfig.h NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) -CHECKFLAGS += $(NOSTDINC_FLAGS) # FIX ME cpp_flags := $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) $(UBOOTINCLUDE) \ @@ -712,11 +767,6 @@ libs-y += drivers/ libs-y += drivers/dma/ libs-y += drivers/gpio/ libs-y += drivers/i2c/ -libs-y += drivers/mtd/ -libs-$(CONFIG_CMD_NAND) += drivers/mtd/nand/raw/ -libs-y += drivers/mtd/onenand/ -libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/ -libs-y += drivers/mtd/spi/ libs-y += drivers/net/ libs-y += drivers/net/phy/ libs-y += drivers/power/ \ @@ -732,6 +782,7 @@ 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/ libs-y += drivers/usb/emul/ @@ -747,9 +798,12 @@ libs-y += cmd/ libs-y += common/ libs-y += env/ libs-$(CONFIG_API) += api/ -libs-$(CONFIG_HAS_POST) += post/ +ifdef CONFIG_POST +libs-y += post/ +endif libs-$(CONFIG_UNIT_TEST) += test/ test/dm/ libs-$(CONFIG_UT_ENV) += test/env/ +libs-$(CONFIG_UT_OPTEE) += test/optee/ libs-$(CONFIG_UT_OVERLAY) += test/overlay/ libs-y += $(if $(BOARDDIR),board/$(BOARDDIR)/) @@ -806,6 +860,12 @@ else SPL_SIZE_CHECK = endif +ifneq ($(CONFIG_TPL_SIZE_LIMIT),0) +TPL_SIZE_CHECK = @$(call size_check,$@,$(CONFIG_TPL_SIZE_LIMIT)) +else +TPL_SIZE_CHECK = +endif + # Statically apply RELA-style relocations (currently arm64 only) # This is useful for arm64 where static relocation needs to be performed on # the raw binary, but certain simulators only accept an ELF file (but don't @@ -859,6 +919,9 @@ ALL-$(CONFIG_EFI_STUB) += u-boot-payload.efi ifneq ($(BUILD_ROM)$(CONFIG_BUILD_ROM),) ALL-$(CONFIG_X86_RESET_VECTOR) += u-boot.rom endif +ifeq ($(CONFIG_SYS_COREBOOT)$(CONFIG_SPL),yy) +ALL-$(CONFIG_BINMAN) += u-boot-x86-with-spl.bin +endif # Build a combined spl + u-boot image for sunxi ifeq ($(CONFIG_ARCH_SUNXI)$(CONFIG_SPL),yy) @@ -866,7 +929,7 @@ ALL-y += u-boot-sunxi-with-spl.bin endif # enable combined SPL/u-boot/dtb rules for tegra -ifeq ($(CONFIG_TEGRA)$(CONFIG_SPL),yy) +ifeq ($(CONFIG_ARCH_TEGRA)$(CONFIG_SPL),yy) ALL-y += u-boot-tegra.bin u-boot-nodtb-tegra.bin ALL-$(CONFIG_OF_SEPARATE) += u-boot-dtb-tegra.bin endif @@ -878,7 +941,7 @@ ifneq ($(CONFIG_BUILD_TARGET),) ALL-y += $(CONFIG_BUILD_TARGET:"%"=%) endif -ifdef CONFIG_INIT_SP_RELATIVE +ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy) ALL-y += init_sp_bss_offset_check endif @@ -886,8 +949,8 @@ ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) ALL-y += u-boot-with-dtb.bin endif -ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL)$(CONFIG_TPL),yyy) -ALL-y += idbloader.img +ifeq ($(CONFIG_ARCH_ROCKCHIP)$(CONFIG_SPL),yy) +ALL-y += u-boot-rockchip.bin endif LDFLAGS_u-boot += $(LDFLAGS_FINAL) @@ -899,6 +962,12 @@ ifeq ($(CONFIG_ARC)$(CONFIG_NIOS2)$(CONFIG_X86)$(CONFIG_XTENSA),) LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) endif +# insure the checker run with the right endianness +CHECKFLAGS += $(if $(CONFIG_CPU_BIG_ENDIAN),-mbig-endian,-mlittle-endian) + +# the checker needs the correct machine size +CHECKFLAGS += $(if $(CONFIG_64BIT),-m64,-m32) + # Normally we fill empty space with 0xff quiet_cmd_objcopy = OBJCOPY $@ cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \ @@ -929,6 +998,9 @@ append = cat $(filter-out $< $(PHONY), $^) >> $@ quiet_cmd_pad_cat = CAT $@ cmd_pad_cat = $(cmd_objcopy) && $(append) || rm -f $@ +quiet_cmd_lzma = LZMA $@ +cmd_lzma = lzma -c -z -k -9 $< > $@ + cfg: u-boot.cfg quiet_cmd_cfgcheck = CFGCHK $2 @@ -958,7 +1030,7 @@ ifneq ($(CONFIG_DM_MMC)$(CONFIG_OF_CONTROL)$(CONFIG_BLK),yyy) @echo >&2 "This board does not use CONFIG_DM_MMC. Please update" @echo >&2 "the board to use CONFIG_DM_MMC before the v2019.04 release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif endif @@ -968,7 +1040,7 @@ ifneq ($(CONFIG_DM_USB)$(CONFIG_OF_CONTROL)$(CONFIG_BLK),yyy) @echo >&2 "This board does not use CONFIG_DM_USB. Please update" @echo >&2 "the board to use CONFIG_DM_USB before the v2019.07 release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif endif @@ -979,7 +1051,7 @@ ifeq ($(CONFIG_MVSATA_IDE),y) @echo >&2 "controller driver to use CONFIG_AHCI before the v2019.07" @echo >&2 "release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif ifeq ($(CONFIG_LIBATA),y) @@ -989,7 +1061,7 @@ ifneq ($(CONFIG_AHCI),y) @echo >&2 "enabled. Please update the storage controller driver to use" @echo >&2 "CONFIG_AHCI before the v2019.07 release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif endif @@ -999,7 +1071,7 @@ ifneq ($(CONFIG_DM_PCI),y) @echo >&2 "This board does not use CONFIG_DM_PCI Please update" @echo >&2 "the board to use CONFIG_DM_PCI before the v2019.07 release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif endif @@ -1009,7 +1081,7 @@ ifneq ($(CONFIG_DM_VIDEO),y) @echo >&2 "This board does not use CONFIG_DM_VIDEO Please update" @echo >&2 "the board to use CONFIG_DM_VIDEO before the v2019.07 release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif endif @@ -1027,7 +1099,7 @@ ifneq ($(CONFIG_DM_SPI_FLASH)$(CONFIG_OF_CONTROL),yy) @echo >&2 "This board does not use CONFIG_DM_SPI_FLASH. Please update" @echo >&2 "the board to use CONFIG_SPI_FLASH before the v2019.07 release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif endif @@ -1038,7 +1110,7 @@ ifneq ($(CONFIG_WDT),y) @echo >&2 "Please update the board to use CONFIG_WDT before the" @echo >&2 "v2019.10 release." @echo >&2 "Failure to update by the deadline may result in board removal." - @echo >&2 "See doc/driver-model/MIGRATION.txt for more info." + @echo >&2 "See doc/driver-model/migration.rst for more info." @echo >&2 "====================================================" endif endif @@ -1119,7 +1191,15 @@ u-boot.bin: u-boot-nodtb.bin FORCE $(call if_changed,copy) endif -%.imx: %.bin +# we call Makefile in arch/arm/mach-imx which +# has targets which are dependent on targets defined +# here. make could not resolve them and we must ensure +# that they are finished before calling imx targets +ifeq ($(CONFIG_MULTI_DTB_FIT),y) +IMX_DEPS = u-boot-fit-dtb.bin +endif + +%.imx: $(IMX_DEPS) %.bin $(Q)$(MAKE) $(build)=arch/arm/mach-imx $@ $(BOARD_SIZE_CHECK) @@ -1175,7 +1255,7 @@ binary_size_check: u-boot-nodtb.bin FORCE fi \ fi -ifdef CONFIG_INIT_SP_RELATIVE +ifeq ($(CONFIG_INIT_SP_RELATIVE)$(CONFIG_OF_SEPARATE),yy) ifneq ($(CONFIG_SYS_MALLOC_F_LEN),) subtract_sys_malloc_f_len = space=$$(($${space} - $(CONFIG_SYS_MALLOC_F_LEN))) else @@ -1235,13 +1315,15 @@ u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE # from the SPL U-Boot version. # ifndef CONFIG_SYS_UBOOT_START -CONFIG_SYS_UBOOT_START := 0 +CONFIG_SYS_UBOOT_START := $(CONFIG_SYS_TEXT_BASE) endif # Boards with more complex image requirements can provide an .its source file # or a generator script ifneq ($(CONFIG_SPL_FIT_SOURCE),"") -U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) +U_BOOT_ITS := u-boot.its +$(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) + $(call if_changed,copy) else ifneq ($(CONFIG_SPL_FIT_GENERATOR),"") U_BOOT_ITS := u-boot.its @@ -1262,7 +1344,8 @@ MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_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 ",,$(CONFIG_OF_LIST))) + $(patsubst %,-b arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) \ + $(patsubst %,-b arch/$(ARCH)/dts/%.dtbo,$(subst ",,$(CONFIG_OF_OVERLAY_LIST))) else MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ @@ -1271,7 +1354,6 @@ MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log -CLEAN_FILES += u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log endif MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img) @@ -1303,6 +1385,16 @@ else UBOOT_BIN := u-boot.bin endif +MKIMAGEFLAGS_u-boot-lzma.img = -A $(ARCH) -T standalone -C lzma -O u-boot \ + -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \ + -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" + +u-boot.bin.lzma: u-boot.bin FORCE + $(call if_changed,lzma) + +u-boot-lzma.img: u-boot.bin.lzma FORCE + $(call if_changed,mkimage) + 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),dts/dt.dtb) \ @@ -1345,13 +1437,32 @@ u-boot-with-spl.bin: $(SPL_IMAGE) $(SPL_PAYLOAD) FORCE $(call if_changed,pad_cat) ifeq ($(CONFIG_ARCH_ROCKCHIP),y) -MKIMAGEFLAGS_u-boot-tpl.img = -n $(CONFIG_SYS_SOC) -T rksd -tpl/u-boot-tpl.img: tpl/u-boot-tpl.bin FORCE + +# TPL + SPL +ifeq ($(CONFIG_SPL)$(CONFIG_TPL),yy) +MKIMAGEFLAGS_u-boot-tpl-rockchip.bin = -n $(CONFIG_SYS_SOC) -T rksd +tpl/u-boot-tpl-rockchip.bin: tpl/u-boot-tpl.bin FORCE $(call if_changed,mkimage) -idbloader.img: tpl/u-boot-tpl.img spl/u-boot-spl.bin FORCE +idbloader.img: tpl/u-boot-tpl-rockchip.bin spl/u-boot-spl.bin FORCE $(call if_changed,cat) +else +MKIMAGEFLAGS_idbloader.img = -n $(CONFIG_SYS_SOC) -T rksd +idbloader.img: spl/u-boot-spl.bin FORCE + $(call if_changed,mkimage) endif +ifeq ($(CONFIG_ARM64),) +u-boot-rockchip.bin: idbloader.img u-boot.img FORCE + $(call if_changed,binman) +else +OBJCOPYFLAGS_u-boot-rockchip.bin = -I binary -O binary \ + --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff +u-boot-rockchip.bin: idbloader.img u-boot.itb FORCE + $(call if_changed,pad_cat) +endif # CONFIG_ARM64 + +endif # CONFIG_ARCH_ROCKCHIP + ifeq ($(CONFIG_ARCH_LPC32XX)$(CONFIG_SPL),yy) MKIMAGEFLAGS_lpc32xx-spl.img = -T lpc32xximage -a $(CONFIG_SPL_TEXT_BASE) @@ -1371,7 +1482,6 @@ lpc32xx-boot-1.bin: lpc32xx-spl.img FORCE lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img FORCE $(call if_changed,cat) -CLEAN_FILES += lpc32xx-* endif OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \ @@ -1441,6 +1551,17 @@ cmd_socboot = cat spl/u-boot-spl.sfp spl/u-boot-spl.sfp \ u-boot.img > $@ || rm -f $@ u-boot-with-spl.sfp: spl/u-boot-spl.sfp u-boot.img FORCE $(call if_changed,socboot) + +quiet_cmd_socnandboot = SOCNANDBOOT $@ +cmd_socnandboot = dd if=/dev/zero of=spl/u-boot-spl.pad bs=64 count=1024 ; \ + cat spl/u-boot-spl.sfp spl/u-boot-spl.pad \ + spl/u-boot-spl.sfp spl/u-boot-spl.pad \ + spl/u-boot-spl.sfp spl/u-boot-spl.pad \ + spl/u-boot-spl.sfp spl/u-boot-spl.pad \ + u-boot.img > $@ || rm -f $@ spl/u-boot-spl.pad +u-boot-with-nand-spl.sfp: spl/u-boot-spl.sfp u-boot.img FORCE + $(call if_changed,socnandboot) + endif ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy) @@ -1494,7 +1615,10 @@ u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.itb FORCE endif endif -ifneq ($(CONFIG_TEGRA),) +u-boot-x86-with-spl.bin: spl/u-boot-spl.bin u-boot.bin FORCE + $(call if_changed,binman) + +ifneq ($(CONFIG_ARCH_TEGRA),) ifneq ($(CONFIG_BINMAN),) # Makes u-boot-dtb-tegra.bin u-boot-tegra.bin u-boot-nodtb-tegra.bin %-dtb-tegra.bin %-tegra.bin %-nodtb-tegra.bin: \ @@ -1578,18 +1702,17 @@ OBJCOPYFLAGS_u-boot-img-spl-at-end.bin := -I binary -O binary \ u-boot-img-spl-at-end.bin: u-boot.img spl/u-boot-spl.bin FORCE $(call if_changed,pad_cat) -# Create a new ELF from a raw binary file. -ifndef PLATFORM_ELFENTRY - PLATFORM_ELFENTRY = "_start" -endif quiet_cmd_u-boot-elf ?= LD $@ cmd_u-boot-elf ?= $(LD) u-boot-elf.o -o $@ \ - --defsym=$(PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \ + -T u-boot-elf.lds --defsym=$(CONFIG_PLATFORM_ELFENTRY)=$(CONFIG_SYS_TEXT_BASE) \ -Ttext=$(CONFIG_SYS_TEXT_BASE) -u-boot.elf: u-boot.bin +u-boot.elf: u-boot.bin u-boot-elf.lds $(Q)$(OBJCOPY) -I binary $(PLATFORM_ELFFLAGS) $< u-boot-elf.o $(call if_changed,u-boot-elf) +u-boot-elf.lds: arch/u-boot-elf.lds prepare FORCE + $(call if_changed_dep,cpp_lds) + # MediaTek's ARM-based u-boot needs a header to contains its load address # which is parsed by the BootROM. # If the SPL build is enabled, the header will be added to the spl binary, @@ -1615,7 +1738,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(ARCH)/Makefile.postlink) # Rule to link u-boot # May be overridden by arch/$(ARCH)/config.mk quiet_cmd_u-boot__ ?= LD $@ - cmd_u-boot__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ + cmd_u-boot__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_u-boot) -o $@ \ -T u-boot.lds $(u-boot-init) \ --start-group $(u-boot-main) --end-group \ $(PLATFORM_LIBS) -Map u-boot.map; \ @@ -1648,7 +1771,7 @@ u-boot.sym: u-boot FORCE # make sure no implicit rule kicks in $(sort $(u-boot-init) $(u-boot-main)): $(u-boot-dirs) ; -# Handle descending into subdirectories listed in $(vmlinux-dirs) +# Handle descending into subdirectories listed in $(u-boot-dirs) # Preset locale variables to speed up the build process. Limit locale # tweaks to this spot to avoid wrong language settings when running # make menuconfig etc. @@ -1699,7 +1822,7 @@ endif # prepare2 creates a makefile if using a separate output directory prepare2: prepare3 outputmakefile cfg -prepare1: prepare2 $(version_h) $(timestamp_h) \ +prepare1: prepare2 $(version_h) $(timestamp_h) $(dt_h) \ include/config/auto.conf ifeq ($(wildcard $(LDSCRIPT)),) @echo >&2 " Could not find linker script." @@ -1761,16 +1884,27 @@ define filechk_defaultenv.h (grep -v '^#' | \ grep -v '^$$' | \ tr '\n' '\0' | \ - sed -e 's/\\\x0/\n/g' | \ + sed -e 's/\\\x0\s*//g' | \ xxd -i ; echo ", 0x00" ; ) endef +define filechk_dt.h + (if test -n "$${DEVICE_TREE}"; then \ + echo \#define DEVICE_TREE \"$(DEVICE_TREE)\"; \ + else \ + echo \#define DEVICE_TREE CONFIG_DEFAULT_DEVICE_TREE; \ + fi) +endef + $(version_h): include/config/uboot.release FORCE $(call filechk,version.h) $(timestamp_h): $(srctree)/Makefile FORCE $(call filechk,timestamp.h) +$(dt_h): $(srctree)/Makefile FORCE + $(call filechk,dt.h) + $(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE $(call filechk,defaultenv.h) @@ -1806,6 +1940,7 @@ spl/boot.bin: spl/u-boot-spl tpl/u-boot-tpl.bin: tools prepare \ $(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) $(Q)$(MAKE) obj=tpl -f $(srctree)/scripts/Makefile.spl all + $(TPL_SIZE_CHECK) TAG_SUBDIRS := $(patsubst %,$(srctree)/%,$(u-boot-dirs) include) @@ -1849,6 +1984,7 @@ checkarmreloc: u-boot fi tools/version.h: include/version.h + $(Q)mkdir -p $(dir $@) $(call if_changed,copy) envtools: scripts_basic $(version_h) $(timestamp_h) tools/version.h @@ -1884,7 +2020,10 @@ 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* + boot* 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 # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config include/generated spl tpl \ @@ -1914,12 +2053,12 @@ clean: $(clean-dirs) -o -name '*.ko.*' -o -name '*.su' -o -name '*.pyc' \ -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.lex.c' -o -name '*.tab.[ch]' \ + -o -name '*.asn1.[ch]' \ -o -name '*.symtypes' -o -name 'modules.order' \ -o -name modules.builtin -o -name '.tmp_*.o.*' \ -o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \ -o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \ - -type f -print | xargs rm -f \ - bl31.c bl31.elf bl31_*.bin image.map tispl.bin* + -type f -print | xargs rm -f # mrproper - Delete all generated files, including .config # @@ -1966,6 +2105,7 @@ help: @echo '' @echo ' check - Run all automated tests that use sandbox' @echo ' qcheck - Run quick automated tests that use sandbox' + @echo ' tcheck - Run quick automated tests on tools' @echo '' @echo 'Other generic targets:' @echo ' all - Build all necessary images depending on configuration' @@ -2011,6 +2151,9 @@ tests check: qcheck: $(srctree)/test/run quick +tcheck: + $(srctree)/test/run tools + # Documentation targets # --------------------------------------------------------------------------- DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \ @@ -2109,8 +2252,7 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files)) # read all saved command lines -targets := $(wildcard $(sort $(targets))) -cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) +cmd_files := $(wildcard .*.cmd $(foreach f,$(sort $(targets)),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) $(cmd_files): ; # Do not try to update included dependency files @@ -2122,6 +2264,6 @@ endif # skip-makefile PHONY += FORCE FORCE: -# Declare the contents of the .PHONY variable as phony. We keep that +# Declare the contents of the PHONY variable as phony. We keep that # information in a variable so we can use it in if_changed and friends. .PHONY: $(PHONY)