mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-24 14:10:17 +02:00
linux: build dtbs in parallel (#106846)
linux: build DTBs in buildPhase, install with everything else This improves build speed, especially on machines with lots of cores such as the aarch64 community box and hydra builders.
This commit is contained in:
parent
4f292fe210
commit
dd5f07afca
|
@ -56,6 +56,7 @@ let
|
||||||
# Dependencies that are required to build kernel modules
|
# Dependencies that are required to build kernel modules
|
||||||
moduleBuildDependencies = optional (lib.versionAtLeast version "4.14") libelf;
|
moduleBuildDependencies = optional (lib.versionAtLeast version "4.14") libelf;
|
||||||
|
|
||||||
|
|
||||||
installkernel = writeTextFile { name = "installkernel"; executable=true; text = ''
|
installkernel = writeTextFile { name = "installkernel"; executable=true; text = ''
|
||||||
#!${stdenv.shell} -e
|
#!${stdenv.shell} -e
|
||||||
mkdir -p $4
|
mkdir -p $4
|
||||||
|
@ -88,6 +89,8 @@ let
|
||||||
|
|
||||||
isModular = config.isYes "MODULES";
|
isModular = config.isYes "MODULES";
|
||||||
|
|
||||||
|
buildDTBs = kernelConf.DTB or false;
|
||||||
|
|
||||||
installsFirmware = (config.isEnabled "FW_LOADER") &&
|
installsFirmware = (config.isEnabled "FW_LOADER") &&
|
||||||
(isModular || (config.isDisabled "FIRMWARE_IN_KERNEL")) &&
|
(isModular || (config.isDisabled "FIRMWARE_IN_KERNEL")) &&
|
||||||
(lib.versionOlder version "4.14");
|
(lib.versionOlder version "4.14");
|
||||||
|
@ -175,15 +178,16 @@ let
|
||||||
"KBUILD_BUILD_VERSION=1-NixOS"
|
"KBUILD_BUILD_VERSION=1-NixOS"
|
||||||
kernelConf.target
|
kernelConf.target
|
||||||
"vmlinux" # for "perf" and things like that
|
"vmlinux" # for "perf" and things like that
|
||||||
]
|
] ++ optional isModular "modules"
|
||||||
++ optional isModular "modules"
|
++ optional buildDTBs "dtbs"
|
||||||
++ extraMakeFlags;
|
++ extraMakeFlags;
|
||||||
|
|
||||||
installFlags = [
|
installFlags = [
|
||||||
"INSTALLKERNEL=${installkernel}"
|
"INSTALLKERNEL=${installkernel}"
|
||||||
"INSTALL_PATH=$(out)"
|
"INSTALL_PATH=$(out)"
|
||||||
] ++ (optional isModular "INSTALL_MOD_PATH=$(out)")
|
] ++ (optional isModular "INSTALL_MOD_PATH=$(out)")
|
||||||
++ optional installsFirmware "INSTALL_FW_PATH=$(out)/lib/firmware";
|
++ optional installsFirmware "INSTALL_FW_PATH=$(out)/lib/firmware"
|
||||||
|
++ optionals buildDTBs ["dtbs_install" "INSTALL_DTBS_PATH=$(out)/dtbs"];
|
||||||
|
|
||||||
preInstall = ''
|
preInstall = ''
|
||||||
installFlagsArray+=("-j$NIX_BUILD_CORES")
|
installFlagsArray+=("-j$NIX_BUILD_CORES")
|
||||||
|
@ -199,9 +203,7 @@ let
|
||||||
|
|
||||||
postInstall = (optionalString installsFirmware ''
|
postInstall = (optionalString installsFirmware ''
|
||||||
mkdir -p $out/lib/firmware
|
mkdir -p $out/lib/firmware
|
||||||
'') + (if (kernelConf.DTB or false) then ''
|
'') + (if isModular then ''
|
||||||
make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs
|
|
||||||
'' else "") + (if isModular then ''
|
|
||||||
mkdir -p $dev
|
mkdir -p $dev
|
||||||
cp vmlinux $dev/
|
cp vmlinux $dev/
|
||||||
if [ -z "''${dontStrip-}" ]; then
|
if [ -z "''${dontStrip-}" ]; then
|
||||||
|
|
Loading…
Reference in a new issue