mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
Merge tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild updates from Masahiro Yamada: - Remove potentially incomplete targets when Kbuid is interrupted by SIGINT etc in case GNU Make may miss to do that when stderr is piped to another program. - Rewrite the single target build so it works more correctly. - Fix rpm-pkg builds with V=1. - List top-level subdirectories in ./Kbuild. - Ignore auto-generated __kstrtab_* and __kstrtabns_* symbols in kallsyms. - Avoid two different modules in lib/zstd/ having shared code, which potentially causes building the common code as build-in and modular back-and-forth. - Unify two modpost invocations to optimize the build process. - Remove head-y syntax in favor of linker scripts for placing particular sections in the head of vmlinux. - Bump the minimal GNU Make version to 3.82. - Clean up misc Makefiles and scripts. * tag 'kbuild-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (41 commits) docs: bump minimal GNU Make version to 3.82 ia64: simplify esi object addition in Makefile Revert "kbuild: Check if linker supports the -X option" kbuild: rebuild .vmlinux.export.o when its prerequisite is updated kbuild: move modules.builtin(.modinfo) rules to Makefile.vmlinux_o zstd: Fixing mixed module-builtin objects kallsyms: ignore __kstrtab_* and __kstrtabns_* symbols kallsyms: take the input file instead of reading stdin kallsyms: drop duplicated ignore patterns from kallsyms.c kbuild: reuse mksysmap output for kallsyms mksysmap: update comment about __crc_* kbuild: remove head-y syntax kbuild: use obj-y instead extra-y for objects placed at the head kbuild: hide error checker logs for V=1 builds kbuild: re-run modpost when it is updated kbuild: unify two modpost invocations kbuild: move vmlinux.o rule to the top Makefile kbuild: move .vmlinux.objs rule to Makefile.modpost kbuild: list sub-directories in ./Kbuild Makefile.compiler: replace cc-ifversion with compiler-specific macros ...
This commit is contained in:
2
init/.gitignore
vendored
Normal file
2
init/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
/utsversion-tmp.h
|
||||
@@ -19,20 +19,43 @@ mounts-y := do_mounts.o
|
||||
mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
|
||||
mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
|
||||
|
||||
# dependencies on generated files need to be listed explicitly
|
||||
$(obj)/version.o: include/generated/compile.h
|
||||
#
|
||||
# UTS_VERSION
|
||||
#
|
||||
|
||||
# compile.h changes depending on hostname, generation number, etc,
|
||||
# so we regenerate it always.
|
||||
# mkcompile_h will make sure to only update the
|
||||
# actual file if its content has changed.
|
||||
smp-flag-$(CONFIG_SMP) := SMP
|
||||
preempt-flag-$(CONFIG_PREEMPT_BUILD) := PREEMPT
|
||||
preempt-flag-$(CONFIG_PREEMPT_DYNAMIC) := PREEMPT_DYNAMIC
|
||||
preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT
|
||||
|
||||
quiet_cmd_compile.h = CHK $@
|
||||
cmd_compile.h = \
|
||||
$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
|
||||
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)" \
|
||||
"$(CONFIG_PREEMPT_DYNAMIC)" "$(CONFIG_PREEMPT_RT)" \
|
||||
"$(CONFIG_CC_VERSION_TEXT)" "$(LD)"
|
||||
build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto))
|
||||
build-timestamp = $(or $(KBUILD_BUILD_TIMESTAMP), $(build-timestamp-auto))
|
||||
|
||||
include/generated/compile.h: FORCE
|
||||
$(call cmd,compile.h)
|
||||
# Maximum length of UTS_VERSION is 64 chars
|
||||
filechk_uts_version = \
|
||||
utsver=$$(echo '$(pound)'"$(build-version)" $(smp-flag-y) $(preempt-flag-y) "$(build-timestamp)" | cut -b -64); \
|
||||
echo '$(pound)'define UTS_VERSION \""$${utsver}"\"
|
||||
|
||||
#
|
||||
# Build version.c with temporary UTS_VERSION
|
||||
#
|
||||
|
||||
$(obj)/utsversion-tmp.h: FORCE
|
||||
$(call filechk,uts_version)
|
||||
|
||||
clean-files += utsversion-tmp.h
|
||||
|
||||
$(obj)/version.o: $(obj)/utsversion-tmp.h
|
||||
CFLAGS_version.o := -include $(obj)/utsversion-tmp.h
|
||||
|
||||
#
|
||||
# Build version-timestamp.c with final UTS_VERSION
|
||||
#
|
||||
|
||||
include/generated/utsversion.h: build-version-auto = $(shell $(srctree)/$(src)/build-version)
|
||||
include/generated/utsversion.h: build-timestamp-auto = $(shell LC_ALL=C date)
|
||||
include/generated/utsversion.h: FORCE
|
||||
$(call filechk,uts_version)
|
||||
|
||||
$(obj)/version-timestamp.o: include/generated/utsversion.h
|
||||
CFLAGS_version-timestamp.o := -include include/generated/utsversion.h
|
||||
|
||||
10
init/build-version
Executable file
10
init/build-version
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
prev_ver=$(cat .version 2>/dev/null) &&
|
||||
ver=$(expr ${prev_ver} + 1 2>/dev/null) ||
|
||||
ver=1
|
||||
|
||||
echo ${ver} > .version
|
||||
|
||||
echo ${ver}
|
||||
31
init/version-timestamp.c
Normal file
31
init/version-timestamp.c
Normal file
@@ -0,0 +1,31 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <generated/compile.h>
|
||||
#include <generated/utsrelease.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/proc_ns.h>
|
||||
#include <linux/refcount.h>
|
||||
#include <linux/uts.h>
|
||||
#include <linux/utsname.h>
|
||||
|
||||
struct uts_namespace init_uts_ns = {
|
||||
.ns.count = REFCOUNT_INIT(2),
|
||||
.name = {
|
||||
.sysname = UTS_SYSNAME,
|
||||
.nodename = UTS_NODENAME,
|
||||
.release = UTS_RELEASE,
|
||||
.version = UTS_VERSION,
|
||||
.machine = UTS_MACHINE,
|
||||
.domainname = UTS_DOMAINNAME,
|
||||
},
|
||||
.user_ns = &init_user_ns,
|
||||
.ns.inum = PROC_UTS_INIT_INO,
|
||||
#ifdef CONFIG_UTS_NS
|
||||
.ns.ops = &utsns_operations,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* FIXED STRINGS! Don't touch! */
|
||||
const char linux_banner[] =
|
||||
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
|
||||
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
|
||||
@@ -16,27 +16,8 @@
|
||||
#include <linux/uts.h>
|
||||
#include <linux/utsname.h>
|
||||
#include <generated/utsrelease.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/proc_ns.h>
|
||||
|
||||
struct uts_namespace init_uts_ns = {
|
||||
.ns.count = REFCOUNT_INIT(2),
|
||||
.name = {
|
||||
.sysname = UTS_SYSNAME,
|
||||
.nodename = UTS_NODENAME,
|
||||
.release = UTS_RELEASE,
|
||||
.version = UTS_VERSION,
|
||||
.machine = UTS_MACHINE,
|
||||
.domainname = UTS_DOMAINNAME,
|
||||
},
|
||||
.user_ns = &init_user_ns,
|
||||
.ns.inum = PROC_UTS_INIT_INO,
|
||||
#ifdef CONFIG_UTS_NS
|
||||
.ns.ops = &utsns_operations,
|
||||
#endif
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(init_uts_ns);
|
||||
|
||||
static int __init early_hostname(char *arg)
|
||||
{
|
||||
size_t bufsize = sizeof(init_uts_ns.name.nodename);
|
||||
@@ -52,11 +33,6 @@ static int __init early_hostname(char *arg)
|
||||
}
|
||||
early_param("hostname", early_hostname);
|
||||
|
||||
/* FIXED STRINGS! Don't touch! */
|
||||
const char linux_banner[] =
|
||||
"Linux version " UTS_RELEASE " (" LINUX_COMPILE_BY "@"
|
||||
LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION "\n";
|
||||
|
||||
const char linux_proc_banner[] =
|
||||
"%s version %s"
|
||||
" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
|
||||
@@ -64,3 +40,16 @@ const char linux_proc_banner[] =
|
||||
|
||||
BUILD_SALT;
|
||||
BUILD_LTO_INFO;
|
||||
|
||||
/*
|
||||
* init_uts_ns and linux_banner contain the build version and timestamp,
|
||||
* which are really fixed at the very last step of build process.
|
||||
* They are compiled with __weak first, and without __weak later.
|
||||
*/
|
||||
|
||||
struct uts_namespace init_uts_ns __weak;
|
||||
const char linux_banner[] __weak;
|
||||
|
||||
#include "version-timestamp.c"
|
||||
|
||||
EXPORT_SYMBOL_GPL(init_uts_ns);
|
||||
|
||||
Reference in New Issue
Block a user