linuxHeaders: 4.19.16 -> 5.5

Linux has reworked its header install process in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=59b2bd05f5f4dc62979c2e82ddd384f07e8f10bc
It has introduced `make headers` that prepares the headers in ./usr/include, and
made `make headers_install` copy the headers from there using rsync.
This commit is contained in:
Orivej Desh 2020-02-01 04:35:14 +00:00
parent 230edccf3a
commit d48e99d912
3 changed files with 10 additions and 57 deletions

View file

@ -1,5 +1,5 @@
{ stdenvNoCC, lib, buildPackages
, fetchurl, perl
, fetchurl, perl, rsync
, elf-header
}:
@ -16,7 +16,7 @@ let
# We do this so we have a build->build, not build->host, C compiler.
depsBuildBuild = [ buildPackages.stdenv.cc ];
# `elf-header` is null when libc provides `elf.h`.
nativeBuildInputs = [ perl elf-header ];
nativeBuildInputs = [ perl rsync elf-header ];
extraIncludeDirs = lib.optional stdenvNoCC.hostPlatform.isPowerPC ["ppc"];
@ -39,12 +39,8 @@ let
# Skip clean on darwin, case-sensitivity issues.
buildPhase = lib.optionalString (!stdenvNoCC.buildPlatform.isDarwin) ''
make mrproper $makeFlags
''
# For some reason, doing `make install_headers` twice, first without
# INSTALL_HDR_PATH=$out then with, is neccessary to get this to work
# for darwin cross. @Ericson2314 has no idea why.
+ ''
make headers_install $makeFlags
'' + ''
make headers $makeFlags
'';
checkPhase = ''
@ -55,13 +51,9 @@ let
make headers_install INSTALL_HDR_PATH=$out $makeFlags
''
# Some builds (e.g. KVM) want a kernel.release.
+ '' mkdir -p $out/include/config
echo "${version}-default" > $out/include/config/kernel.release
''
# These oddly named file records the `SHELL` passed, which causes bootstrap
# tools run-time dependency.
+ ''
find "$out" -name '..install.cmd' -print0 | xargs -0 rm
mkdir -p $out/include/config
echo "${version}-default" > $out/include/config/kernel.release
'';
meta = with lib; {
@ -73,16 +65,15 @@ let
in {
inherit makeLinuxHeaders;
linuxHeaders = let version = "4.19.16"; in
linuxHeaders = let version = "5.5"; in
makeLinuxHeaders {
inherit version;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
sha256 = "1pqvn6dsh0xhdpawz4ag27vkw1abvb6sn3869i4fbrz33ww8i86q";
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "0c131fi6s7vgvka1c0597vnvcmwn1pp968rci5kq64iwj3pd9yx6";
};
patches = [
./no-relocs.patch # for building x86 kernel headers on non-ELF platforms
./no-dynamic-cc-version-check.patch # so we can use `stdenvNoCC`, see `makeFlags` above
];
};
}

View file

@ -1,32 +0,0 @@
diff --git a/Makefile b/Makefile
index 863f58503bee..b778d5023208 100644
--- a/Makefile
+++ b/Makefile
@@ -501,11 +501,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
# check for 'asm goto'
-ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC) $(KBUILD_CFLAGS)), y)
CC_HAVE_ASM_GOTO := 1
KBUILD_CFLAGS += -DCC_HAVE_ASM_GOTO
KBUILD_AFLAGS += -DCC_HAVE_ASM_GOTO
-endif
# The expansion should be delayed until arch/$(SRCARCH)/Makefile is included.
# Some architectures define CROSS_COMPILE in arch/$(SRCARCH)/Makefile.
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 065324a8046f..d09c67194549 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -216,11 +216,8 @@ cc-disable-warning = $(call try-run-cached,\
cc-name = $(call shell-cached,$(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
# cc-version
-cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC))
# cc-fullversion
-cc-fullversion = $(shell $(CONFIG_SHELL) \
- $(srctree)/scripts/gcc-version.sh -p $(CC))
# cc-ifversion
# Usage: EXTRA_CFLAGS += $(call cc-ifversion, -lt, 0402, -O1)

View file

@ -1,13 +1,7 @@
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index fad55160dcb9..a48c8331cbb2 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -239,7 +239,7 @@ ifdef CONFIG_RETPOLINE
endif
@@ -231,3 +231,3 @@ endif
archscripts: scripts_basic
- $(Q)$(MAKE) $(build)=arch/x86/tools relocs
+ $(Q)$(MAKE) $(build)=arch/x86/tools
###
# Syscall table generation