Genode Packages collection
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.2 KiB

{ stdenv, nixpkgs, apps, packages }:
let inherit (packages) genodeSources base-nova;
in nixpkgs.writeScriptBin "nova-image" (with nixpkgs.buildPackages;
let inherit (stdenv) cc;
in ''
set -eu
TMPDIR="$(${coreutils}/bin/mktemp -d)"
trap "rm -rf $TMPDIR" err exit
export DHALL_GENODE=${packages.dhallGenode}/source.dhall
${apps.dhall.program} text \
<<< "(env:DHALL_GENODE).Init.render ($@).config" \
> $TMPDIR/config
${apps.dhall.program} text \
<<< "(${../}).to64bitImage (${
} \"$TMPDIR/config\" ($@).rom)" \
> "$TMPDIR/"
# compile the boot modules into one object file
$CC -c -x assembler -o "$TMPDIR/boot_modules.o" "$TMPDIR/"
# link final image
$LD --strip-all \
-T${genodeSources}/repos/base/src/ld/genode.ld \
-T${genodeSources}/repos/base-nova/src/core/core-bss.ld \
-z max-page-size=0x1000 \
-Ttext=0x100000 -gc-sections \
"''${CORE_OBJ:-${base-nova.coreObj}}" "$TMPDIR/boot_modules.o"
cat a.out