diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 88 |
1 files changed, 50 insertions, 38 deletions
@@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -VERSION = 2022 -PATCHLEVEL = 06 +VERSION = 2024 +PATCHLEVEL = 03 SUBLEVEL = 0 EXTRAVERSION = NAME = None @@ -90,9 +90,16 @@ endif # If the user is running make -s (silent mode), suppress echoing of # commands +# make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS. -ifneq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) - quiet=silent_ +ifeq ($(filter 3.%,$(MAKE_VERSION)),) +silence:=$(findstring s,$(firstword -$(MAKEFLAGS))) +else +silence:=$(findstring s,$(filter-out --%,$(MAKEFLAGS))) +endif + +ifeq ($(silence),s) +quiet=silent_ endif export quiet Q KBUILD_VERBOSE @@ -362,9 +369,10 @@ endif KCONFIG_CONFIG ?= .config +PKG_CONFIG ?= pkg-config CROSS_PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config -export KCONFIG_CONFIG +export KCONFIG_CONFIG CROSS_PKG_CONFIG PKG_CONFIG # SHELL used by kbuild CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ @@ -378,11 +386,12 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null) HOSTCC = gcc HOSTCXX = g++ -export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ - -O2 -fomit-frame-pointer -std=gnu89 -export KBUILD_USERLDFLAGS := +KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \ + -O2 -fomit-frame-pointer -std=gnu11 +KBUILD_USERCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS) +KBUILD_USERLDFLAGS := $(USERLDFLAGS) -KBUILD_HOSTCFLAGS := $(KBUILD_USERCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) +KBUILD_HOSTCFLAGS := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS) KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) KBUILD_HOSTLDFLAGS := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) @@ -443,7 +452,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__BAREBOX__ $(LINUXINCLUDE) -fno-builti KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common -fshort-wchar \ -Werror=implicit-function-declaration -Werror=implicit-int \ - -Os -pipe -Wmissing-prototypes -std=gnu89 + -Os -pipe -Wmissing-prototypes -std=gnu11 KBUILD_AFLAGS := -D__ASSEMBLY__ KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := @@ -453,22 +462,29 @@ KBUILD_CFLAGS_MODULE := -DMODULE LDFLAGS_barebox := -Map barebox.map # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards. -LDFLAGS_barebox += $(call ld-option, --no-dynamic-linker) -LDFLAGS_pbl += $(call ld-option, --no-dynamic-linker) +LDFLAGS_common += $(call ld-option, --no-dynamic-linker) +# Avoid 'missing .note.GNU-stack section implies executable stack' warnings on binutils 2.39+ +LDFLAGS_common += -z noexecstack +# Avoid '... has a LOAD segment with RWX permissions' warnings on binutils 2.39+ +LDFLAGS_common += $(call ld-option,--no-warn-rwx-segments) + +LDFLAGS_barebox += $(LDFLAGS_common) +LDFLAGS_pbl += $(LDFLAGS_common) +LDFLAGS_elf += $(LDFLAGS_common) --nmagic -s export ARCH SRCARCH CONFIG_SHELL BASH HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL PYTHON3 UTS_MACHINE export LEX YACC export HOSTCXX CHECK CHECKFLAGS export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE +export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL -export LDFLAGS_barebox -export LDFLAGS_pbl +export LDFLAGS_barebox LDFLAGS_pbl LDFLAGS_elf export CFLAGS_UBSAN export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE @@ -581,10 +597,13 @@ endif include $(srctree)/scripts/Makefile.lib # Objects we will link into barebox / subdirs we need to visit -common-y := common/ drivers/ commands/ lib/ crypto/ net/ fs/ firmware/ test/ +common-y := common/ drivers/ commands/ lib/ crypto/ net/ fs/ firmware/ include $(srctree)/arch/$(SRCARCH)/Makefile +common-$(CONFIG_EFI) += efi/ +common-y += test/ + ifdef need-config ifdef may-sync-config # Read in dependencies to all Kconfig* files, make sure to run syncconfig if @@ -638,8 +657,7 @@ KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) endif -# Force gcc to behave correct even for buggy distributions -KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector) +KBUILD_CFLAGS-$(CONFIG_WERROR) += -Werror # This warning generated too much noise in a regular build. # Use make W=1 to enable this warning (see scripts/Makefile.build) @@ -659,6 +677,10 @@ KBUILD_CFLAGS += $(call cc-option,-fno-stack-check) # Platforms that have their setjmp appropriately implemented may override this KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) +# We don't have the necessary infrastructure to benefit from ARMv8.3+ pointer +# authentication. On older CPUs, they are interpreted as NOPs bloating the code +KBUILD_CFLAGS += $(call cc-option,-mbranch-protection=none) + KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member) # Align the bit size of userspace programs with the kernel @@ -681,6 +703,8 @@ KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) # change __FILE__ to the relative path from the srctree KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) +KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) + include-y +=scripts/Makefile.ubsan include-$(CONFIG_KASAN) += scripts/Makefile.kasan @@ -710,7 +734,11 @@ images: barebox.bin FORCE images/%.s: barebox.bin FORCE $(Q)$(MAKE) $(build)=images $@ -ifdef CONFIG_PBL_IMAGE +ifdef CONFIG_EFI_STUB +all: barebox.bin images barebox.efi +barebox.efi: FORCE + $(Q)ln -fsn images/barebox-dt-2nd.img $@ +else ifdef CONFIG_PBL_IMAGE all: barebox.bin images else all: barebox-flash-image barebox-flash-images @@ -914,22 +942,6 @@ endif PHONY += install -# By default the uImage load address is 2MB below CONFIG_TEXT_BASE, -# leaving space for the compressed PBL image at 1MB below CONFIG_TEXT_BASE. -UIMAGE_BASE ?= $(shell printf "0x%08x" $$(($(CONFIG_TEXT_BASE) - 0x200000))) - -# For development provide a target which makes barebox loadable by an -# unmodified u-boot -quiet_cmd_barebox_mkimage = MKIMAGE $@ - cmd_barebox_mkimage = $(srctree)/scripts/mkimage -A $(SRCARCH) -T firmware -C none \ - -O barebox -a $(UIMAGE_BASE) -e $(UIMAGE_BASE) \ - -n "barebox $(KERNELRELEASE)" -d $< $@ - -# barebox.uimage is build from the raw barebox binary, without any other -# headers. -barebox.uimage: $(KBUILD_BINARY) FORCE - $(call if_changed,barebox_mkimage) - # barebox image barebox: $(BAREBOX_LDS) $(BAREBOX_OBJS) $(kallsyms.o) FORCE $(call if_changed_rule,barebox__) @@ -962,7 +974,7 @@ include/config/kernel.release: FORCE # Carefully list dependencies so we do not try to build scripts twice # in parallel PHONY += scripts -scripts: scripts_basic +scripts: scripts_basic include/generated/utsrelease.h $(Q)$(MAKE) $(build)=$(@) # Things we need to do before we recursively start building the kernel @@ -1131,12 +1143,12 @@ endif # CONFIG_MODULES # Directories & files removed with 'make clean' CLEAN_DIRS += $(MODVERDIR) -CLEAN_FILES += barebox System.map stickypage.bin include/generated/barebox_default_env.h \ +CLEAN_FILES += barebox System.map include/generated/barebox_default_env.h \ .tmp_version .tmp_barebox* barebox.bin barebox.map \ .tmp_kallsyms* barebox.ldr compile_commands.json \ barebox-flash-image \ - barebox.srec barebox.s5p barebox.ubl barebox.zynq \ - barebox.uimage barebox.spi barebox.kwb barebox.kwbuart \ + barebox.srec barebox.s5p barebox.ubl \ + barebox.uimage \ barebox.efi barebox.canon-a1100.bin CLEAN_FILES += scripts/bareboxenv-target scripts/kernel-install-target \ |