2
0
Fork 0
Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
Go to file
Emery Hemingway 6d2eb81def tests/vmm_arm: recreate device-tree-binary 2020-06-03 20:33:40 +05:30
LICENSES Move Nixpkgs patching to overlay 2020-03-24 19:48:26 +05:30
apps Add aarch64 platform 2020-06-03 16:56:33 +05:30
compositions test: update to use new routes configuration method 2020-05-01 05:22:58 +05:30
lib Add aarch64 platform 2020-06-03 16:56:33 +05:30
overlay Add aarch64 platform 2020-06-03 16:56:33 +05:30
packages Update nic_bus package 2020-06-03 19:45:23 +05:30
tests tests/vmm_arm: recreate device-tree-binary 2020-06-03 20:33:40 +05:30
.CC0-1.0.png Relicense as CC0-1.0 2020-01-24 14:46:41 +01:00
.gitignore Add .history to .gitignore 2020-01-24 14:46:51 +01:00
.gitmodules Update dhall-haskell, enable tests for Hydra 2019-10-10 00:49:18 +02:00
README.md Replace test framework 2020-06-01 17:15:03 +05:30
flake.lock Remove Noux test, remove prebuilt depo packages 2020-05-08 09:32:23 +05:30
flake.nix Add aarch64 platform 2020-06-03 16:56:33 +05:30

README.md

`      ______                     __           __
      / ____/__  ____  ____  ____/ /__  ____  / / ____ ______
     / / __/ _ \/ __ \/ __ \/ __  / _ \/ __ \/ / / __ `/ ___/
    / /_/ /  __/ / / / /_/ / /_/ /  __/ /_/ / , \ /_/ (__  )
    \____/\___/_/ /_/\____/\__,_/\___/ .___/_/ \_\_, /____/
                                    /_/        /____/

Genodepkgs is nexus of Nix expressions related to the Genode OS framework.

IRC: irc://oftc.net/#genodepkgs

Mailing List: https://lists.sr.ht/~ehmry/genodepkgs

Hydra: https://hydra7.hq.c3d2.de/project/genodepkgs

SoTest: https://opensource.sotest.io/userName%3Demery/1

Repository layout

  • Native packages are at packages

  • Existing Nixpkgs packages are patched at overlay

  • Tests are at tests (messy)

Contributing

Patches can be submitted and issues reported via the mailing list. The mailing list is the minimum viable mechanism for community development, and may be replaced later.

The worksites at the moment are:

  • Documentation

  • ARM, i686

  • Write a proper test framework, or better, reuse the NixOS one.

  • 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 advantagous because a dual boot system can share a /nix/store and be updated simultaneously. Work-in-progress on a topic branch.

  • Configuration validation via a service routing prover.

Nix Flakes

This repository is structured as a Nix flake, which is an experimental extension of Nix tooling. See https://www.tweag.io/posts/2020-05-25-flakes.html for an introduction and tutorial.

Build Caching

The builds produced by Hydra are available as a binary cache, using the cache is strongly recommended.

The global (IPv6 only) address for the cache can be tested by fetching the following: http://cache.server7.hq.c3d2.de/nix-cache-info.

If that fails the cache is also available within the Yggdrasil network: http://nix-serve.y.c3d2.de/nix-cache-info.

Those with IPv6 will want to the following to their /etc/nix/nix.conf file:

substituters = https://cache.nixos.org https://cache.server7.hq.c3d2.de
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.server7.hq.c3d2.de:x8JLRG26zRZ8ysYZLEkPxuAYuK1VSJi/aMAEIs2Lv+U=

NixOS users may alternatively using the following configuration:

{ pkgs, ... }:
{
  # The following enables the use of a binary cache (IPv6 only)
  nix.binaryCaches = [
    "https://cache.nixos.org"
    "https://cache.server7.hq.c3d2.de"
    # or "http://nix-serve.y.c3d2.de"
  ];
  nix.binaryCachePublicKeys = [
    "cache.server7.hq.c3d2.de:x8JLRG26zRZ8ysYZLEkPxuAYuK1VSJi/aMAEIs2Lv+U="
  ];
}

Building from flakes

$ git clone https://git.sr.ht/~ehmry/genodepkgs
$ cd genodepkgs
$ nix build .#checks.x86_64-linux.nova-x86

# View the log if the result is already cached:
$ nix log .#checks.x86_64-linux.nova-x86

Packaging

Packaging is done using standard Nixpkgs methods, a stdenv is available for cross-compilation. See Solo5 as an example.

Toolchain

The Genode Labs toolchain is available here only for Linux and in binary form. However, an experimental LLVM cross-compiler is provided here. Bootstrapping GCC has not been practical due to its recursive autotools build system.

The enter a shell with the toolchain:

nix run .#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 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: https://git.sr.ht/~ehmry/dhall-genode/tree/master/Boot/package.dhall

Tips and tricks

How to build a Genode make target?

let flake = 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";
in flake.packages.x86_64-linux-x86_64-genode.genodeSources.depot "wifi_drv"

How to add missing ports to a depot package?

The missing ports as indicated by a depot build failure must be added to targets.nix. To continue from the previous example, this would be sufficient:

{
  wifi_drv = { portInputs = [ dde_linux libc openssl ]; };
}

How to add undefined ports?

Should a required port not be defined, it must be added to ports.nix. Initially it should be sufficient to define the port as an empty attribute set, run the build again, and then add the hash found in the successive build error.

To continue from the previous example:

{
  dde_linux = { };
}

And after the reattempting the build a fixed-output hash should be produced, this must now be added to the port definitions.

{
  dde_linux = {
    hash = "sha256-3G5Mprv9ZBNhDJRuVF6Nrkp3KbFaN10IKFq0OdyAY9M="; };
}

Should the port preparation fail do to missing utilities, these must be added to the port definition using a nativeBuildInputs attribute.

Note that the hash checked into ports.nix is an output hash. The port hash within the Genode source tree is an explicit input hash and the output of the port preparation is non-deterministic.

Enter an environment compatible with the Genode Labs build scripts

nix dev-shell genodepkgs
cd $GENODE_DIR
make -C build/x86_64 run/bomb

Glossary

Some of terms that follow are necessary for understanding packaging methodology, Others are simply introduced as an aid to the reader:

  • Upstream - repositories packaged by expressions in this repository

  • Downstream - repositories depending on this repository

  • OS ABI - The binary interface to an operating system. In the case of Genode this does not include kernel interfaces, as system calls are abstracted via dynamically linked procedures.

  • localSystem - the CPU and OS ABI pair used to evaluate and compile packages. Genode cannot natively instantiate Nix derivations, therefore it cannot be a localSystem ABI.

  • crossSystem - the target CPU and OS ABI pair for packages. In the common case the ABI will be Genode. In the case of tooling it may be the same as localSystem. For software that runs bare-metal the CPU is significant but ABI is irrelevant.

  • buildPlatform - equivalent to localSystem.

  • hostPlatform - the platform on which a package will execute.

  • targetPlatform - the platform for which a package will produce artifacts. This is only significant for software such as compilers. The respective build, host, and target platform of a compiler that was built on a Solaris, executes on Genode, and produces only Haiku binaries would be Solaris, Genode, and Haiku.

  • Flake - a code repository containing a flake.nix file describing dependency repositories. The evaluation of flakes may only form ascyclic graphs. Repositories packaged here may themselves contain a flake.nix file that refers to this repository, but these repositories cannot be inputs to the Genodepkgs flake.

  • Genode core - Genode component of highest privilege. The core is located conceptually at the bottom and root of the component tree. Core might be directly above the kernel, or acting as the kernel. The role of core is a subset of the role of the kernel in a monolithic system.

  • Lower - lowering a subsystem is moving it closer to the Genode core and increasing privilege.

  • Raise - raising a subsystem is moving it further away from the Genode core and decreasing privilege.

  • Package - undefined

Legal

This repository is for trivial packaging and metadata that exists only for the sake of richer and more meaningful code in external repositories. All works committed to this repository, unless otherwise noted, shall be implicitly licensed under a CC0 1.0 public domain dedication.

CC0 PUBLIC DOMAIN