This commit is contained in:
Emery Hemingway 2020-11-01 21:13:37 +01:00
parent b0cd6b04fc
commit ecf6f909a9
1 changed files with 6 additions and 164 deletions

View File

@ -19,13 +19,7 @@
# Current status
Work here has slowed as effort is focused on a native [Dhall
evaluator](https://git.sr.ht/~ehmry/dhall-nim) for Genode. This will allow for
dynamic on-target reconfiguration.
## Repository layout
# Repository layout
- Native packages are at [packages](./packages/default.nix)
@ -33,103 +27,7 @@ dynamic on-target reconfiguration.
- Tests are at [tests](./tests/default.nix)
- NixOS module at [nixos-modules](./nixos-modules)
# Installation
This repository contains an experimental NixOS module that can be used to build
and boot Genode using a shared Nix store. Hardware support is limited, and the
system does not support any dynamic reconfiguration.
NixOS must be installed on the target first, with many caveats. First of which,
the block driver is hard-coded to use the media on the first AHCI port, port
selection or NVMe simply hasn't been implemented within the Nix module.
These instructions are non-normative have not be tested exactly as follows. This
probably wont work for you.
### Step 1: Install NixOS
Format the first AHCI drive with a GUID Partition Table. */nix/store must be
placed on a partition with the partition type
`24b69406-18a1-428d-908e-d21a1437122c` and formatted with an Ext2 file-system.*
Install NixOS, using Grub to boot. Use the `nixos-unstable` channel. See
### Step 2: Build Genode
As mentioned before, the NixOS installation must be built from the
`nixos-unstable` channel. This is to ensure that the `nixos-rebuild` utility is
built with suport for taking configuration from Nix flakes.
Create a file a `/etc/nixos/flake.nix` (or study the `nixos-rebuild` manual)
with something similar to the following content:
description = "Example configuration flake";
inputs = {
genodepkgs.url = "git+https://git.sr.ht/~ehmry/genodepkgs";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, genodepkgs, nixpkgs }: {
nixosConfigurations.${your-hostname-here} = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
genode.fbDriver = "intel"; # or "vesa"
genode.guests = {
# Add two NixOS guest VMs to the Genode side:
nixos = {
config = { config, lib, pkgs, ... }: {
users.users.root.password = "nixos";
services.openssh.permitRootLogin = lib.mkDefault "yes";
services.mingetty.autologinUser = lib.mkDefault "root";
tor-browser = {
memorySize = 1024;
config = { config, lib, pkgs, ... }: {
services.cage = {
enable = true;
program = "${pkgs.tor-browser-bundle-bin}/bin/tor-browser";
users.users.demo.isNormalUser = true;
Do a `nixos-rebuild boot`. *Grub must be in use, UEFI booting is optional.*
## Reboot
Reboot and select the Genode entry from the Grub menu. Hopefully the display
will come up quickly, and the VMs will boot. *The VMs will take a long time to
come up initially,* this is because the VDI disk images are copied from
/nix/store to a mutable area of the file-system.
Thats all for now, patches are welcome.
- NixOS modules at [nixos-modules](./nixos-modules)
# Contributing
@ -137,34 +35,8 @@ Patches can be submitted and issues reported via the
[mailing list](https://lists.sr.ht/~ehmry/genodepkgs). The mailing list is the
minimum viable mechanism for community development, and may be replaced later.
The worksites at the moment are:
- Documentation
- Packaging multi-component scenarios
- Graphical launcher
- Port Boehm-Demers-Weiser GC to Genode
- ARM, i686
- Patching standard Nixpkgs packages by overlay. Explore Workflow and tooling
for building emulated UNIX environments.
- LLVM testing and upstreaming patches.
- Formalizing Dhall configuration types.
- NixOS modules for constructing a reasonably usable Genode system. Reusing the
module system from NixOS is advantageous because a dual boot system can
share a `/nix/store` and be updated simultaneously.
- NixOS module for NixOS guests with the ARM VMM.
- Configuration validation via a service routing prover.
- Fix Ncurses build
Issues may also be reported at the
[ticket tracker](https://todo.sr.ht/~ehmry/genodepkgs).
# Nix Flakes
@ -218,49 +90,19 @@ nix shell .#legacyPackages.x86_64-linux-x86_64-genode.stdenv.cc
x86_64-unknown-genode-clang++ -v
# Testing
Tests are performed using QEMU, the test artifacts are built as follows:
# Build a test log from a QEMU test run:
nix build .#checks.x86_64-linux.nova-x86
# Build a tarball of the Nix store internal to a test VM:
nix build .#checks.x86_64-linux.nova-x86.nodes.machine.store
# Build the XML configuration of the test VM:
nix build .#checks.x86_64-linux.nova-x86.nodes.machine.xml
# Build the Dhall boot description of the test run:
nix build .#checks.x86_64-linux.nova-x86.nodes.machine.config
# System description format
The high-level interface to system building are boot descriptions. These Dhall
documents describe the configuration of an [Init](https://genode.org/documentation/genode-foundations/19.05/system_configuration/The_init_component.html)
instance and a store of ROM (Read-Only Memory) modules. These description can be
used to build firmware-like binary images or merged and nested within other
descriptions. In theory these descriptions can arrange file-systems, but those
functions are missing.
The description schema is documented as code:
# Tips and tricks
## How to build a Genode make target?
let flake = getFlake "genodepkgs";
let flake = builtins.getFlake "genodepkgs";
in flake.packages.x86_64-linux-x86_64-genode.genodeSources.make "app/ping"
## How to build a Genode depot package?
let flake = getFlake "genodepkgs";
let flake = builtins.getFlake "genodepkgs";
in flake.packages.x86_64-linux-x86_64-genode.genodeSources.depot "wifi_drv"