2
0
Fork 0

Simplify packages layout

llvm-11
Emery Hemingway 2 years ago
parent ddc65a8087
commit df5be1d6dc
  1. 7
      overlay/default.nix
  2. 8
      overlay/libc/default.nix
  3. 86
      packages/default.nix
  4. 116
      packages/genodelabs/default.nix
  5. 14
      packages/genodelabs/depot-targets.nix
  6. 20
      packages/genodelabs/make-targets.nix
  7. 6
      packages/stdcxx/default.nix
  8. 9
      tests/solo5/multi.nix
  9. 2
      tests/vmm_x86.nix
  10. 11
      tests/x86.nix

@ -69,12 +69,9 @@ in {
genodePackages = import ../packages {
inherit flake;
nixpkgs = final;
pkgs = final;
};
genodeSources =
buildPackages.callPackage ../packages/genodelabs { inherit flake; };
libconfig = overrideHostAttrs libconfig
(attrs: { configureFlags = [ "--disable-examples" ]; });
@ -101,7 +98,7 @@ in {
llvmPackages_8 = callPackage ./llvm-8 ({
inherit (stdenvAdapters) overrideCC;
inherit (targetPackages.genodeSources) genodeBase;
inherit (final.genodePackages.genodeSources) genodeBase;
buildLlvmTools = buildPackages.llvmPackages_8.tools;
targetLlvmLibraries = targetPackages.llvmPackages_8.libraries;
});

@ -1,8 +1,8 @@
{ genodeSources, symlinkJoin }:
symlinkJoin {
{ genodePackages, symlinkJoin }:
let inherit (genodePackages) genodeSources;
in symlinkJoin {
name = "posix";
paths = map genodeSources.depot [ "libc" "posix" ];
paths = with genodePackages; [ libc posix ];
postBuild = ''
local headerDir="''${!outputDev}/include"
mkdir -p "$headerDir"

@ -1,9 +1,10 @@
{ flake, nixpkgs }:
{ flake, pkgs }:
let
inherit (nixpkgs)
buildPackages callPackage fetchFromGitHub fetchgit genodeSources stdenv;
inherit (genodeSources) buildUpstream;
upstream = import ./genodelabs { inherit flake pkgs; };
inherit (upstream) genodeSources;
inherit (pkgs) buildPackages callPackage fetchFromGitHub fetchgit stdenv;
dhallPackages =
flake.inputs.nixpkgs.legacyPackages.x86_64-linux.callPackage ./dhall { };
@ -22,80 +23,7 @@ let
'';
});
depotPkgs = with builtins;
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
'';
};
in upstream // {
bender = buildPackages.callPackage ./bender { };
@ -103,8 +31,6 @@ in depotPkgs // {
dhallGenode = dhallPackages.genode;
init = genodeSources.depot "init";
nic_bus = callPackage ./nic_bus { };
NOVA = callPackage ./NOVA { };

@ -1,7 +1,9 @@
{ flake, buildPackages, targetPackages }:
{ flake, pkgs }:
let
platform = targetPackages.targetPlatform;
inherit (pkgs) lib buildPackages targetPackages;
platform = pkgs.targetPlatform;
arch = with platform;
if isx86_64 then
@ -11,8 +13,6 @@ let
else
throw "unknown Genode arch for platform ${platform.system}";
inherit (buildPackages) callPackage fetchurl lib;
upstreamSources = flake.inputs.genode;
genodeSources =
@ -61,7 +61,7 @@ let
let
havePatches = patches != [ ];
version = portVersions.${name};
in with buildPackages;
in with buildPackages.buildPackages;
stdenvNoCC.mkDerivation (args // {
name = name + "-port-" + version;
inherit version patches;
@ -121,10 +121,9 @@ let
# The "ports" mechanism is hardly deterministic, so prepare with
# a pinned nixpkgs revision for a pinned platform.
toolchain = callPackage ./toolchain.nix { };
toolchain = buildPackages.buildPackages.callPackage ./toolchain.nix { };
stdenv' =
targetPackages.stdenvAdapters.overrideCC targetPackages.stdenv toolchain;
stdenv' = pkgs.stdenvAdapters.overrideCC pkgs.stdenv toolchain;
buildUpstream =
# Build from the Genode sources
@ -179,14 +178,14 @@ let
buildDepot =
# Build a Depot target from the Genode sources
{ name, apiOnly ? false, portInputs ? [ ], nativeBuildInputs ? [ ]
, meta ? { }, ... }@extraAttrs:
, buildInputs ? [ ], meta ? { }, ... }@extraAttrs:
stdenv'.mkDerivation (extraAttrs // {
pname = name;
inherit (genodeSources) version;
enableParallelBuilding = true;
nativeBuildInputs = with buildPackages;
nativeBuildInputs = with buildPackages.buildPackages;
[ binutils bison flex stdenv.cc tcl which ] ++ nativeBuildInputs;
src = genodeSources;
@ -234,7 +233,21 @@ let
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;
[ ]
@ -283,20 +296,69 @@ let
'';
};
in genodeSources // {
inherit buildUpstream buildDepot ports specs toolchain genodeBase;
make = target:
let
name = builtins.replaceStrings [ "/" ] [ "-" ] target;
attrs = buildOverrides.${name} or { };
in buildUpstream ({
inherit name;
targets = [ target ];
} // attrs);
depot = name:
let attrs = buildOverrides.${name} or { };
in buildDepot ({ inherit name; } // attrs);
basePatches = [ ./cxx-align.patch ];
in makePackages // depotPackages // {
genodeSources = genodeSources // {
inherit buildUpstream buildDepot genodeBase ports specs toolchain;
};
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
# the package attributes of this flake.
{ buildPackages, ports }:
{ buildPackages, genodePackages, ports }:
with ports;
let
self = genodePackages;
includeDir = pkg: buildPackages.lib.getDev pkg + "/include";
hostLibcInc = includeDir buildPackages.glibc;
@ -41,6 +43,7 @@ in {
ipxe_nic_drv.portInputs = [ dde_ipxe ];
libc = {
buildInputs = [ self.vfs ];
portInputs = [ libc ];
patches = [ ./libc.patch ];
};
@ -59,7 +62,10 @@ in {
platform_drv = { };
posix.portInputs = [ libc ];
posix = {
buildInputs = [ self.libc ];
portInputs = [ ports.libc ];
};
report_rom = { };
@ -80,12 +86,8 @@ in {
"test-log".patches = [ ./test-log.patch ];
"test-pci".patches = [ ./test-pci.patch ];
"test-signal".patches = [ ./test-signal.patch ];
"test-vmm_x86".patches = [ ./test-vmm_x86.patch ];
usb_drv.portInputs = [ dde_linux ];
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 {
name = "stdcxx";
outputs = [ "out" "dev" ];

@ -2,18 +2,19 @@
name = "solo5-multi";
machine = { pkgs, ... }: {
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"
} }";
inputs = with pkgs.genodePackages; [
solo5
solo5.tests
nic_bridge
nic_loopback
ping
sequence
solo5
solo5.tests
vfs_block
vfs_import
(genodeSources.make "app/ping")
];
};
};

@ -6,7 +6,7 @@
machine = { pkgs, ... }: {
genode.init.children.vmm = {
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, ... }: {
genode.init.subinits.test = {
configFile = ./x86.dhall;
inputs = with pkgs.genodePackages;
[ acpi_drv platform_drv report_rom test-signal ]
++ (map genodeSources.make [ "test/pci" "test/rtc" ]);
inputs = with pkgs.genodePackages; [
acpi_drv
platform_drv
report_rom
test-signal
test-pci
test-rtc
];
};
};
testScript = ''

Loading…
Cancel
Save