2
0
Fork 0

Add aarch64 platform

Add the hw-virt_qemu platform to tests, rename hw to hw-pc.
This commit is contained in:
Emery Hemingway 2020-05-31 00:20:44 +05:30
parent 3f646b6fa6
commit 559f4aa3c0
17 changed files with 233 additions and 132 deletions

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
{ self, nixpkgs, nixpkgsLocal, packages }:
{ system, self, nixpkgs, nixpkgsLocal, packages }:
let
dhallApps = let
@ -68,6 +68,18 @@ in dhallApps // {
program = "${drv}/bin/generate-manifest";
};
render-init = let
drv = import ./render-init {
apps = self;
inherit nixpkgs packages;
};
in {
type = "app";
program = "${drv}/bin/render-init";
};
} // (if system == "x86_64-genode" then {
hw-image = let
drv = import ./hw-image {
stdenv = packages.stdenv;
@ -82,17 +94,6 @@ in dhallApps // {
''XDG_CACHE_HOME=$TMPDIR ${drv}/bin/hw-image "${bootDesc}" > $out'';
};
nova-image = let
drv = import ./nova-image {
stdenv = packages.stdenv;
apps = self;
inherit nixpkgs packages;
};
in {
type = "app";
program = "${drv}/bin/nova-image";
};
hw-iso = let
drv = import ./hw-iso {
stdenv = packages.stdenv;
@ -107,6 +108,17 @@ in dhallApps // {
''XDG_CACHE_HOME=$TMPDIR ${drv}/bin/hw-iso "${bootDesc}" > $out'';
};
nova-image = let
drv = import ./nova-image {
stdenv = packages.stdenv;
apps = self;
inherit nixpkgs packages;
};
in {
type = "app";
program = "${drv}/bin/nova-image";
};
nova-iso = let
drv = import ./nova-iso {
stdenv = packages.stdenv;
@ -121,14 +133,5 @@ in dhallApps // {
''XDG_CACHE_HOME=$TMPDIR ${drv}/bin/nova-iso "${bootDesc}" > $out'';
};
render-init = let
drv = import ./render-init {
apps = self;
inherit nixpkgs packages;
};
in {
type = "app";
program = "${drv}/bin/render-init";
};
}
} else
{ })

View File

@ -21,7 +21,6 @@ nixpkgs.writeScriptBin "hw-iso" (with nixpkgs.buildPackages;
out="hw.iso"
# build ISO layout
cp ${packages.NOVA}/hypervisor* boot/hypervisor
cp ${./isolinux.cfg} boot/syslinux/isolinux.cfg
cp \
$SYSLINUX/isolinux.bin \

View File

@ -10,7 +10,7 @@
outputs = { self, nixpkgs }:
let
localSystems = [ "x86_64-linux" ];
crossSystems = [ "x86_64-genode" ];
crossSystems = [ "aarch64-genode" "x86_64-genode" ];
forAllLocalSystems = f:
nixpkgs.lib.genAttrs localSystems (system: f system);
@ -70,6 +70,7 @@
# pass thru Nixpkgs
packages = forAllCrossSystems ({ system, localSystem, crossSystem }:
nixpkgs.lib.filterAttrs (n: v: v != null)
nixpkgsFor.${system}.genodePackages);
devShell = forAllLocalSystems (system:
@ -87,6 +88,7 @@
glibc.dev
gnumake
libxml2
qemu
tcl
which
xorriso
@ -109,6 +111,7 @@
apps = let
apps' = forAllCrossSystems ({ system, localSystem, crossSystem }:
import ./apps {
system = crossSystem;
self = self.apps.${system};
nixpkgs = nixpkgsFor.${system};
nixpkgsLocal = nixpkgsFor.${localSystem};
@ -121,12 +124,15 @@
import ./tests {
inherit self;
apps = self.apps.${system};
buildPackages = nixpkgsFor.${localSystem};
localPackages = nixpkgsFor.${localSystem};
genodepkgs = self.packages.${system};
lib = self.lib.${system};
nixpkgs = nixpkgsFor.${system};
legacyPackages = self.legacyPackages.${system};
});
in { x86_64-linux = checks'.x86_64-linux-x86_64-genode; };
in checks' // {
x86_64-linux = with builtins;
foldl' (x: y: x // y) { } (attrValues checks');
};
};
}

View File

@ -39,7 +39,7 @@ in rec {
> $out/config.dhall.bin
'';
hwImage = name: env: boot:
hwImage = coreLinkAddr: bootstrapLinkAddr: basePkg: name: env: boot:
nixpkgs.stdenv.mkDerivation {
name = name + "-hw-image";
build = compileBoot name env boot;
@ -80,9 +80,9 @@ in rec {
}
build_core \
"${testPkgs.base-hw-pc.coreObj}" \
"${basePkg.coreObj}" \
"$build/modules_asm" \
0xffffffc000000000 \
${coreLinkAddr} \
core.elf
dhall to-directory-tree --output bootstrap \
@ -90,9 +90,9 @@ in rec {
mkdir -p $out
build_core \
"${testPkgs.base-hw-pc.bootstrapObj}" \
"${basePkg.bootstrapObj}" \
bootstrap/modules_asm \
0x00200000 \
${bootstrapLinkAddr} \
$out/image.elf
'';
};

View File

@ -1,7 +1,22 @@
commit 848a25e8c97075ddead404beff15f122fd0fd624
Author: Emery Hemingway <ehmry@posteo.net>
Date: Tue Jun 2 11:37:03 2020 +0530
Genode support
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 6391f35684..f2ab802fb5 100644
index 6391f35684..fba459d066 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -229,7 +229,7 @@ case "${targ}" in
targ_archs="$targ_archs bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
want64=true
;;
- aarch64-*-elf | aarch64-*-rtems*)
+ aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
targ_defvec=aarch64_elf64_le_vec
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
want64=true
@@ -554,7 +554,7 @@ case "${targ}" in
targ_selvecs=hppa_elf32_vec
;;
@ -34,10 +49,18 @@ index c95acc681d..388c305636 100755
;;
qnx*)
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 3d0415c1aa..7cd96b6be4 100644
index 3d0415c1aa..177a82876f 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -139,7 +139,8 @@ case ${generic_target} in
@@ -123,6 +123,7 @@ generic_target=${cpu_type}-$vendor-$os
case ${generic_target} in
aarch64*-*-elf*) fmt=elf;;
aarch64*-*-fuchsia*) fmt=elf;;
+ aarch64*-*-genode*) fmt=elf;;
aarch64*-*-linux*) fmt=elf em=linux
case ${cpu}-${os} in
aarch64*-linux-gnu_ilp32) arch=aarch64:32 ;;
@@ -139,7 +140,8 @@ case ${generic_target} in
arm-*-phoenix*) fmt=elf ;;
arm-*-elf) fmt=elf ;;
@ -47,7 +70,7 @@ index 3d0415c1aa..7cd96b6be4 100644
arm-*-symbianelf*) fmt=elf em=symbian ;;
arm-*-kaos*) fmt=elf ;;
arm-*-conix*) fmt=elf ;;
@@ -213,6 +214,7 @@ case ${generic_target} in
@@ -213,6 +215,7 @@ case ${generic_target} in
i386-*-elfiamcu) fmt=elf arch=iamcu ;;
i386-*-elf*) fmt=elf ;;
i386-*-fuchsia*) fmt=elf ;;
@ -56,9 +79,18 @@ index 3d0415c1aa..7cd96b6be4 100644
i386-*-bsd*) fmt=aout em=386bsd ;;
i386-*-nacl*) fmt=elf em=nacl
diff --git a/ld/configure.tgt b/ld/configure.tgt
index fad8b2e5c8..04f7fa0e70 100644
index fad8b2e5c8..7179dbff3a 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -47,7 +47,7 @@ targ64_extra_libpath=
case "${targ}" in
aarch64_be-*-elf) targ_emul=aarch64elfb
targ_extra_emuls="aarch64elf aarch64elf32 aarch64elf32b armelfb armelf" ;;
-aarch64-*-elf | aarch64-*-rtems*)
+aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
targ_emul=aarch64elf
targ_extra_emuls="aarch64elf32 aarch64elf32b aarch64elfb armelf armelfb" ;;
aarch64-*-cloudabi*) targ_emul=aarch64cloudabi
@@ -115,7 +115,7 @@ arm-*-nto*) targ_emul=armnto ;;
arm-*-phoenix*) targ_emul=armelf ;;
armeb-*-elf | armeb-*-eabi*)

View File

@ -20,8 +20,10 @@ in {
++ [ "--without-bash-malloc" ]; # no sbrk please
});
binutils-unwrapped =
addPatches binutils-unwrapped [ ./binutils/support-genode.patch ];
binutils-unwrapped = overrideTargetAttrs binutils-unwrapped (attrs: {
patches = attrs.patches ++ [ ./binutils/support-genode.patch ];
nativeBuildInputs = [ final.updateAutotoolsGnuConfigScriptsHook ];
});
cmake = overrideTargetAttrs cmake (attrs: {
postInstall = with stdenv; ''
@ -56,8 +58,6 @@ in {
gdb = addPatches gdb [ ./gdb/genode.patch ];
inherit (final.genodeSources) genodeBase;
genodeLibcCross = callPackage ./libc { };
genodePackages = import ../packages { nixpkgs = final; };
@ -66,12 +66,13 @@ in {
libcCrossChooser = name:
if stdenv.targetPlatform.isGenode then
targetPackages.genodeLibcCross or genodeLibcCross
targetPackages.genodeLibcCross
else
prev.libcCrossChooser name;
llvmPackages_8 = callPackage ./llvm-8 ({
inherit (stdenvAdapters) overrideCC;
inherit (targetPackages.genodeSources) genodeBase;
buildLlvmTools = buildPackages.llvmPackages_8.tools;
targetLlvmLibraries = targetPackages.llvmPackages_8.libraries;
});

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
{ genodeSources, genodeBase, symlinkJoin }:
{ genodeSources, symlinkJoin }:
symlinkJoin {
name = "posix";

View File

@ -36,9 +36,9 @@ else
meta = with stdenv.lib;
src.meta // {
description =
"The NOVA OS Virtualization Architecture is a project aimed at constructing a secure virtualization environment with a small trusted computing base.";
description = "Microhypervisor";
homepage = "http://hypervisor.org/";
platforms = platforms.x86;
license = licenses.gpl2;
maintainers = [ maintainers.ehmry ];
};

View File

@ -35,6 +35,8 @@ let
};
in listToAttrs (map f names);
basePatches = [ ./genodelabs/cxx-align.patch ];
in depotPkgs // {
inherit stdenv genodeSources;
@ -44,20 +46,37 @@ in depotPkgs // {
KERNEL = "hw";
BOARD = "pc";
targets = [ "bootstrap" "core" "timer" "lib/ld" ];
patches = [ ./genodelabs/cxx-align.patch ];
patches = basePatches;
postInstall = ''
mv $out/core-hw-pc.o $coreObj
mv $out/bootstrap-hw-pc.o $bootstrapObj
mv $out/ld-hw.lib.so $out/ld.lib.so
mv $out/hw_timer_drv $out/timer_drv
'';
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/core-hw-virt_qemu.o $coreObj
mv $out/bootstrap-hw-virt_qemu.o $bootstrapObj
mv $out/ld-hw.lib.so $out/ld.lib.so
mv $out/hw_timer_drv $out/timer_drv
'';
meta.platforms = [ "aarch64-genode" ];
};
base-linux = buildUpstream {
name = "base-linux";
KERNEL = "linux";
targets = [ "core" "timer" "lib/ld" ];
patches = [ ./genodelabs/cxx-align.patch ];
patches = basePatches;
postInstall = ''
mkdir -p $out/lib
mv $out/ld-linux.lib.so $out/lib/ld.lib.so
@ -71,7 +90,7 @@ in depotPkgs // {
outputs = [ "out" "coreObj" ];
KERNEL = "nova";
targets = [ "core" "timer" "lib/ld" ];
patches = [ ./genodelabs/cxx-align.patch ];
patches = basePatches;
postInstall = ''
mv $out/core-nova.o $coreObj
mv $out/ld-nova.lib.so $out/ld.lib.so

View File

@ -5,17 +5,23 @@ with buildPackages;
let
version = "20.05";
genodeSources = let
platform = targetPackages.targetPlatform;
arch = with platform;
if isx86_64 then
"x86_64"
else
throw "unknown Genode arch for platform ${platform.system}";
platform = targetPackages.targetPlatform;
arch = with platform;
if isx86_64 then
"x86_64"
else if isAarch64 then
"arm_v8a"
else
throw "unknown Genode arch for platform ${platform.system}";
genodeSources = let
toolPrefix = if platform.isx86 then
"genode-x86-"
else if platform.isAarch64 then
"genode-aarch64-"
else
throw "unknown tool prefix for Genode arch ${arch}";
in stdenvNoCC.mkDerivation {
@ -43,14 +49,6 @@ let
stdenv' =
targetPackages.stdenvAdapters.overrideCC targetPackages.stdenv toolchain;
platform = stdenv'.targetPlatform;
arch = with platform;
if isx86_64 then
"x86_64"
else
throw "unknown Genode arch for platform ${platform.system}";
preparePort = name:
{ hash ? "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
, patches ? [ ], ... }@args:
@ -109,7 +107,8 @@ let
(import ./ports.nix { inherit buildPackages; });
buildUpstream = { name, targets, portInputs ? [ ], nativeBuildInputs ? [ ]
, patches ? [ ], enableParallelBuilding ? true, ... }@extraAttrs:
, patches ? [ ], enableParallelBuilding ? true, meta ? { }, ...
}@extraAttrs:
let havePatches = patches != [ ];
in stdenv'.mkDerivation (extraAttrs // {
@ -149,10 +148,12 @@ let
find build/bin -follow -type f -exec install -Dt $out '{}' \;
runHook postInstall
'';
meta = { platforms = stdenv.lib.platforms.genode; } // meta;
});
buildDepot = { name, apiOnly ? false, portInputs ? [ ]
, nativeBuildInputs ? [ ], ... }@extraAttrs:
, nativeBuildInputs ? [ ], meta ? { }, ... }@extraAttrs:
stdenv'.mkDerivation (extraAttrs // {
pname = name;
@ -202,6 +203,7 @@ let
runHook postInstall
'';
meta = { platforms = stdenv.lib.platforms.genode; } // meta;
});
buildOverrides = callPackage ./targets.nix { inherit ports; };

View File

@ -65,7 +65,10 @@ let
'';
} // {
isGNU = true;
targetPrefix = "genode-x86-";
targetPrefix = {
aarch64-genode = "genode-arm-";
x86_64-genode = "genode-x86-";
}.${stdenv.targetPlatform.system} or null;
};
wrapped = wrapCC cc;

View File

@ -22,9 +22,10 @@ in stdenv.mkDerivation {
patches = [ ./genode.patch ./elftool.patch ./time.patch ];
configurePhase = ''
configurePhase = with stdenv; ''
runHook preConfigure
sh configure.sh
${lib.optionalString (hostPlatform.isAarch64) "rm -fr tests/test_fpu"}
rm -fr tests/test_tls
runHook postConfigure
'';

View File

@ -80,7 +80,7 @@ index 147c245..d3efb36 100644
GENODE_LDFLAGS := -nostdlib -z max-page-size=$(CONFIG_GUEST_PAGE_SIZE) -shared \
-gc-sections --eh-frame-hdr --entry=0x0 -T genode/genode_rel.ld
diff --git a/bindings/genode/bindings.cc b/bindings/genode/bindings.cc
index 5785ae5..2b7db70 100644
index a4a4a34..6f439c6 100644
--- a/bindings/genode/bindings.cc
+++ b/bindings/genode/bindings.cc
@@ -44,8 +44,6 @@ extern struct mft1_note __solo5_mft1_note;
@ -92,7 +92,7 @@ index 5785ae5..2b7db70 100644
#include "../../tenders/common/mft.c"
namespace Solo5
@@ -111,32 +109,32 @@ struct Solo5::Device
@@ -117,32 +115,32 @@ struct Solo5::Device
{
virtual
solo5_result_t
@ -131,7 +131,7 @@ index 5785ae5..2b7db70 100644
return SOLO5_R_EINVAL; }
};
@@ -610,11 +608,44 @@ solo5_block_read(solo5_handle_t handle, solo5_off_t offset,
@@ -615,11 +613,44 @@ solo5_block_read(solo5_handle_t handle, solo5_off_t offset,
solo5_result_t
@ -177,7 +177,7 @@ index 5785ae5..2b7db70 100644
} // extern "C"
@@ -632,7 +663,7 @@ void Component::construct(Genode::Env &env)
@@ -637,7 +668,7 @@ void Component::construct(Genode::Env &env)
mft_get_builtin_mft1(&__solo5_mft1_note, &mft, &mft_size);
if (mft_validate(mft, mft_size) != 0) {
@ -216,18 +216,16 @@ index 0f1ca5c..0000000
-uintptr_t SSP_GUARD;
-void SSP_FAIL (void) { }
diff --git a/configure.sh b/configure.sh
index f762933..e75f41a 100755
index 0828409..61fa885 100755
--- a/configure.sh
+++ b/configure.sh
@@ -233,6 +233,23 @@ config_host_openbsd()
@@ -254,6 +254,21 @@ config_host_openbsd()
CONFIG_GENODE=
}
+config_host_genode()
+{
+ cc_is_clang || die "Only Clang is supported on Genode"
+ [ "${CONFIG_ARCH}" = "x86_64" ] ||
+ die "Only 'x86_64' is supported on Genode"
+
+ MAKECONF_CXXFLAGS="-mno-retpoline -Wno-mismatched-tags -Wno-undefined-bool-conversion -Wno-uninitialized -Wno-unknown-attributes -Wno-unused-variable -Wno-unused-parameter"
+ MAKECONF_LDFLAGS="-nopie"
@ -243,7 +241,7 @@ index f762933..e75f41a 100755
# Check for a tools-only build.
OPT_ONLY_TOOLS=
if [ -n "$1" ]; then
@@ -245,6 +262,7 @@ fi
@@ -266,6 +281,7 @@ fi
# Allow external override of CC.
CC=${CC:-cc}
@ -251,18 +249,22 @@ index f762933..e75f41a 100755
LD=${LD:-ld}
CC_MACHINE=$(${CC} -dumpmachine)
@@ -272,6 +290,10 @@ case ${CC_MACHINE} in
@@ -293,6 +309,14 @@ case ${CC_MACHINE} in
CONFIG_ARCH=x86_64 CONFIG_HOST=OpenBSD
CONFIG_GUEST_PAGE_SIZE=0x1000
;;
+ x86_64-*genode*)
+ CONFIG_ARCH=x86_64 CONFIG_HOST=Genode
+ CONFIG_GUEST_PAGE_SIZE=0x1000
+ ;;
+ aarch64-*genode*)
+ CONFIG_ARCH=aarch64 CONFIG_HOST=Genode
+ CONFIG_GUEST_PAGE_SIZE=0x1000
+ ;;
*)
die "Unsupported toolchain target: ${CC_MACHINE}"
;;
@@ -303,6 +325,9 @@ case "${CONFIG_HOST}" in
@@ -325,6 +349,9 @@ case "${CONFIG_HOST}" in
OpenBSD)
config_host_openbsd
;;
@ -272,7 +274,7 @@ index f762933..e75f41a 100755
*)
die "Unsupported build OS: ${CONFIG_HOST}"
;;
@@ -315,7 +340,7 @@ esac
@@ -337,7 +364,7 @@ esac
# GNU make. Given the differences in quoting rules between the two
# (unable to sensibly use VAR="VALUE"), our convention is as follows:
#
@ -281,7 +283,7 @@ index f762933..e75f41a 100755
# available to Makefiles.
#
# 2. Shell scripts parse the subset of *lines* starting with "CONFIG_". I.e.
@@ -333,11 +358,13 @@ CONFIG_VIRTIO=${CONFIG_VIRTIO}
@@ -355,11 +382,13 @@ CONFIG_VIRTIO=${CONFIG_VIRTIO}
CONFIG_MUEN=${CONFIG_MUEN}
CONFIG_GENODE=${CONFIG_GENODE}
MAKECONF_CFLAGS=${MAKECONF_CFLAGS}

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: CC0-1.0
{ genodeSources, genodeBase }:
{ genodeSources }:
let port = genodeSources.ports.stdcxx;
in genodeSources.buildUpstream {
@ -8,7 +8,7 @@ in genodeSources.buildUpstream {
outputs = [ "out" "dev" ];
targets = [ "LIB=stdcxx" ];
portInputs = [ genodeSources.ports.libc port ];
propagatedBuildInputs = [ genodeBase ];
propagatedBuildInputs = [ genodeSources.genodeBase ];
STDCXX_PORT = port;
postInstall = ''

View File

@ -1,25 +1,21 @@
# SPDX-License-Identifier: CC0-1.0
{ self, apps, buildPackages, genodepkgs, lib, nixpkgs, legacyPackages }:
{ self, apps, localPackages, genodepkgs, lib, nixpkgs, legacyPackages }:
let
callTest = path:
import path {
pkgs = testPkgs;
inherit nixpkgs buildPackages legacyPackages;
inherit nixpkgs localPackages legacyPackages;
};
testFiles = map callTest [
./log.nix
./posix.nix
./vmm_x86.nix
./x86.nix
] ++ (callTest ./solo5);
testFiles = map callTest [ ./log.nix ./posix.nix ./vmm_x86.nix ./x86.nix ]
++ (callTest ./solo5);
testPkgs = genodepkgs;
qemu' = buildPackages.qemu_test;
qemu' = localPackages.qemu;
qemuBinary = qemuPkg:
{
@ -27,14 +23,17 @@ let
x86_64-genode = "${qemuPkg}/bin/qemu-system-x86_64";
}.${genodepkgs.stdenv.hostPlatform.system};
platforms = [
cores = [
{
prefix = "hw-pc-";
specs = [ "x86" "hw" ];
basePkg = testPkgs.base-hw-pc;
makeImage = lib.hwImage;
platforms = [ "x86_64-genode" ];
basePackages = [ testPkgs.base-hw-pc ]
++ map testPkgs.genodeSources.depot [ "rtc_drv" ];
makeImage =
lib.hwImage "0xffffffc000000000" "0x00200000" testPkgs.base-hw-pc;
startVM = vmName: image: ''
#! ${buildPackages.runtimeShell}
#! ${localPackages.runtimeShell}
exec ${qemuBinary qemu'} \
-name ${vmName} \
-machine q35 \
@ -45,13 +44,35 @@ let
"$@"
'';
}
{
prefix = "hw-virt_qemu-";
specs = [ "aarch64" "hw" ];
platforms = [ "aarch64-genode" ];
basePackages = with testPkgs; [ base-hw-virt_qemu rtc-dummy ];
makeImage = lib.hwImage "0xffffffc000000000" "0x40000000"
testPkgs.base-hw-virt_qemu;
startVM = vmName: image: ''
#! ${localPackages.runtimeShell}
exec ${qemuBinary qemu'} \
-name ${vmName} \
-M virt,virtualization=true,gic_version=3 \
-cpu cortex-a53 \
-smp 4 \
-m 384 \
-kernel "${image}/image.elf" \
$QEMU_OPTS \
"$@"
'';
}
{
prefix = "nova-";
specs = [ "x86" "nova" ];
basePkg = testPkgs.base-nova;
platforms = [ "x86_64-genode" ];
basePackages = [ testPkgs.base-nova ]
++ map testPkgs.genodeSources.depot [ "rtc_drv" ];
makeImage = lib.novaImage;
startVM = vmName: image: ''
#! ${buildPackages.runtimeShell}
#! ${localPackages.runtimeShell}
exec ${qemuBinary qemu'} \
-name ${vmName} \
-machine q35 \
@ -64,7 +85,11 @@ let
}
];
testDriver = with buildPackages;
cores' = builtins.filter (core:
builtins.any (x: x == genodepkgs.stdenv.hostPlatform.system) core.platforms)
cores;
testDriver = with localPackages;
let testDriverScript = ./test-driver/test-driver.py;
in stdenv.mkDerivation {
name = "nixos-test-driver";
@ -101,8 +126,8 @@ let
machine.wait_until_serial_output('child "init" exited with exit value 0')
'';
makeTest = with buildPackages;
{ prefix, specs, basePkg, makeImage, startVM }:
makeTest = with localPackages;
{ prefix, specs, platforms, basePackages, makeImage, startVM }:
{ name ? "unnamed", testScript ? defaultTestScript,
# Skip linting (mainly intended for faster dev cycles)
skipLint ? false, ... }@t:
@ -113,7 +138,7 @@ let
buildVM = vmName:
{ config, inputs, env ? { }, extraPaths ? [ ] }:
let
storeTarball = buildPackages.runCommand "store" { } ''
storeTarball = localPackages.runCommand "store" { } ''
mkdir -p $out
tar cf "$out/store.tar" --absolute-names ${toString inputs} ${
toString extraPaths
@ -136,14 +161,13 @@ let
};
storeManifest = lib.mergeManifests (map addManifest inputs);
manifest = lib.mergeManifests (map addManifest
([ basePkg testPkgs.sotest-producer storeTarball ]
++ map testPkgs.genodeSources.depot [
"init"
"rtc_drv"
"vfs"
"cached_fs_rom"
]));
manifest = lib.mergeManifests (map addManifest (basePackages
++ [ testPkgs.sotest-producer storeTarball ]
++ map testPkgs.genodeSources.depot [
"init"
"vfs"
"cached_fs_rom"
]));
config' = "${
./test-wrapper.dhall
} (${config}) $(stat --format '%s' ${storeTarball}/store.tar) ${storeManifest} ${manifest}";
@ -155,7 +179,7 @@ let
image = makeImage vmName env' config';
startVM' = startVM vmName image;
in {
script = buildPackages.writeScriptBin "run-${vmName}-vm" startVM';
script = localPackages.writeScriptBin "run-${vmName}-vm" startVM';
config = lib.runDhallCommand (name + ".dhall") env' ''
${apps.dhall.program} <<< "${config'}" > $out
@ -246,16 +270,16 @@ let
test // { inherit nodes driver test; };
testList = let
f = platform:
let makeTest' = makeTest platform;
f = core:
let makeTest' = makeTest core;
in test:
if (test.constraints or (_: true)) platform.specs then {
name = platform.prefix + test.name;
if (test.constraints or (_: true)) core.specs then {
name = core.prefix + test.name;
value = makeTest' test;
} else
null;
in lib.lists.crossLists f [ platforms testFiles ];
in lib.lists.crossLists f [ cores' testFiles ];
in builtins.listToAttrs (builtins.filter (_: _ != null) testList)
@ -278,7 +302,7 @@ in builtins.listToAttrs (builtins.filter (_: _ != null) testList)
load = [ "hypervisor serial novga iommu" test.image.name ];
}) novaTests);
in buildPackages.stdenv.mkDerivation {
in localPackages.stdenv.mkDerivation {
name = "sotest";
buildCommand = ''
mkdir zip; cd zip
@ -288,7 +312,7 @@ in builtins.listToAttrs (builtins.filter (_: _ != null) testList)
(map (test: "cp ${test.image}/image.elf ${test.name}.image.elf")
allTests)}
mkdir -p $out/nix-support
${buildPackages.zip}/bin/zip "$out/binaries.zip" *
${localPackages.zip}/bin/zip "$out/binaries.zip" *
cat << EOF > "$out/project.json"
${builtins.toJSON projectCfg}
EOF

View File

@ -19,7 +19,9 @@ in map solo5Test [
{
name = "multi";
machine = {
config = "${./.}/solo5.dhall";
config = "${./.}/solo5.dhall { isAarch64 = ${
if pkgs.stdenv.hostPlatform.isAarch64 then "True" else "False"
} }";
inputs = map genodeMake [ "app/ping" ] ++ (map genodeDepot [
"ram_block"
"nic_bridge"

View File

@ -29,16 +29,23 @@ let toSimple =
}
}
let tests
: Prelude.Map.Type Text Child.Type
= [ { mapKey = "quiet", mapValue = toSimple "quiet" }
, { mapKey = "hello", mapValue = toSimple "hello" }
, { mapKey = "globals", mapValue = toSimple "globals" }
, { mapKey = "fpu", mapValue = toSimple "fpu" }
, { mapKey = "time", mapValue = ./time.dhall }
, { mapKey = "blk", mapValue = ./blk.dhall }
, { mapKey = "net", mapValue = ./net.dhall }
, { mapKey = "net_2if", mapValue = ./net_2if.dhall }
]
in λ(params : { isAarch64 : Bool })
→ let tests
: Prelude.Map.Type Text Child.Type
= toMap
{ quiet = toSimple "quiet"
, hello = toSimple "hello"
, globals = toSimple "globals"
, time = ./time.dhall
, blk = ./blk.dhall
, net = ./net.dhall
, net_2if = ./net_2if.dhall
}
# ( if params.isAarch64
in Test::{ children = tests }
then Prelude.Map.empty Text Child.Type
else toMap { fpu = toSimple "fpu" }
)
in Test::{ children = tests }