summaryrefslogtreecommitdiffstats
path: root/pkgs/os-specific/linux
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-11-29 00:01:14 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-01-21 22:44:09 -0500
commit8929989614589ee3acd070a6409b2b9700c92d65 (patch)
tree595f163bed2eda4b564fa19df7ed03e7679af00b /pkgs/os-specific/linux
parent77403c1c19f9e9c5f8ba9bb24f83c07eace126b2 (diff)
lib: Clean up how linux and gcc config is specified
The `platform` field is pointless nesting: it's just stuff that happens to be defined together, and that should be an implementation detail. This instead makes `linux-kernel` and `gcc` top level fields in platform configs. They join `rustc` there [all are optional], which was put there and not in `platform` in anticipation of a change like this. `linux-kernel.arch` in particular also becomes `linuxArch`, to match the other `*Arch`es. The next step after is this to combine the *specific* machines from `lib.systems.platforms` with `lib.systems.examples`, keeping just the "multiplatform" ones for defaulting.
Diffstat (limited to 'pkgs/os-specific/linux')
-rw-r--r--pkgs/os-specific/linux/exfat/default.nix2
-rw-r--r--pkgs/os-specific/linux/kernel-headers/default.nix2
-rw-r--r--pkgs/os-specific/linux/kernel/generic.nix18
-rw-r--r--pkgs/os-specific/linux/kernel/manual-config.nix30
-rw-r--r--pkgs/os-specific/linux/klibc/default.nix4
-rw-r--r--pkgs/os-specific/linux/rtl8723bs/default.nix2
-rw-r--r--pkgs/os-specific/linux/rtl8812au/default.nix2
-rw-r--r--pkgs/os-specific/linux/uclibc/default.nix2
8 files changed, 31 insertions, 31 deletions
diff --git a/pkgs/os-specific/linux/exfat/default.nix b/pkgs/os-specific/linux/exfat/default.nix
index 88792346d708..958bcdb9f16e 100644
--- a/pkgs/os-specific/linux/exfat/default.nix
+++ b/pkgs/os-specific/linux/exfat/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
makeFlags = [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
- "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ "ARCH=${stdenv.hostPlatform.linuxArch}"
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix
index cadf65a7220f..d6ed7bccba3b 100644
--- a/pkgs/os-specific/linux/kernel-headers/default.nix
+++ b/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -7,7 +7,7 @@ let
pname = "linux-headers";
inherit version;
- ARCH = stdenvNoCC.hostPlatform.platform.kernelArch or stdenvNoCC.hostPlatform.kernelArch;
+ ARCH = stdenvNoCC.hostPlatform.linuxArch;
# It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
# We do this so we have a build->build, not build->host, C compiler.
diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix
index 31a90dc740f8..ac9d6fbb2b59 100644
--- a/pkgs/os-specific/linux/kernel/generic.nix
+++ b/pkgs/os-specific/linux/kernel/generic.nix
@@ -42,7 +42,7 @@
# symbolic name and `patch' is the actual patch. The patch may
# optionally be compressed with gzip or bzip2.
kernelPatches ? []
-, ignoreConfigErrors ? stdenv.hostPlatform.platform.name != "pc" ||
+, ignoreConfigErrors ? stdenv.hostPlatform.linux-kernel.name != "pc" ||
stdenv.hostPlatform != stdenv.buildPlatform
, extraMeta ? {}
@@ -51,10 +51,10 @@
, isLibre ? false
, isHardened ? false
-# easy overrides to stdenv.hostPlatform.platform members
-, autoModules ? stdenv.hostPlatform.platform.kernelAutoModules
-, preferBuiltin ? stdenv.hostPlatform.platform.kernelPreferBuiltin or false
-, kernelArch ? stdenv.hostPlatform.platform.kernelArch
+# easy overrides to stdenv.hostPlatform.linux-kernel members
+, autoModules ? stdenv.hostPlatform.linux-kernel.autoModules
+, preferBuiltin ? stdenv.hostPlatform.linux-kernel.preferBuiltin or false
+, kernelArch ? stdenv.hostPlatform.linuxArch
, ...
}:
@@ -87,7 +87,7 @@ let
intermediateNixConfig = configfile.moduleStructuredConfig.intermediateNixConfig
# extra config in legacy string format
+ extraConfig
- + lib.optionalString (stdenv.hostPlatform.platform ? kernelExtraConfig) stdenv.hostPlatform.platform.kernelExtraConfig;
+ + stdenv.hostPlatform.linux-kernel.extraConfig or "";
structuredConfigFromPatches =
map ({extraStructuredConfig ? {}, ...}: {settings=extraStructuredConfig;}) kernelPatches;
@@ -113,11 +113,11 @@ let
nativeBuildInputs = [ perl gmp libmpc mpfr ]
++ lib.optionals (lib.versionAtLeast version "4.16") [ bison flex ];
- platformName = stdenv.hostPlatform.platform.name;
+ platformName = stdenv.hostPlatform.linux-kernel.name;
# e.g. "defconfig"
- kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.platform.kernelBaseConfig;
+ kernelBaseConfig = if defconfig != null then defconfig else stdenv.hostPlatform.linux-kernel.baseConfig;
# e.g. "bzImage"
- kernelTarget = stdenv.hostPlatform.platform.kernelTarget;
+ kernelTarget = stdenv.hostPlatform.linux-kernel.target;
prePatch = kernel.prePatch + ''
# Patch kconfig to print "###" after every question so that
diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix
index 67016b71918f..2fc63322f5b5 100644
--- a/pkgs/os-specific/linux/kernel/manual-config.nix
+++ b/pkgs/os-specific/linux/kernel/manual-config.nix
@@ -64,10 +64,10 @@ let
commonMakeFlags = [
"O=$(buildRoot)"
- ] ++ lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags)
- stdenv.hostPlatform.platform.kernelMakeFlags;
+ ] ++ lib.optionals (stdenv.hostPlatform.linux-kernel ? makeFlags)
+ stdenv.hostPlatform.linux-kernel.makeFlags;
- drvAttrs = config_: platform: kernelPatches: configfile:
+ drvAttrs = config_: kernelConf: kernelPatches: configfile:
let
config = let attrName = attr: "CONFIG_" + attr; in {
isSet = attr: hasAttr (attrName attr) config;
@@ -171,7 +171,7 @@ let
buildFlags = [
"KBUILD_BUILD_VERSION=1-NixOS"
- platform.kernelTarget
+ kernelConf.target
"vmlinux" # for "perf" and things like that
] ++ optional isModular "modules";
@@ -186,16 +186,16 @@ let
'';
# Some image types need special install targets (e.g. uImage is installed with make uinstall)
- installTargets = [ (
- if platform ? kernelInstallTarget then platform.kernelInstallTarget
- else if platform.kernelTarget == "uImage" then "uinstall"
- else if platform.kernelTarget == "zImage" || platform.kernelTarget == "Image.gz" then "zinstall"
- else "install"
- ) ];
+ installTargets = [
+ (kernelConf.installTarget or (
+ /**/ if kernelConf.target == "uImage" then "uinstall"
+ else if kernelConf.target == "zImage" || kernelConf.target == "Image.gz" then "zinstall"
+ else "install"))
+ ];
postInstall = (optionalString installsFirmware ''
mkdir -p $out/lib/firmware
- '') + (if (platform ? kernelDTB && platform.kernelDTB) then ''
+ '') + (if (kernelConf.DTB or false) then ''
make $makeFlags "''${makeFlagsArray[@]}" dtbs dtbs_install INSTALL_DTBS_PATH=$out/dtbs
'' else "") + (if isModular then ''
mkdir -p $dev
@@ -300,7 +300,7 @@ in
assert (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") -> libelf != null;
assert lib.versionAtLeast version "5.8" -> elfutils != null;
-stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // {
+stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPatches configfile) // {
pname = "linux";
inherit version;
@@ -308,7 +308,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr gawk zstd ]
- ++ optional (stdenv.hostPlatform.platform.kernelTarget == "uImage") buildPackages.ubootTools
+ ++ optional (stdenv.hostPlatform.linux-kernel.target == "uImage") buildPackages.ubootTools
++ optional (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf
# Removed util-linuxMinimal since it should not be a dependency.
++ optionals (lib.versionAtLeast version "4.16") [ bison flex ]
@@ -322,10 +322,10 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches
makeFlags = commonMakeFlags ++ [
"CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
"HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
- "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ "ARCH=${stdenv.hostPlatform.linuxArch}"
] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];
- karch = stdenv.hostPlatform.platform.kernelArch;
+ karch = stdenv.hostPlatform.linuxArch;
})
diff --git a/pkgs/os-specific/linux/klibc/default.nix b/pkgs/os-specific/linux/klibc/default.nix
index 65ab71bd562c..dc96f3b6a621 100644
--- a/pkgs/os-specific/linux/klibc/default.nix
+++ b/pkgs/os-specific/linux/klibc/default.nix
@@ -25,11 +25,11 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" "stackprotector" ];
makeFlags = commonMakeFlags ++ [
- "KLIBCARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ "KLIBCARCH=${stdenv.hostPlatform.linuxArch}"
"KLIBCKERNELSRC=${linuxHeaders}"
] # TODO(@Ericson2314): We now can get the ABI from
# `stdenv.hostPlatform.parsed.abi`, is this still a good idea?
- ++ lib.optional (stdenv.hostPlatform.platform.kernelArch == "arm") "CONFIG_AEABI=y"
+ ++ lib.optional (stdenv.hostPlatform.linuxArch == "arm") "CONFIG_AEABI=y"
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "CROSS_COMPILE=${stdenv.cc.targetPrefix}";
# Install static binaries as well.
diff --git a/pkgs/os-specific/linux/rtl8723bs/default.nix b/pkgs/os-specific/linux/rtl8723bs/default.nix
index 056fd40d2526..a862b3517160 100644
--- a/pkgs/os-specific/linux/rtl8723bs/default.nix
+++ b/pkgs/os-specific/linux/rtl8723bs/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
buildInputs = [ nukeReferences ];
makeFlags = [
- "ARCH=${stdenv.hostPlatform.platform.kernelArch}" # Normally not needed, but the Makefile sets ARCH in a broken way.
+ "ARCH=${stdenv.hostPlatform.linuxArch}" # Normally not needed, but the Makefile sets ARCH in a broken way.
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" # Makefile uses $(uname -r); breaks us.
];
diff --git a/pkgs/os-specific/linux/rtl8812au/default.nix b/pkgs/os-specific/linux/rtl8812au/default.nix
index aeed87d3c192..68a88fb6778d 100644
--- a/pkgs/os-specific/linux/rtl8812au/default.nix
+++ b/pkgs/os-specific/linux/rtl8812au/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
'';
makeFlags = [
- "ARCH=${stdenv.hostPlatform.platform.kernelArch}"
+ "ARCH=${stdenv.hostPlatform.linuxArch}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
("CONFIG_PLATFORM_I386_PC=" + (if (stdenv.hostPlatform.isi686 || stdenv.hostPlatform.isx86_64) then "y" else "n"))
("CONFIG_PLATFORM_ARM_RPI=" + (if (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) then "y" else "n"))
diff --git a/pkgs/os-specific/linux/uclibc/default.nix b/pkgs/os-specific/linux/uclibc/default.nix
index 7c95a98372d6..7508e1faf15c 100644
--- a/pkgs/os-specific/linux/uclibc/default.nix
+++ b/pkgs/os-specific/linux/uclibc/default.nix
@@ -68,7 +68,7 @@ stdenv.mkDerivation {
cat << EOF | parseconfig
${nixConfig}
${extraConfig}
- ${stdenv.hostPlatform.platform.uclibc.extraConfig or ""}
+ ${stdenv.hostPlatform.uclibc.extraConfig or ""}
EOF
( set +o pipefail; yes "" | make oldconfig )
'';