summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile103
1 files changed, 62 insertions, 41 deletions
diff --git a/Makefile b/Makefile
index dde5ed3141..67bfec4475 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-VERSION = 2021
-PATCHLEVEL = 10
+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
@@ -247,7 +254,7 @@ version_h := include/generated/version.h
clean-targets := %clean mrproper cleandocs
no-dot-config-targets := $(clean-targets) \
cscope gtags TAGS tags help% %docs \
- $(version_h) kernelversion outputmakefile
+ $(version_h) bareboxversion outputmakefile
no-sync-config-targets := $(no-dot-config-targets) install %install \
kernelrelease
@@ -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)
@@ -431,8 +440,9 @@ USERINCLUDE := \
# Use LINUXINCLUDE when you must reference the include/ directory.
# Needed to be compatible with the O= option
-LINUXINCLUDE := -Iinclude -I$(srctree)/dts/include \
+LINUXINCLUDE := -Iinclude \
$(if $(building_out_of_srctree), -I$(srctree)/include) \
+ -I$(srctree)/dts/include \
-I$(srctree)/arch/$(SRCARCH)/include \
-I$(objtree)/arch/$(SRCARCH)/include \
$(USERINCLUDE)
@@ -440,9 +450,9 @@ LINUXINCLUDE := -Iinclude -I$(srctree)/dts/include \
KBUILD_CPPFLAGS := -D__KERNEL__ -D__BAREBOX__ $(LINUXINCLUDE) -fno-builtin -ffreestanding
KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
- -fno-strict-aliasing -fno-common \
+ -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 :=
@@ -452,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
@@ -580,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
@@ -632,8 +652,12 @@ endif # need-config
KBUILD_CFLAGS += -ggdb3
-# Force gcc to behave correct even for buggy distributions
-KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
+ifdef CONFIG_FRAME_POINTER
+KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
+KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
+endif
+
+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)
@@ -653,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
@@ -675,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
@@ -704,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
@@ -908,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__)
@@ -956,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
@@ -1125,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 \
@@ -1272,6 +1290,9 @@ docs: FORCE
@$(SPHINXBUILD) -b html -d $(objtree)/doctrees $(srctree)/Documentation \
$(objtree)/Documentation/html
+bareboxversion:
+ @echo $(KERNELVERSION)
+
# Single targets
# ---------------------------------------------------------------------------
# Single targets are compatible with: