1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-08-15 15:00:28 +03:00

kernel-builder: Fix fallout from nixpkgs#110544

Deals with https://github.com/NixOS/nixpkgs/pull/110544

This is a breaking change; the kernel builder cannot be used with a
Nixpkgs from before this change, and vice-versa.
This commit is contained in:
Samuel Dionne-Riel 2021-02-02 05:36:12 -05:00
parent 225ed39dad
commit d14b99e90f

View File

@ -53,8 +53,8 @@ let
modDirify = v: v;
# Shortcuts
inherit (stdenv.hostPlatform) platform;
inherit (lib) optionals optional optionalString;
platform = stdenv.hostPlatform;
maybeString = str: optionalString (str != null) str;
in
@ -72,11 +72,11 @@ in
# Handling of QCDT dt.img
, isQcdt ? false
, qcdt_dtbs ? "arch/${platform.kernelArch}/boot/"
, qcdt_dtbs ? "arch/${platform.linuxArch}/boot/"
# Handling of Exynos dt.img
, isExynosDT ? false
, exynos_dtbs ? "arch/${platform.kernelArch}/boot/dts/*.dtb"
, exynos_dtbs ? "arch/${platform.linuxArch}/boot/dts/*.dtb"
, exynos_platform ? "0x50a6"
, exynos_subtype ? "0x217584da"
@ -150,9 +150,9 @@ let
hasDTB = platform ? kernelDTB && platform.kernelDTB;
kernelFileExtension = if isCompressed != false then ".${isCompressed}" else "";
kernelTarget = if platform.kernelTarget == "Image"
then "${platform.kernelTarget}${kernelFileExtension}"
else platform.kernelTarget;
kernelTarget = if platform.linux-kernel.target == "Image"
then "${platform.linux-kernel.target}${kernelFileExtension}"
else platform.linux-kernel.target;
in
# This `let` block allows us to have a self-reference to this derivation.
@ -171,7 +171,7 @@ stdenv.mkDerivation (inputArgs // {
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr ]
++ optional (platform.kernelTarget == "uImage") buildPackages.ubootTools
++ optional (platform.linux-kernel.target == "uImage") buildPackages.ubootTools
++ optional (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf
++ optional (lib.versionAtLeast version "4.15") utillinux
++ optionals (lib.versionAtLeast version "4.16") [ bison flex ]
@ -396,7 +396,7 @@ stdenv.mkDerivation (inputArgs // {
'' + optionalString isImageGzDtb ''
echo ":: Copying platform-specific -dtb image file"
cp -v "$buildRoot/arch/${platform.kernelArch}/boot/${kernelTarget}-dtb" "$out/"
cp -v "$buildRoot/arch/${platform.linuxArch}/boot/${kernelTarget}-dtb" "$out/"
''
+ maybeString postInstall
@ -408,7 +408,7 @@ stdenv.mkDerivation (inputArgs // {
"O=$(buildRoot)"
"CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
"HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
"ARCH=${platform.kernelArch}"
"ARCH=${platform.linuxArch}"
"DTC_EXT=${buildPackages.dtc}/bin/dtc"
"KBUILD_BUILD_VERSION=1-mobile-nixos"
]
@ -525,8 +525,8 @@ stdenv.mkDerivation (inputArgs // {
export PATH="$PATH:${buildPackages.gnumake}/bin"
export KCONFIG_CONFIG="\$(readlink -f "\$1")"; shift
export SRCARCH="${platform.kernelArch}"
export ARCH="${platform.kernelArch}"
export SRCARCH="${platform.linuxArch}"
export ARCH="${platform.linuxArch}"
export KERNELVERSION="${version}"
cd "\$KERNEL_TREE"
${/* We're expanding the builder's makeFlags variable here. This is not a mistake. */""}