summary refs log tree commit diff
path: root/pkgs/os-specific/linux/kernel/generic.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-05-21 08:45:12 +0000
committerAlyssa Ross <hi@alyssa.is>2023-05-22 08:44:17 +0000
commitfebe4776287fd81b9dc0fd88a8bcb686765c8a6b (patch)
treeb529b2e5647dfae8ac742d2b505b441335b5c007 /pkgs/os-specific/linux/kernel/generic.nix
parent0a501274a47e65609ca5f1c539dce74f20f719e2 (diff)
downloadnixpkgs-febe4776287fd81b9dc0fd88a8bcb686765c8a6b.tar
nixpkgs-febe4776287fd81b9dc0fd88a8bcb686765c8a6b.tar.gz
nixpkgs-febe4776287fd81b9dc0fd88a8bcb686765c8a6b.tar.bz2
nixpkgs-febe4776287fd81b9dc0fd88a8bcb686765c8a6b.tar.lz
nixpkgs-febe4776287fd81b9dc0fd88a8bcb686765c8a6b.tar.xz
nixpkgs-febe4776287fd81b9dc0fd88a8bcb686765c8a6b.tar.zst
nixpkgs-febe4776287fd81b9dc0fd88a8bcb686765c8a6b.zip
linux: default stdenv.hostPlatform.linux-kernel
With this change, we can do a reasonable default build of Linux for
configurations that do not have a corresponding platforms.nix entry,
and where the user has not explicitly specified the linux-kernel
values.  This allows us to do best effort builds for obscure
architectures (I tested a build for s390x).

The platformName binding has not been used since
70cb7050f5c ("Trying to make the linux kernels also cross-build."),
so I removed it.
Diffstat (limited to 'pkgs/os-specific/linux/kernel/generic.nix')
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix9
1 files changed, 4 insertions, 5 deletions
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index 56d89f67c64..04f6cfc70ad 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -47,7 +47,7 @@
   # symbolic name and `patch' is the actual patch.  The patch may
   # optionally be compressed with gzip or bzip2.
   kernelPatches ? []
-, ignoreConfigErrors ? stdenv.hostPlatform.linux-kernel.name != "pc"
+, ignoreConfigErrors ? stdenv.hostPlatform.linux-kernel.name or "" != "pc"
 , extraMeta ? {}
 
 , isZen      ? false
@@ -55,7 +55,7 @@
 , isHardened ? false
 
 # easy overrides to stdenv.hostPlatform.linux-kernel members
-, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules
+, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules or true
 , preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false
 , kernelArch ? stdenv.hostPlatform.linuxArch
 , kernelTests ? []
@@ -128,11 +128,10 @@ let
       ++ lib.optionals (lib.versionAtLeast version "4.16") [ bison flex ]
       ++ lib.optional (lib.versionAtLeast version "5.2") pahole;
 
-    platformName = stdenv.hostPlatform.linux-kernel.name;
     # e.g. "defconfig"
-    kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig;
+    kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig or "defconfig";
     # e.g. "bzImage"
-    kernelTarget = stdenv.hostPlatform.linux-kernel.target;
+    kernelTarget = stdenv.hostPlatform.linux-kernel.target or "vmlinux";
 
     makeFlags = lib.optionals (stdenv.hostPlatform.linux-kernel ? makeFlags) stdenv.hostPlatform.linux-kernel.makeFlags
       ++ extraMakeFlags;