summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/strings.nix10
-rw-r--r--lib/systems/default.nix2
-rw-r--r--lib/systems/examples.nix11
-rw-r--r--lib/systems/platforms.nix49
4 files changed, 48 insertions, 24 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index fbb48dec92af..5010d9159cb8 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -569,9 +569,9 @@ rec {
standard GNU Autoconf scripts.
Example:
- enableFeature true "shared" "foo"
+ enableFeatureAs true "shared" "foo"
=> "--enable-shared=foo"
- enableFeature false "shared" (throw "ignored")
+ enableFeatureAs false "shared" (throw "ignored")
=> "--disable-shared"
*/
enableFeatureAs = enable: feat: value: enableFeature enable feat + optionalString enable "=${value}";
@@ -593,9 +593,9 @@ rec {
standard GNU Autoconf scripts.
Example:
- with_Feature true "shared" "foo"
+ withFeatureAs true "shared" "foo"
=> "--with-shared=foo"
- with_Feature false "shared" (throw "ignored")
+ withFeatureAs false "shared" (throw "ignored")
=> "--without-shared"
*/
withFeatureAs = with_: feat: value: withFeature with_ feat + optionalString with_ "=${value}";
@@ -674,7 +674,7 @@ rec {
else
false;
- /* Parse a string string as an int.
+ /* Parse a string as an int.
Type: string -> int
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index 9939743157e7..f6832945a23d 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -25,7 +25,7 @@ rec {
system = parse.doubleFromSystem final.parsed;
config = parse.tripleFromSystem final.parsed;
# Just a guess, based on `system`
- platform = platforms.selectBySystem final.system;
+ platform = platforms.select final;
# Determine whether we are compatible with the provided CPU
isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu;
# Derived meta-data
diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix
index 3bbe61ed33a5..16002450f2d1 100644
--- a/lib/systems/examples.nix
+++ b/lib/systems/examples.nix
@@ -7,7 +7,7 @@ let
riscv = bits: {
config = "riscv${bits}-unknown-linux-gnu";
- platform = platforms.riscv-multiplatform bits;
+ platform = platforms.riscv-multiplatform;
};
in
@@ -39,6 +39,11 @@ rec {
platform = platforms.zero-gravitas;
};
+ remarkable2 = {
+ config = "armv7l-unknown-linux-gnueabihf";
+ platform = platforms.zero-sugar;
+ };
+
armv7l-hf-multiplatform = {
config = "armv7l-unknown-linux-gnueabihf";
platform = platforms.armv7l-hf-multiplatform;
@@ -105,13 +110,13 @@ rec {
riscv64-embedded = {
config = "riscv64-none-elf";
libc = "newlib";
- platform = platforms.riscv-multiplatform "64";
+ platform = platforms.riscv-multiplatform;
};
riscv32-embedded = {
config = "riscv32-none-elf";
libc = "newlib";
- platform = platforms.riscv-multiplatform "32";
+ platform = platforms.riscv-multiplatform;
};
mmix = {
diff --git a/lib/systems/platforms.nix b/lib/systems/platforms.nix
index 42d9809fd7d0..a0dccc859883 100644
--- a/lib/systems/platforms.nix
+++ b/lib/systems/platforms.nix
@@ -217,6 +217,21 @@ rec {
};
};
+ zero-sugar = {
+ name = "zero-sugar";
+ kernelBaseConfig = "zero-sugar_defconfig";
+ kernelArch = "arm";
+ kernelDTB = true;
+ kernelAutoModules = false;
+ kernelPreferBuiltin = true;
+ kernelTarget = "zImage";
+ gcc = {
+ cpu = "cortex-a7";
+ fpu = "neon-vfpv4";
+ float-abi = "hard";
+ };
+ };
+
scaleway-c1 = armv7l-hf-multiplatform // {
gcc = {
cpu = "cortex-a9";
@@ -456,10 +471,9 @@ rec {
## Other
##
- riscv-multiplatform = bits: {
+ riscv-multiplatform = {
name = "riscv-multiplatform";
kernelArch = "riscv";
- bfdEmulation = "elf${bits}lriscv";
kernelTarget = "vmlinux";
kernelAutoModules = true;
kernelBaseConfig = "defconfig";
@@ -469,17 +483,22 @@ rec {
'';
};
- selectBySystem = system: {
- i486-linux = pc32;
- i586-linux = pc32;
- i686-linux = pc32;
- x86_64-linux = pc64;
- armv5tel-linux = sheevaplug;
- armv6l-linux = raspberrypi;
- armv7a-linux = armv7l-hf-multiplatform;
- armv7l-linux = armv7l-hf-multiplatform;
- aarch64-linux = aarch64-multiplatform;
- mipsel-linux = fuloong2f_n32;
- powerpc64le-linux = powernv;
- }.${system} or pcBase;
+ select = platform:
+ # x86
+ /**/ if platform.isx86_32 then pc32
+ else if platform.isx86_64 then pc64
+
+ # ARM
+ else if platform.isAarch32 then let
+ version = platform.parsed.cpu.version or "";
+ in if lib.versionOlder version "6" then sheevaplug
+ else if lib.versionOlder version "7" then raspberrypi
+ else armv7l-hf-multiplatform
+ else if platform.isAarch64 then aarch64-multiplatform
+
+ else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32
+
+ else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv
+
+ else pcBase;
}