Simplify packages layout
This commit is contained in:
parent
ddc65a8087
commit
df5be1d6dc
|
@ -69,12 +69,9 @@ in {
|
||||||
|
|
||||||
genodePackages = import ../packages {
|
genodePackages = import ../packages {
|
||||||
inherit flake;
|
inherit flake;
|
||||||
nixpkgs = final;
|
pkgs = final;
|
||||||
};
|
};
|
||||||
|
|
||||||
genodeSources =
|
|
||||||
buildPackages.callPackage ../packages/genodelabs { inherit flake; };
|
|
||||||
|
|
||||||
libconfig = overrideHostAttrs libconfig
|
libconfig = overrideHostAttrs libconfig
|
||||||
(attrs: { configureFlags = [ "--disable-examples" ]; });
|
(attrs: { configureFlags = [ "--disable-examples" ]; });
|
||||||
|
|
||||||
|
@ -101,7 +98,7 @@ in {
|
||||||
|
|
||||||
llvmPackages_8 = callPackage ./llvm-8 ({
|
llvmPackages_8 = callPackage ./llvm-8 ({
|
||||||
inherit (stdenvAdapters) overrideCC;
|
inherit (stdenvAdapters) overrideCC;
|
||||||
inherit (targetPackages.genodeSources) genodeBase;
|
inherit (final.genodePackages.genodeSources) genodeBase;
|
||||||
buildLlvmTools = buildPackages.llvmPackages_8.tools;
|
buildLlvmTools = buildPackages.llvmPackages_8.tools;
|
||||||
targetLlvmLibraries = targetPackages.llvmPackages_8.libraries;
|
targetLlvmLibraries = targetPackages.llvmPackages_8.libraries;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ genodeSources, symlinkJoin }:
|
{ genodePackages, symlinkJoin }:
|
||||||
|
let inherit (genodePackages) genodeSources;
|
||||||
symlinkJoin {
|
in symlinkJoin {
|
||||||
name = "posix";
|
name = "posix";
|
||||||
paths = map genodeSources.depot [ "libc" "posix" ];
|
paths = with genodePackages; [ libc posix ];
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
local headerDir="''${!outputDev}/include"
|
local headerDir="''${!outputDev}/include"
|
||||||
mkdir -p "$headerDir"
|
mkdir -p "$headerDir"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
{ flake, nixpkgs }:
|
{ flake, pkgs }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (nixpkgs)
|
upstream = import ./genodelabs { inherit flake pkgs; };
|
||||||
buildPackages callPackage fetchFromGitHub fetchgit genodeSources stdenv;
|
inherit (upstream) genodeSources;
|
||||||
inherit (genodeSources) buildUpstream;
|
|
||||||
|
inherit (pkgs) buildPackages callPackage fetchFromGitHub fetchgit stdenv;
|
||||||
|
|
||||||
dhallPackages =
|
dhallPackages =
|
||||||
flake.inputs.nixpkgs.legacyPackages.x86_64-linux.callPackage ./dhall { };
|
flake.inputs.nixpkgs.legacyPackages.x86_64-linux.callPackage ./dhall { };
|
||||||
|
@ -22,80 +23,7 @@ let
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
depotPkgs = with builtins;
|
in upstream // {
|
||||||
let
|
|
||||||
names = attrNames (import ./genodelabs/targets.nix {
|
|
||||||
buildPackages = null;
|
|
||||||
ports = null;
|
|
||||||
});
|
|
||||||
f = name: {
|
|
||||||
inherit name;
|
|
||||||
value = genodeSources.depot name;
|
|
||||||
};
|
|
||||||
in listToAttrs (map f names);
|
|
||||||
|
|
||||||
basePatches = [ ./genodelabs/cxx-align.patch ];
|
|
||||||
|
|
||||||
in depotPkgs // {
|
|
||||||
inherit stdenv genodeSources;
|
|
||||||
|
|
||||||
base-hw-pc = buildUpstream {
|
|
||||||
name = "base-hw-pc";
|
|
||||||
outputs = [ "out" "coreObj" "bootstrapObj" ];
|
|
||||||
KERNEL = "hw";
|
|
||||||
BOARD = "pc";
|
|
||||||
targets = [ "bootstrap" "core" "timer" "lib/ld" ];
|
|
||||||
patches = basePatches;
|
|
||||||
postInstall = ''
|
|
||||||
mv $out/lib/ld-hw.lib.so $out/lib/ld.lib.so
|
|
||||||
mv $out/bin/hw_timer_drv $out/bin/timer_drv
|
|
||||||
install build/bin/core-hw-pc.o $coreObj
|
|
||||||
install build/bin/bootstrap-hw-pc.o $bootstrapObj
|
|
||||||
'';
|
|
||||||
meta.platforms = [ "x86_64-genode" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
base-hw-virt_qemu = buildUpstream {
|
|
||||||
name = "base-hw-virt_qemu";
|
|
||||||
outputs = [ "out" "coreObj" "bootstrapObj" ];
|
|
||||||
KERNEL = "hw";
|
|
||||||
BOARD = "virt_qemu";
|
|
||||||
targets = [ "bootstrap" "core" "timer" "lib/ld" ];
|
|
||||||
patches = basePatches;
|
|
||||||
postInstall = ''
|
|
||||||
mv $out/lib/ld-hw.lib.so $out/lib/ld.lib.so
|
|
||||||
mv $out/bin/hw_timer_drv $out/bin/timer_drv
|
|
||||||
install build/bin/core-hw-virt_qemu.o $coreObj
|
|
||||||
install build/bin/bootstrap-hw-virt_qemu.o $bootstrapObj
|
|
||||||
'';
|
|
||||||
meta.platforms = [ "aarch64-genode" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
base-linux = buildUpstream {
|
|
||||||
name = "base-linux";
|
|
||||||
KERNEL = "linux";
|
|
||||||
BOARD = "linux";
|
|
||||||
targets = [ "core" "timer" "lib/ld" ];
|
|
||||||
patches = basePatches;
|
|
||||||
postInstall = ''
|
|
||||||
mv $out/lib/ld-linux.lib.so $out/lib/ld.lib.so
|
|
||||||
mv $out/bin/linux_timer_drv $out/bin/timer_drv
|
|
||||||
'';
|
|
||||||
HOST_INC_DIR = buildPackages.glibc.dev + "/include";
|
|
||||||
};
|
|
||||||
|
|
||||||
base-nova = buildUpstream {
|
|
||||||
name = "base-nova";
|
|
||||||
outputs = [ "out" "coreObj" ];
|
|
||||||
KERNEL = "nova";
|
|
||||||
targets = [ "core" "timer" "lib/ld" ];
|
|
||||||
patches = basePatches;
|
|
||||||
postInstall = ''
|
|
||||||
mv $out/lib/ld-nova.lib.so $out/lib/ld.lib.so
|
|
||||||
mv $out/bin/nova_timer_drv $out/bin/timer_drv
|
|
||||||
install build/bin/core-nova.o $coreObj
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
bender = buildPackages.callPackage ./bender { };
|
bender = buildPackages.callPackage ./bender { };
|
||||||
|
|
||||||
|
@ -103,8 +31,6 @@ in depotPkgs // {
|
||||||
|
|
||||||
dhallGenode = dhallPackages.genode;
|
dhallGenode = dhallPackages.genode;
|
||||||
|
|
||||||
init = genodeSources.depot "init";
|
|
||||||
|
|
||||||
nic_bus = callPackage ./nic_bus { };
|
nic_bus = callPackage ./nic_bus { };
|
||||||
|
|
||||||
NOVA = callPackage ./NOVA { };
|
NOVA = callPackage ./NOVA { };
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{ flake, buildPackages, targetPackages }:
|
{ flake, pkgs }:
|
||||||
|
|
||||||
let
|
let
|
||||||
platform = targetPackages.targetPlatform;
|
inherit (pkgs) lib buildPackages targetPackages;
|
||||||
|
|
||||||
|
platform = pkgs.targetPlatform;
|
||||||
|
|
||||||
arch = with platform;
|
arch = with platform;
|
||||||
if isx86_64 then
|
if isx86_64 then
|
||||||
|
@ -11,8 +13,6 @@ let
|
||||||
else
|
else
|
||||||
throw "unknown Genode arch for platform ${platform.system}";
|
throw "unknown Genode arch for platform ${platform.system}";
|
||||||
|
|
||||||
inherit (buildPackages) callPackage fetchurl lib;
|
|
||||||
|
|
||||||
upstreamSources = flake.inputs.genode;
|
upstreamSources = flake.inputs.genode;
|
||||||
|
|
||||||
genodeSources =
|
genodeSources =
|
||||||
|
@ -61,7 +61,7 @@ let
|
||||||
let
|
let
|
||||||
havePatches = patches != [ ];
|
havePatches = patches != [ ];
|
||||||
version = portVersions.${name};
|
version = portVersions.${name};
|
||||||
in with buildPackages;
|
in with buildPackages.buildPackages;
|
||||||
stdenvNoCC.mkDerivation (args // {
|
stdenvNoCC.mkDerivation (args // {
|
||||||
name = name + "-port-" + version;
|
name = name + "-port-" + version;
|
||||||
inherit version patches;
|
inherit version patches;
|
||||||
|
@ -121,10 +121,9 @@ let
|
||||||
# The "ports" mechanism is hardly deterministic, so prepare with
|
# The "ports" mechanism is hardly deterministic, so prepare with
|
||||||
# a pinned nixpkgs revision for a pinned platform.
|
# a pinned nixpkgs revision for a pinned platform.
|
||||||
|
|
||||||
toolchain = callPackage ./toolchain.nix { };
|
toolchain = buildPackages.buildPackages.callPackage ./toolchain.nix { };
|
||||||
|
|
||||||
stdenv' =
|
stdenv' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv toolchain;
|
||||||
targetPackages.stdenvAdapters.overrideCC targetPackages.stdenv toolchain;
|
|
||||||
|
|
||||||
buildUpstream =
|
buildUpstream =
|
||||||
# Build from the Genode sources
|
# Build from the Genode sources
|
||||||
|
@ -179,14 +178,14 @@ let
|
||||||
buildDepot =
|
buildDepot =
|
||||||
# Build a Depot target from the Genode sources
|
# Build a Depot target from the Genode sources
|
||||||
{ name, apiOnly ? false, portInputs ? [ ], nativeBuildInputs ? [ ]
|
{ name, apiOnly ? false, portInputs ? [ ], nativeBuildInputs ? [ ]
|
||||||
, meta ? { }, ... }@extraAttrs:
|
, buildInputs ? [ ], meta ? { }, ... }@extraAttrs:
|
||||||
|
|
||||||
stdenv'.mkDerivation (extraAttrs // {
|
stdenv'.mkDerivation (extraAttrs // {
|
||||||
pname = name;
|
pname = name;
|
||||||
inherit (genodeSources) version;
|
inherit (genodeSources) version;
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
nativeBuildInputs = with buildPackages;
|
nativeBuildInputs = with buildPackages.buildPackages;
|
||||||
[ binutils bison flex stdenv.cc tcl which ] ++ nativeBuildInputs;
|
[ binutils bison flex stdenv.cc tcl which ] ++ nativeBuildInputs;
|
||||||
|
|
||||||
src = genodeSources;
|
src = genodeSources;
|
||||||
|
@ -234,7 +233,21 @@ let
|
||||||
meta = { platforms = lib.platforms.genode; } // meta;
|
meta = { platforms = lib.platforms.genode; } // meta;
|
||||||
});
|
});
|
||||||
|
|
||||||
buildOverrides = callPackage ./targets.nix { inherit ports; };
|
makePackages = let
|
||||||
|
overrides = import ./make-targets.nix {
|
||||||
|
inherit (pkgs) buildPackages genodePackages;
|
||||||
|
inherit ports;
|
||||||
|
};
|
||||||
|
in lib.attrsets.mapAttrs
|
||||||
|
(name: value: (buildUpstream ({ inherit name; } // value))) overrides;
|
||||||
|
|
||||||
|
depotPackages = lib.attrsets.mapAttrs
|
||||||
|
(name: value: (buildDepot ({ inherit name; } // value)))
|
||||||
|
(import ./depot-targets.nix {
|
||||||
|
inherit (pkgs) genodePackages;
|
||||||
|
inherit ports;
|
||||||
|
buildPackages = buildPackages.buildPackages;
|
||||||
|
});
|
||||||
|
|
||||||
specs = with platform;
|
specs = with platform;
|
||||||
[ ]
|
[ ]
|
||||||
|
@ -283,20 +296,69 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
in genodeSources // {
|
basePatches = [ ./cxx-align.patch ];
|
||||||
inherit buildUpstream buildDepot ports specs toolchain genodeBase;
|
|
||||||
|
|
||||||
make = target:
|
in makePackages // depotPackages // {
|
||||||
let
|
|
||||||
name = builtins.replaceStrings [ "/" ] [ "-" ] target;
|
|
||||||
attrs = buildOverrides.${name} or { };
|
|
||||||
in buildUpstream ({
|
|
||||||
inherit name;
|
|
||||||
targets = [ target ];
|
|
||||||
} // attrs);
|
|
||||||
|
|
||||||
depot = name:
|
genodeSources = genodeSources // {
|
||||||
let attrs = buildOverrides.${name} or { };
|
inherit buildUpstream buildDepot genodeBase ports specs toolchain;
|
||||||
in buildDepot ({ inherit name; } // attrs);
|
};
|
||||||
|
|
||||||
|
base-hw-pc = buildUpstream {
|
||||||
|
name = "base-hw-pc";
|
||||||
|
outputs = [ "out" "coreObj" "bootstrapObj" ];
|
||||||
|
KERNEL = "hw";
|
||||||
|
BOARD = "pc";
|
||||||
|
targets = [ "bootstrap" "core" "timer" "lib/ld" ];
|
||||||
|
patches = basePatches;
|
||||||
|
postInstall = ''
|
||||||
|
mv $out/lib/ld-hw.lib.so $out/lib/ld.lib.so
|
||||||
|
mv $out/bin/hw_timer_drv $out/bin/timer_drv
|
||||||
|
install build/bin/core-hw-pc.o $coreObj
|
||||||
|
install build/bin/bootstrap-hw-pc.o $bootstrapObj
|
||||||
|
'';
|
||||||
|
meta.platforms = [ "x86_64-genode" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
base-hw-virt_qemu = buildUpstream {
|
||||||
|
name = "base-hw-virt_qemu";
|
||||||
|
outputs = [ "out" "coreObj" "bootstrapObj" ];
|
||||||
|
KERNEL = "hw";
|
||||||
|
BOARD = "virt_qemu";
|
||||||
|
targets = [ "bootstrap" "core" "timer" "lib/ld" ];
|
||||||
|
patches = basePatches;
|
||||||
|
postInstall = ''
|
||||||
|
mv $out/lib/ld-hw.lib.so $out/lib/ld.lib.so
|
||||||
|
mv $out/bin/hw_timer_drv $out/bin/timer_drv
|
||||||
|
install build/bin/core-hw-virt_qemu.o $coreObj
|
||||||
|
install build/bin/bootstrap-hw-virt_qemu.o $bootstrapObj
|
||||||
|
'';
|
||||||
|
meta.platforms = [ "aarch64-genode" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
base-linux = buildUpstream {
|
||||||
|
name = "base-linux";
|
||||||
|
KERNEL = "linux";
|
||||||
|
BOARD = "linux";
|
||||||
|
targets = [ "core" "timer" "lib/ld" ];
|
||||||
|
patches = basePatches;
|
||||||
|
postInstall = ''
|
||||||
|
mv $out/lib/ld-linux.lib.so $out/lib/ld.lib.so
|
||||||
|
mv $out/bin/linux_timer_drv $out/bin/timer_drv
|
||||||
|
'';
|
||||||
|
HOST_INC_DIR = buildPackages.glibc.dev + "/include";
|
||||||
|
};
|
||||||
|
|
||||||
|
base-nova = buildUpstream {
|
||||||
|
name = "base-nova";
|
||||||
|
outputs = [ "out" "coreObj" ];
|
||||||
|
KERNEL = "nova";
|
||||||
|
targets = [ "core" "timer" "lib/ld" ];
|
||||||
|
patches = basePatches;
|
||||||
|
postInstall = ''
|
||||||
|
mv $out/lib/ld-nova.lib.so $out/lib/ld.lib.so
|
||||||
|
mv $out/bin/nova_timer_drv $out/bin/timer_drv
|
||||||
|
install build/bin/core-nova.o $coreObj
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
# However, any package listed here with empty overrides ({ }) will be added to
|
# However, any package listed here with empty overrides ({ }) will be added to
|
||||||
# the package attributes of this flake.
|
# the package attributes of this flake.
|
||||||
|
|
||||||
{ buildPackages, ports }:
|
{ buildPackages, genodePackages, ports }:
|
||||||
with ports;
|
with ports;
|
||||||
let
|
let
|
||||||
|
self = genodePackages;
|
||||||
|
|
||||||
includeDir = pkg: buildPackages.lib.getDev pkg + "/include";
|
includeDir = pkg: buildPackages.lib.getDev pkg + "/include";
|
||||||
|
|
||||||
hostLibcInc = includeDir buildPackages.glibc;
|
hostLibcInc = includeDir buildPackages.glibc;
|
||||||
|
@ -41,6 +43,7 @@ in {
|
||||||
ipxe_nic_drv.portInputs = [ dde_ipxe ];
|
ipxe_nic_drv.portInputs = [ dde_ipxe ];
|
||||||
|
|
||||||
libc = {
|
libc = {
|
||||||
|
buildInputs = [ self.vfs ];
|
||||||
portInputs = [ libc ];
|
portInputs = [ libc ];
|
||||||
patches = [ ./libc.patch ];
|
patches = [ ./libc.patch ];
|
||||||
};
|
};
|
||||||
|
@ -59,7 +62,10 @@ in {
|
||||||
|
|
||||||
platform_drv = { };
|
platform_drv = { };
|
||||||
|
|
||||||
posix.portInputs = [ libc ];
|
posix = {
|
||||||
|
buildInputs = [ self.libc ];
|
||||||
|
portInputs = [ ports.libc ];
|
||||||
|
};
|
||||||
|
|
||||||
report_rom = { };
|
report_rom = { };
|
||||||
|
|
||||||
|
@ -80,12 +86,8 @@ in {
|
||||||
|
|
||||||
"test-log".patches = [ ./test-log.patch ];
|
"test-log".patches = [ ./test-log.patch ];
|
||||||
|
|
||||||
"test-pci".patches = [ ./test-pci.patch ];
|
|
||||||
|
|
||||||
"test-signal".patches = [ ./test-signal.patch ];
|
"test-signal".patches = [ ./test-signal.patch ];
|
||||||
|
|
||||||
"test-vmm_x86".patches = [ ./test-vmm_x86.patch ];
|
|
||||||
|
|
||||||
usb_drv.portInputs = [ dde_linux ];
|
usb_drv.portInputs = [ dde_linux ];
|
||||||
|
|
||||||
vbox5 = vbox5';
|
vbox5 = vbox5';
|
|
@ -0,0 +1,20 @@
|
||||||
|
# This file contains overrides necessary to build some Make targets.
|
||||||
|
|
||||||
|
{ buildPackages, genodePackages, ports }:
|
||||||
|
|
||||||
|
{
|
||||||
|
ping.targets = [ "app/ping" ];
|
||||||
|
|
||||||
|
test-pci = {
|
||||||
|
targets = [ "test/pci" ];
|
||||||
|
patches = [ ./test-pci.patch ];
|
||||||
|
};
|
||||||
|
|
||||||
|
test-rtc.targets = [ "test/rtc" ];
|
||||||
|
|
||||||
|
test-vmm_x86 = {
|
||||||
|
targets = [ "test/vmm_x86" ];
|
||||||
|
patches = [ ./test-vmm_x86.patch ];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
{ genodeSources }:
|
{ genodePackages }:
|
||||||
|
|
||||||
let port = genodeSources.ports.stdcxx;
|
let
|
||||||
|
inherit (genodePackages) genodeSources;
|
||||||
|
port = genodeSources.ports.stdcxx;
|
||||||
in genodeSources.buildUpstream {
|
in genodeSources.buildUpstream {
|
||||||
name = "stdcxx";
|
name = "stdcxx";
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
|
|
@ -2,18 +2,19 @@
|
||||||
name = "solo5-multi";
|
name = "solo5-multi";
|
||||||
machine = { pkgs, ... }: {
|
machine = { pkgs, ... }: {
|
||||||
genode.init.children.tests = {
|
genode.init.children.tests = {
|
||||||
configFile = "${./.}/solo5.dhall { isAarch64 = ${
|
configFile = builtins.toFile "solo5-multi.dhall"
|
||||||
|
"${./.}/solo5.dhall { isAarch64 = ${
|
||||||
if pkgs.stdenv.hostPlatform.isAarch64 then "True" else "False"
|
if pkgs.stdenv.hostPlatform.isAarch64 then "True" else "False"
|
||||||
} }";
|
} }";
|
||||||
inputs = with pkgs.genodePackages; [
|
inputs = with pkgs.genodePackages; [
|
||||||
solo5
|
|
||||||
solo5.tests
|
|
||||||
nic_bridge
|
nic_bridge
|
||||||
nic_loopback
|
nic_loopback
|
||||||
|
ping
|
||||||
sequence
|
sequence
|
||||||
|
solo5
|
||||||
|
solo5.tests
|
||||||
vfs_block
|
vfs_block
|
||||||
vfs_import
|
vfs_import
|
||||||
(genodeSources.make "app/ping")
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
machine = { pkgs, ... }: {
|
machine = { pkgs, ... }: {
|
||||||
genode.init.children.vmm = {
|
genode.init.children.vmm = {
|
||||||
configFile = ./vmm_x86.dhall;
|
configFile = ./vmm_x86.dhall;
|
||||||
inputs = map pkgs.genodeSources.make [ "test/vmm_x86" ];
|
inputs = with pkgs.genodePackages; [ test-vmm_x86 ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,14 @@
|
||||||
machine = { pkgs, ... }: {
|
machine = { pkgs, ... }: {
|
||||||
genode.init.subinits.test = {
|
genode.init.subinits.test = {
|
||||||
configFile = ./x86.dhall;
|
configFile = ./x86.dhall;
|
||||||
inputs = with pkgs.genodePackages;
|
inputs = with pkgs.genodePackages; [
|
||||||
[ acpi_drv platform_drv report_rom test-signal ]
|
acpi_drv
|
||||||
++ (map genodeSources.make [ "test/pci" "test/rtc" ]);
|
platform_drv
|
||||||
|
report_rom
|
||||||
|
test-signal
|
||||||
|
test-pci
|
||||||
|
test-rtc
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
testScript = ''
|
testScript = ''
|
||||||
|
|
Loading…
Reference in New Issue