This commit is contained in:
Emery Hemingway 2022-04-24 01:35:10 -05:00
parent ad9261c0ac
commit 9a12b98960
13 changed files with 102 additions and 63 deletions

View File

@ -70,8 +70,8 @@
with builtins; with builtins;
let let
pkg' = prev.getOutput output pkg; pkg' = prev.getOutput output pkg;
erisInfo = erisInfo = fromJSON (builtins.unsafeDiscardStringContext
fromJSON (readFile "${pkg'}/nix-support/eris-manifest.json"); (readFile "${pkg'}/nix-support/eris-manifest.json"));
caps = filter caps = filter
({ path, ... }: prev.strings.hasPrefix "${pkg'}/${output}" path) ({ path, ... }: prev.strings.hasPrefix "${pkg'}/${output}" path)
(prev.attrsets.mapAttrsToList (path: (prev.attrsets.mapAttrsToList (path:
@ -90,7 +90,8 @@
pkg' = prev.getOutput output pkg; pkg' = prev.getOutput output pkg;
path' = "${pkg'}/${output}/${file}"; path' = "${pkg'}/${output}/${file}";
erisInfo = erisInfo =
fromJSON (readFile "${pkg'}/nix-support/eris-manifest.json"); fromJSON (builtins.unsafeDiscardStringContext
(readFile "${pkg'}/nix-support/eris-manifest.json"));
caps = filter ({ path, ... }: path == path') caps = filter ({ path, ... }: path == path')
(prev.attrsets.mapAttrsToList (path: (prev.attrsets.mapAttrsToList (path:
{ cap, closure }: { { cap, closure }: {

View File

@ -2,8 +2,8 @@
"enabled": 1, "enabled": 1,
"hidden": 1, "hidden": 1,
"type": 1, "type": 1,
"flake": "git+https://git.sr.ht/~ehmry/genodepkgs", "flake": "git+https://gitea.c3d2.de/ehmry/sigil.git",
"description": "Genode Nix packages", "description": "Sigil distro",
"checkinterval": 300, "checkinterval": 300,
"schedulingshares": 100, "schedulingshares": 100,
"enableemail": false, "enableemail": false,

View File

@ -1,7 +1,9 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib; with lib;
let toDhall = lib.generators.toDhall { }; let
cfg = config.hardware.genode;
toDhall = lib.generators.toDhall { };
in { in {
imports = [ ./ahci.nix ./framebuffer.nix ./nic.nix ./usb.nix ]; imports = [ ./ahci.nix ./framebuffer.nix ./nic.nix ./usb.nix ];

View File

@ -1,7 +1,9 @@
# Builds a compressed EFI System Partition image # Builds a compressed EFI System Partition image
{ config, lib, pkgs }: { config, lib, pkgs }:
pkgs.stdenv.mkDerivation { let cfg = config.block.partitions;
in pkgs.stdenv.mkDerivation {
name = "boot.qcow2"; name = "boot.qcow2";
nativeBuildInputs = with pkgs.buildPackages.buildPackages; [ nativeBuildInputs = with pkgs.buildPackages.buildPackages; [
@ -20,12 +22,12 @@ pkgs.stdenv.mkDerivation {
# Concatentenate the ESP # Concatentenate the ESP
espByteOffset=$(stat --printf='%s' $img) espByteOffset=$(stat --printf='%s' $img)
zstdcat ${esp.image} >> $img zstdcat ${cfg.esp.image} >> $img
truncate --size=%1M $img truncate --size=%1M $img
# Concatenate the store # Concatenate the store
storeByteOffset=$(stat --printf='%s' $img) storeByteOffset=$(stat --printf='%s' $img)
zstdcat ${store.image} >> $img zstdcat ${cfg.store.image} >> $img
truncate --size=%1M $img truncate --size=%1M $img
# Pad the end of the image # Pad the end of the image
@ -38,8 +40,8 @@ pkgs.stdenv.mkDerivation {
sfdisk $img <<EOF sfdisk $img <<EOF
label: gpt label: gpt
label-id: $disklabel label-id: $disklabel
start=$(( $storeByteOffset / $sectorSize )), uuid=${config.block.partitions.store.guid}, type=${store.gptType} start=$(( $storeByteOffset / $sectorSize )), uuid=${cfg.store.guid}, type=${cfg.store.gptType}
start=$(( $espByteOffset / $sectorSize )), uuid=${config.block.partitions.esp.guid}, type=${esp.gptType} start=$(( $espByteOffset / $sectorSize )), uuid=${cfg.esp.guid}, type=${cfg.esp.gptType}
EOF EOF
sfdisk --reorder $img sfdisk --reorder $img

View File

@ -208,7 +208,8 @@ in nullPkgs // {
++ builtins.filter (x: x != "bin" && x != "out") attrs.outputs; ++ builtins.filter (x: x != "bin" && x != "out") attrs.outputs;
patches = attrs.patches or [ ] ++ [ ./openssl/genode.patch ]; patches = attrs.patches or [ ] ++ [ ./openssl/genode.patch ];
configureScript = { configureScript = {
x86_64-genode = "./Configure Genode-x86_64"; x86_64-genode = "./Configure genode-x86_64";
aarch64-genode = "./Configure genode-aarch64";
}.${stdenv.hostPlatform.system} or (throw }.${stdenv.hostPlatform.system} or (throw
"Not sure what configuration to use for ${stdenv.hostPlatform.config}"); "Not sure what configuration to use for ${stdenv.hostPlatform.config}");
configureFlags = attrs.configureFlags ++ [ "no-devcryptoeng" ]; configureFlags = attrs.configureFlags ++ [ "no-devcryptoeng" ];

View File

@ -112,7 +112,8 @@ in stdenv.mkDerivation (rec {
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"-DCMAKE_CROSSCOMPILING=True" "-DCMAKE_CROSSCOMPILING=True"
"-DLLVM_TABLEGEN=${buildPackages.llvm_10}/bin/llvm-tblgen" "-DLLVM_TABLEGEN=${buildPackages.llvm_10}/bin/llvm-tblgen"
]; ] ++ optional (stdenv.targetPlatform.isx86) "-DLLVM_TARGETS_TO_BUILD=X86"
++ optional (stdenv.targetPlatform.isAarch64) "-DLLVM_TARGETS_TO_BUILD=AArch64";
postBuild = '' postBuild = ''
rm -fR $out rm -fR $out

View File

@ -1,31 +1,44 @@
diff -ur a/Configurations/10-main.conf b/Configurations/10-main.conf --- a/Configurations/10-main.conf 2021-03-25 08:28:38.000000000 -0500
--- a/Configurations/10-main.conf 2019-09-10 18:43:07.000000000 +0530 +++ b/Configurations/10-main.conf 2022-04-24 14:10:45.424394509 -0500
+++ b/Configurations/10-main.conf 2020-05-27 16:03:09.416462556 +0530 @@ -1567,6 +1567,42 @@
@@ -1559,6 +1559,28 @@ perlasm_scheme => "ios64",
perlasm_scheme => "macosx",
}, },
+##### Genode +##### Genode
+ "Genode-x86_32" => { + "genode-generic32" => {
+ inherit_from => [ "BASE_unix" ], + inherit_from => [ "BASE_unix" ],
+ CC => "cc", + CC => "cc",
+ CFLAGS => picker(default => "-Wall", + CFLAGS => picker(default => "-Wall",
+ debug => "-O0 -g", + debug => "-O0 -g",
+ release => "-O3"), + release => "-O3"),
+ cflags => threads("-pthread"),
+ cppflags => threads("-D_THREAD_SAFE -D_REENTRANT"), + cppflags => threads("-D_THREAD_SAFE -D_REENTRANT"),
+ bn_ops => "BN_LLONG", + bn_ops => "BN_LLONG",
+ thread_scheme => "pthreads", + thread_scheme => "pthreads",
+ dso_scheme => "dlfcn", + dso_scheme => "dlfcn",
+ shared_target => "linux-shared", + shared_target => "bsd-shared",
+ shared_cflag => "-fPIC", + shared_cflag => "-fPIC",
+ shared_extension => ".so", + shared_extension => ".so",
+ perlasm_scheme => "elf", + perlasm_scheme => "elf",
+ }, + },
+ "Genode-x86_64" => { + "genode-generic64" => {
+ inherit_from => [ "Genode-x86_32", asm("x86_64_asm") ], + inherit_from => [ "genode-generic32" ],
+ bn_ops => "SIXTY_FOUR_BIT_LONG",
+ },
+
+ "genode-x86_32" => {
+ inherit_from => [ "genode-generic32", asm("x86_asm") ],
+ lib_cppflags => add("-DL_ENDIAN"),
+ bn_ops => "BN_LLONG",
+ },
+ "genode-x86_64" => {
+ inherit_from => [ "genode-generic64", asm("x86_64_asm") ],
+ lib_cppflags => add("-DL_ENDIAN"), + lib_cppflags => add("-DL_ENDIAN"),
+ bn_ops => "SIXTY_FOUR_BIT_LONG", + bn_ops => "SIXTY_FOUR_BIT_LONG",
+ }, + },
+ "genode-aarch64" => {
+ inherit_from => [ "genode-generic64", asm("aarch64_asm") ],
+ },
+ +
##### GNU Hurd ##### GNU Hurd
"hurd-x86" => { "hurd-x86" => {

View File

@ -118,6 +118,7 @@ let
'' ''
runHook preInstall runHook preInstall
chmod -R +w $CONTRIB_DIR/* chmod -R +w $CONTRIB_DIR/*
find $CONTRIB_DIR/* -name cache -exec rm -rf {} \; || true
find $CONTRIB_DIR/* -name .git -exec rm -rf {} \; || true find $CONTRIB_DIR/* -name .git -exec rm -rf {} \; || true
find $CONTRIB_DIR/* -name .svn -exec rm -rf {} \; || true find $CONTRIB_DIR/* -name .svn -exec rm -rf {} \; || true
find $CONTRIB_DIR/* -name '*.t?z' -exec rm -rf {} \; || true find $CONTRIB_DIR/* -name '*.t?z' -exec rm -rf {} \; || true

View File

@ -0,0 +1,13 @@
diff --git a/repos/libports/ports/libc.port b/repos/libports/ports/libc.port
index 927cf923a6..b276c57968 100644
--- a/repos/libports/ports/libc.port
+++ b/repos/libports/ports/libc.port
@@ -4,7 +4,7 @@ DOWNLOADS = libc.archive
D = src/lib/libc
-URL(libc) = http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/src.txz
+URL(libc) = http://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/amd64/12.0-RELEASE/src.txz
SHA(libc) = 0da393ac2174168a71c1c527d1453e07372295187d05c288250800cb152a889b
DIR(libc) = $(D)

View File

@ -1,31 +1,32 @@
diff --git a/repos/os/src/test/vmm_x86/component.cc b/repos/os/src/test/vmm_x86/component.cc diff --git a/repos/os/src/test/vmm_x86/component.cc b/repos/os/src/test/vmm_x86/component.cc
index 1bfbd58db7..d56a561061 100644 index 408c1088e2..1672f2a468 100644
--- a/repos/os/src/test/vmm_x86/component.cc --- a/repos/os/src/test/vmm_x86/component.cc
+++ b/repos/os/src/test/vmm_x86/component.cc +++ b/repos/os/src/test/vmm_x86/component.cc
@@ -492,8 +492,9 @@ class Vmm { @@ -530,6 +530,8 @@ class Vmm::Main
{
private: private:
- Genode::Signal_handler<Vmm> _destruct_handler; + Genode::Env &_env;
- Genode::Reconstructible<Vm> _vm; +
+ Genode::Env &_env; Signal_handler<Main> _destruct_handler;
+ Genode::Signal_handler<Vmm> _destruct_handler; Reconstructible<Vm> _vm;
+ Genode::Reconstructible<Vm> _vm;
void _destruct() @@ -540,14 +542,16 @@ class Vmm::Main
{
@@ -502,12 +503,14 @@ class Vmm {
_vm.destruct(); _vm.destruct();
Genode::log("vmm test finished"); log("vmm test finished");
+ _env.parent().exit(0); + _env.parent().exit(0);
} }
public: public:
Vmm(Genode::Env &env) Main(Env &env)
: :
- _destruct_handler(env.ep(), *this, &Main::_destruct),
- _vm(env, _destruct_handler)
+ _env(env), + _env(env),
_destruct_handler(env.ep(), *this, &Vmm::_destruct), + _destruct_handler(_env.ep(), *this, &Main::_destruct),
_vm(env, _destruct_handler) + _vm(_env, _destruct_handler)
{ {
}
};

View File

@ -12,9 +12,9 @@ with pkgs;
}; };
coreutils.hash = "sha256-ZVlFfLghHcXxwwRsN5xw2bVdIvvXoCNj2oZniOlSXrg="; coreutils.hash = "sha256-ZVlFfLghHcXxwwRsN5xw2bVdIvvXoCNj2oZniOlSXrg=";
curl.hash = "sha256-5+nRKLrho9oO0XlzDO6ppZ2kLfWaIReY24YFYSQT7Xc="; curl.hash = "sha256-5+nRKLrho9oO0XlzDO6ppZ2kLfWaIReY24YFYSQT7Xc=";
dde_bsd.hash = "sha256-KPA/ua3jETcHgWzhfhFm6ppds55Xi5YXJKDJvufJmU8="; # dde_bsd.hash = "sha256-KPA/ua3jETcHgWzhfhFm6ppds55Xi5YXJKDJvufJmU8=";
dde_ipxe.hash = "sha256-rnMbramSDYBEjfSMoNpFcUQ4jfJh6SIHMtieSy9/Fe4="; dde_ipxe.hash = "sha256-rnMbramSDYBEjfSMoNpFcUQ4jfJh6SIHMtieSy9/Fe4=";
dde_linux.hash = "sha256-PBj/pTbCTZVtqqppnQyFtwH3G5qrQABBKxK19uVuT8U="; dde_linux.hash = "sha256-DOPa+Bi/dV9NVSCQa0GOapQsNbZQBhZ4gtcTq3TiAGw=";
dde_rump = { dde_rump = {
hash = "sha256-Wr5otGkWEa+5xImsFHQzwap5LckNEbyWA/7xbNcOreI="; hash = "sha256-Wr5otGkWEa+5xImsFHQzwap5LckNEbyWA/7xbNcOreI=";
nativeBuildInputs = [ subversion ]; nativeBuildInputs = [ subversion ];
@ -31,8 +31,9 @@ with pkgs;
jitterentropy.hash = "sha256-6KS732GxtUMz0xPYKtshdn039DgdJq11vTDQesZn4Ds="; jitterentropy.hash = "sha256-6KS732GxtUMz0xPYKtshdn039DgdJq11vTDQesZn4Ds=";
jpeg.hash = "sha256-RLVnlrnYGrhqr3Feikoi/BNditCaKN0u3t9/UDpl2wQ="; jpeg.hash = "sha256-RLVnlrnYGrhqr3Feikoi/BNditCaKN0u3t9/UDpl2wQ=";
libc = { libc = {
hash = "sha256-BSZcO25jbH8+OkJWGyJxxVYuQ4Y3yDt0DNsYcITwqxA="; hash = "sha256-/LX0uGiWLE+wNdbjNKr9CbzwqSPocHv5XBZuymJy1Gw=";
nativeBuildInputs = [ gcc rpcsvc-proto ]; nativeBuildInputs = [ gcc rpcsvc-proto ];
patches = [ ./patches/libc-port.patch ];
}; };
libiconv.hash = "sha256-25YcW5zo1fE33ZolGQroR+KZO8wHEdN1QXa7+MhwS78="; libiconv.hash = "sha256-25YcW5zo1fE33ZolGQroR+KZO8wHEdN1QXa7+MhwS78=";
libpng.hash = "sha256-hNmSWN4gEk4UIjzkGD4j5qFooMCVXLwcBeOeFumvh+4="; libpng.hash = "sha256-hNmSWN4gEk4UIjzkGD4j5qFooMCVXLwcBeOeFumvh+4=";

View File

@ -1,29 +1,31 @@
{ {
name = "bash"; name = "bash";
machine = { config, lib, modulesPath, pkgs, ... }: { machine = { config, lib, modulesPath, pkgs, ... }:
genode.init.children.bash = let let toDhall = lib.generators.toDhall { };
extraErisInputs' = with pkgs.genodePackages; {
bash = lib.getEris "bin" pkgs.bash;
cached_fs_rom = lib.getEris "bin" cached_fs_rom;
vfs = lib.getEris "bin" vfs;
vfs_pipe = lib.getEris "lib" vfs_pipe;
};
params = {
bash = "${pkgs.bash}";
coreutils = "${pkgs.coreutils}";
cached_fs_rom = extraErisInputs'.cached_fs_rom.cap;
vfs = extraErisInputs'.vfs.cap;
vfs_pipe = extraErisInputs'.vfs_pipe.cap;
};
in { in {
package = pkgs.genodePackages.init; genode.init.children.bash = let
extraErisInputs = builtins.attrValues extraErisInputs'; extraErisInputs' = with pkgs.genodePackages; {
configFile = pkgs.writeText "bash.child.dhall" '' bash = lib.getEris "bin" pkgs.bash;
${./bash.dhall} ${lib.generators.toDhall params} cached_fs_rom = lib.getEris "bin" cached_fs_rom;
''; vfs = lib.getEris "bin" vfs;
extraInputs = with pkgs.genodePackages; [ pkgs.bash libc posix ]; vfs_pipe = lib.getEris "lib" vfs_pipe;
};
params = {
bash = "${pkgs.bash}";
coreutils = "${pkgs.coreutils}";
cached_fs_rom = extraErisInputs'.cached_fs_rom.cap;
vfs = extraErisInputs'.vfs.cap;
vfs_pipe = extraErisInputs'.vfs_pipe.cap;
};
in {
package = pkgs.genodePackages.init;
extraErisInputs = builtins.attrValues extraErisInputs';
configFile = pkgs.writeText "bash.child.dhall" ''
${./bash.dhall} ${toDhall params}
'';
extraInputs = with pkgs.genodePackages; [ pkgs.bash libc posix ];
};
}; };
};
testScript = '' testScript = ''
start_all() start_all()
machine.wait_until_serial_output('child "bash" exited with exit value 0') machine.wait_until_serial_output('child "bash" exited with exit value 0')

View File

@ -12,6 +12,7 @@ in λ(binary : Text) →
Child.flat Child.flat
Child.Attributes::{ Child.Attributes::{
, binary , binary
, exitPropagate = True
, resources = Sigil.Init.Resources::{ , resources = Sigil.Init.Resources::{
, caps = 500 , caps = 500
, ram = Sigil.units.MiB 10 , ram = Sigil.units.MiB 10