Skip to content

Commit 2d00aee

Browse files
committed
Merge tag 'kbuild-fixes-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild fixes from Masahiro Yamada: - remove unneeded ar-option and KBUILD_ARFLAGS - remove long-deprecated SUBDIRS - fix modpost to suppress false-positive warnings for UML builds - fix namespace.pl to handle relative paths to ${objtree}, ${srctree} - make setlocalversion work for /bin/sh - make header archive reproducible - fix some Makefiles and documents * tag 'kbuild-fixes-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kheaders: make headers archive reproducible kbuild: update compile-test header list for v5.4-rc2 kbuild: two minor updates for Documentation/kbuild/modules.rst scripts/setlocalversion: clear local variable to make it work for sh namespace: fix namespace.pl script to support relative paths video/logo: do not generate unneeded logo C files video/logo: remove unneeded *.o pattern from clean-files integrity: remove pointless subdir-$(CONFIG_...) integrity: remove unneeded, broken attempt to add -fshort-wchar modpost: fix static EXPORT_SYMBOL warnings for UML build kbuild: correct formatting of header in kbuild module docs kbuild: remove SUBDIRS support kbuild: remove ar-option and KBUILD_ARFLAGS
2 parents 126195c + 86cdd2f commit 2d00aee

File tree

15 files changed

+41
-86
lines changed

15 files changed

+41
-86
lines changed

Documentation/kbuild/makefiles.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -954,11 +954,6 @@ When kbuild executes, the following steps are followed (roughly):
954954

955955
From commandline LDFLAGS_MODULE shall be used (see kbuild.txt).
956956

957-
KBUILD_ARFLAGS Options for $(AR) when creating archives
958-
959-
$(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
960-
mode) if this option is supported by $(AR).
961-
962957
KBUILD_LDS
963958

964959
The linker script with full path. Assigned by the top-level Makefile.

Documentation/kbuild/modules.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,11 @@ build.
498498
will be written containing all exported symbols that were not
499499
defined in the kernel.
500500

501-
--- 6.3 Symbols From Another External Module
501+
6.3 Symbols From Another External Module
502+
----------------------------------------
502503

503504
Sometimes, an external module uses exported symbols from
504-
another external module. kbuild needs to have full knowledge of
505+
another external module. Kbuild needs to have full knowledge of
505506
all symbols to avoid spitting out warnings about undefined
506507
symbols. Three solutions exist for this situation.
507508

@@ -521,7 +522,7 @@ build.
521522
The top-level kbuild file would then look like::
522523

523524
#./Kbuild (or ./Makefile):
524-
obj-y := foo/ bar/
525+
obj-m := foo/ bar/
525526

526527
And executing::
527528

Documentation/kbuild/reproducible-builds.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,21 @@ the kernel may be unreproducible, and how to avoid them.
1616
Timestamps
1717
----------
1818

19-
The kernel embeds a timestamp in two places:
19+
The kernel embeds timestamps in three places:
2020

2121
* The version string exposed by ``uname()`` and included in
2222
``/proc/version``
2323

2424
* File timestamps in the embedded initramfs
2525

26-
By default the timestamp is the current time. This must be overridden
27-
using the `KBUILD_BUILD_TIMESTAMP`_ variable. If you are building
28-
from a git commit, you could use its commit date.
26+
* If enabled via ``CONFIG_IKHEADERS``, file timestamps of kernel
27+
headers embedded in the kernel or respective module,
28+
exposed via ``/sys/kernel/kheaders.tar.xz``
29+
30+
By default the timestamp is the current time and in the case of
31+
``kheaders`` the various files' modification times. This must
32+
be overridden using the `KBUILD_BUILD_TIMESTAMP`_ variable.
33+
If you are building from a git commit, you could use its commit date.
2934

3035
The kernel does *not* use the ``__DATE__`` and ``__TIME__`` macros,
3136
and enables warnings if they are used. If you incorporate external

Makefile

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -206,24 +206,8 @@ ifndef KBUILD_CHECKSRC
206206
KBUILD_CHECKSRC = 0
207207
endif
208208

209-
# Use make M=dir to specify directory of external module to build
210-
# Old syntax make ... SUBDIRS=$PWD is still supported
211-
# Setting the environment variable KBUILD_EXTMOD take precedence
212-
ifdef SUBDIRS
213-
$(warning ================= WARNING ================)
214-
$(warning 'SUBDIRS' will be removed after Linux 5.3)
215-
$(warning )
216-
$(warning If you are building an individual subdirectory)
217-
$(warning in the kernel tree, you can do like this:)
218-
$(warning $$ make path/to/dir/you/want/to/build/)
219-
$(warning (Do not forget the trailing slash))
220-
$(warning )
221-
$(warning If you are building an external module,)
222-
$(warning Please use 'M=' or 'KBUILD_EXTMOD' instead)
223-
$(warning ==========================================)
224-
KBUILD_EXTMOD ?= $(SUBDIRS)
225-
endif
226-
209+
# Use make M=dir or set the environment variable KBUILD_EXTMOD to specify the
210+
# directory of external module to build. Setting M= takes precedence.
227211
ifeq ("$(origin M)", "command line")
228212
KBUILD_EXTMOD := $(M)
229213
endif
@@ -498,7 +482,6 @@ export CFLAGS_KASAN CFLAGS_KASAN_NOSANITIZE CFLAGS_UBSAN
498482
export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
499483
export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE
500484
export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL
501-
export KBUILD_ARFLAGS
502485

503486
# Files to ignore in find ... statements
504487

@@ -914,9 +897,6 @@ ifdef CONFIG_RETPOLINE
914897
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
915898
endif
916899

917-
# use the deterministic mode of AR if available
918-
KBUILD_ARFLAGS := $(call ar-option,D)
919-
920900
include scripts/Makefile.kasan
921901
include scripts/Makefile.extrawarn
922902
include scripts/Makefile.ubsan

arch/powerpc/boot/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ endif
5050

5151
BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -nostdinc
5252

53-
BOOTARFLAGS := -cr$(KBUILD_ARFLAGS)
53+
BOOTARFLAGS := -crD
5454

5555
ifdef CONFIG_CC_IS_CLANG
5656
BOOTCFLAGS += $(CLANG_FLAGS)

drivers/video/logo/Makefile

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,6 @@ obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o
1818

1919
# How to generate logo's
2020

21-
# Use logo-cfiles to retrieve list of .c files to be built
22-
logo-cfiles = $(notdir $(patsubst %.$(2), %.c, \
23-
$(wildcard $(srctree)/$(src)/*$(1).$(2))))
24-
25-
26-
# Mono logos
27-
extra-y += $(call logo-cfiles,_mono,pbm)
28-
29-
# VGA16 logos
30-
extra-y += $(call logo-cfiles,_vga16,ppm)
31-
32-
# 224 Logos
33-
extra-y += $(call logo-cfiles,_clut224,ppm)
34-
35-
# Gray 256
36-
extra-y += $(call logo-cfiles,_gray256,pgm)
37-
3821
pnmtologo := scripts/pnmtologo
3922

4023
# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
@@ -55,5 +38,5 @@ $(obj)/%_clut224.c: $(src)/%_clut224.ppm $(pnmtologo) FORCE
5538
$(obj)/%_gray256.c: $(src)/%_gray256.pgm $(pnmtologo) FORCE
5639
$(call if_changed,logo)
5740

58-
# Files generated that shall be removed upon make clean
59-
clean-files := *.o *_mono.c *_vga16.c *_clut224.c *_gray256.c
41+
# generated C files
42+
targets += *_mono.c *_vga16.c *_clut224.c *_gray256.c

kernel/gen_kheaders.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
7171
find $cpio_dir -type f -print0 |
7272
xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'
7373

74-
tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null
74+
# Create archive and try to normalize metadata for reproducibility
75+
tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
76+
--owner=0 --group=0 --sort=name --numeric-owner \
77+
-Jcf $tarfile -C $cpio_dir/ . > /dev/null
7578

7679
echo "$src_files_md5" > kernel/kheaders.md5
7780
echo "$obj_files_md5" >> kernel/kheaders.md5

scripts/Kbuild.include

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,6 @@ cc-ifversion = $(shell [ $(CONFIG_GCC_VERSION)0 $(1) $(2)000 ] && echo $(3) || e
143143
# Usage: KBUILD_LDFLAGS += $(call ld-option, -X, -Y)
144144
ld-option = $(call try-run, $(LD) $(KBUILD_LDFLAGS) $(1) -v,$(1),$(2),$(3))
145145

146-
# ar-option
147-
# Usage: KBUILD_ARFLAGS := $(call ar-option,D)
148-
# Important: no spaces around options
149-
ar-option = $(call try-run, $(AR) rc$(1) "$$TMP",$(1),$(2))
150-
151146
# ld-version
152147
# Note this is mainly for HJ Lu's 3 number binutil versions
153148
ld-version = $(shell $(LD) --version | $(srctree)/scripts/ld-version.sh)

scripts/Makefile.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
389389
ifdef builtin-target
390390

391391
quiet_cmd_ar_builtin = AR $@
392-
cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
392+
cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)
393393

394394
$(builtin-target): $(real-obj-y) FORCE
395395
$(call if_changed,ar_builtin)

scripts/Makefile.lib

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ quiet_cmd_ld = LD $@
232232
# ---------------------------------------------------------------------------
233233

234234
quiet_cmd_ar = AR $@
235-
cmd_ar = rm -f $@; $(AR) rcsTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
235+
cmd_ar = rm -f $@; $(AR) cDPrsT $@ $(real-prereqs)
236236

237237
# Objcopy
238238
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)