diff --git a/nixos-modules/file-systems.nix b/nixos-modules/file-systems.nix
index 9706c83..4b9ce65 100644
--- a/nixos-modules/file-systems.nix
+++ b/nixos-modules/file-systems.nix
@@ -7,7 +7,7 @@ with lib; {
device = lib.mkOption { type = types.int; };
- driver = lib.mkOption { type = types.enum [ "ahci" ]; };
+ driver = lib.mkOption { type = types.enum [ "ahci" "usb" ]; };
partition = lib.mkOption { type = types.ints.positive; };
@@ -24,6 +24,9 @@ with lib; {
hardware.genode.ahci.enable =
any (fs: fs.block.driver == "ahci") (attrValues config.fileSystems);
+
+ hardware.genode.usb.storage.enable =
+ any (fs: fs.block.driver == "usb") (attrValues config.fileSystems);
};
}
diff --git a/nixos-modules/genode-core.nix b/nixos-modules/genode-core.nix
index ea08fa9..2545adc 100644
--- a/nixos-modules/genode-core.nix
+++ b/nixos-modules/genode-core.nix
@@ -98,40 +98,28 @@ in {
};
storeBackend = mkOption {
- type = types.enum [ "ahci" "tarball" "usb" ]; # "parent"?
- default = "tarball";
+ type = types.enum [ "fs" "memory" ]; # "parent"?
+ default = "memory";
description = ''
Backend for the initial /nix/store file-system.
-
- ahci
+
+ fs
+
-
- An EXT2 file-system backed by SATA storage.
-
+ Store backed by a File_system session.
-
- tarball
+
+ tarball
+
-
- An in-memory tarball.
-
+ An in-memory tarball.
-
-
- usb
-
-
- An EXT2 file-system backed by USB storage.
-
-
-
-
'';
};
@@ -198,12 +186,12 @@ in {
}];
genode.core.basePackages =
- lib.optional (config.genode.boot.storeBackend != "tarball")
+ lib.optional (config.genode.boot.storeBackend != "memory")
pkgs.genodePackages.part_block;
genode.core.children =
# Component to steer the store_fs to a specific partition
- (if config.genode.boot.storeBackend != "tarball" then {
+ (if config.genode.boot.storeBackend != "memory" then {
part_block.configFile = builtins.toFile "part_block.dhall" ''
let Genode = env:DHALL_GENODE
@@ -236,7 +224,7 @@ in {
store_fs.configFile = let
storeVfsConfig =
- if config.genode.boot.storeBackend == "tarball" then ''
+ if config.genode.boot.storeBackend == "memory" then ''
VFS.vfs [ VFS.leafAttrs "tar" (toMap { name = "${config.system.build.tarball.fileName}.tar" }) ]
'' else
let
@@ -252,9 +240,8 @@ in {
rumpExt2 =
"Init.Resources::{ caps = 256, ram = Genode.units.MiB 16 }";
in {
- ahci = rumpExt2;
- tarball = "Init.Resources.default";
- usb = rumpExt2;
+ fs = rumpExt2;
+ memory = "Init.Resources.default";
}.${config.genode.boot.storeBackend};
persistencePolicies = lib.mapAttrsToList (name: _: ''
@@ -316,9 +303,8 @@ in {
"${config.system.build.tarball}/tarball/${config.system.build.tarball.fileName}.tar";
storeBackendInputs = {
- ahci = [ pkgs.genodePackages.rump ];
- tarball = [ config.system.build.tarball ];
- usb = [ pkgs.genodePackages.rump ];
+ fs = [ pkgs.genodePackages.rump ];
+ memory = [ config.system.build.tarball ];
}.${config.genode.boot.storeBackend};
coreInputs = with builtins;
@@ -422,19 +408,15 @@ in {
bootDriveImage = import ./lib/make-bootable-image.nix {
inherit config pkgs espImage storeFsImage;
};
- in lib.mkIf (config.genode.boot.storeBackend != "tarball") bootDriveImage;
+ in lib.mkIf (config.genode.boot.storeBackend != "memory") bootDriveImage;
- virtualisation.useBootLoader = config.genode.boot.storeBackend != "tarball";
+ virtualisation.useBootLoader = config.genode.boot.storeBackend != "memory";
virtualisation.qemu.options =
let blockCommon = [ "-bios ${pkgs.buildPackages.OVMF.fd}/FV/OVMF.fd" ];
in {
- tarball = [ ];
- ahci = blockCommon;
- usb = blockCommon ++ [
- "-drive id=usbdisk,file=${config.system.build.bootDriveImage},if=none,readonly"
- "-device usb-storage,drive=usbdisk"
- ];
+ fs = blockCommon;
+ memory = [ ];
}.${config.genode.boot.storeBackend};
};
diff --git a/nixos-modules/hardware/usb.nix b/nixos-modules/hardware/usb.nix
index 167fdea..4d21b28 100644
--- a/nixos-modules/hardware/usb.nix
+++ b/nixos-modules/hardware/usb.nix
@@ -18,9 +18,6 @@ with lib;
config = let cfg = config.hardware.genode.usb;
in {
- hardware.genode.usb.storage.enable = config.genode.boot.storeBackend
- == "usb";
-
hardware.genode.usb.enable = cfg.storage.enable;
hardware.genode.platform.policies = lib.optional cfg.enable
@@ -118,7 +115,10 @@ with lib;
virtualisation.qemu.options = lib.optional cfg.enable
(lib.optional (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) "-usb"
++ lib.optional (pkgs.stdenv.isAarch32 || pkgs.stdenv.isAarch64)
- "-device usb-ehci,id=usb0");
+ "-device usb-ehci,id=usb0") ++ lib.optional cfg.storage.enable [
+ "-drive id=usbdisk,file=${config.system.build.bootDriveImage},if=none,readonly"
+ "-device usb-storage,drive=usbdisk"
+ ];
};
diff --git a/nixos-modules/lib/make-ext2-fs.nix b/nixos-modules/lib/make-ext2-fs.nix
index b2dc092..8e12230 100644
--- a/nixos-modules/lib/make-ext2-fs.nix
+++ b/nixos-modules/lib/make-ext2-fs.nix
@@ -23,6 +23,12 @@ in pkgs.stdenv.mkDerivation {
# Create nix/store before copying path
mkdir -p ./rootImage/boot/grub ./rootImage/nix/store
+ cat > extraPrepareConfig.sh <<< '${config.boot.loader.grub.extraPrepareConfig}'
+ substituteInPlace extraPrepareConfig.sh \
+ --replace '${pkgs.coreutils}' '${pkgs.buildPackages.coreutils}' \
+ --replace '@bootPath@' './rootImage/boot'
+ source extraPrepareConfig.sh
+
cat < ./rootImage/boot/grub/grub.cfg
set timeout=3
set default=0
diff --git a/nixos-modules/nova.nix b/nixos-modules/nova.nix
index 892f410..dd1414f 100644
--- a/nixos-modules/nova.nix
+++ b/nixos-modules/nova.nix
@@ -31,7 +31,7 @@ in {
};
genode.boot.storePaths =
- lib.optional (config.genode.boot.storeBackend != "tarball") bootDir;
+ lib.optional (config.genode.boot.storeBackend != "memory") bootDir;
virtualisation.qemu.options =
lib.optionals (!config.virtualisation.useBootLoader) [
@@ -52,9 +52,9 @@ in {
menuentry 'Genode on NOVA' {
insmod multiboot2
insmod gzio
- multiboot2 /bender.gz serial_fallback
- module2 /hypervisor.gz hypervisor iommu logmem novga novpid serial
- module2 /image.elf.gz image.elf
+ multiboot2 /boot/bender.gz serial_fallback
+ module2 /boot/hypervisor.gz hypervisor iommu logmem novga novpid serial
+ module2 /boot/image.elf.gz image.elf
}
'';
extraFiles = {
diff --git a/tests/ahci.nix b/tests/ahci.nix
index 2103025..9aa0710 100644
--- a/tests/ahci.nix
+++ b/tests/ahci.nix
@@ -6,6 +6,7 @@
device = 0;
partition = 1;
};
+ genode.boot.storeBackend = "fs";
genode.init.children.hello = {
inputs = [ pkgs.hello pkgs.genodePackages.vfs.lib ];
configFile = pkgs.writeText "ahci-hello.child.dhall" ''