2
0
Fork 0
Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
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.
 
 
 
 
 

38 lines
1.2 KiB

# SPDX-License-Identifier: CC0-1.0
{ stdenv, nixpkgs, dhallApps, packages }:
let inherit (packages.genode) base-nova;
in nixpkgs.writeScriptBin "nova-image" (with nixpkgs.buildPackages;
let inherit (stdenv) cc;
in ''
#!${runtimeShell}
set -eu
CC="${cc}/bin/${cc.targetPrefix}cc"
LD="${buildPackages.binutils}/bin/${buildPackages.binutils.targetPrefix}ld"
TMPDIR="$(${coreutils}/bin/mktemp -p /tmp -d nova-iso.XXXX)"
# trap "rm -rf $TMPDIR" err exit
CORE_NOVA="${base-nova}/lib/core-nova.o"
export DHALL_PRELUDE=${packages.dhallPrelude}/package.dhall
export DHALL_GENODE=${packages.dhallGenode}/package.dhall
${dhallApps.dhall.program} text <<< "(${
../nova-modules.as.dhall
}) ($@)" > "$TMPDIR/modules.as"
# compile the boot modules into one object file
$CC -c -x assembler -o "$TMPDIR/boot_modules.o" "$TMPDIR/modules.as"
# link final image
$LD -nostdlib \
-T${base-nova.src}/repos/base/src/ld/genode.ld \
-T${base-nova.src}/repos/base-nova/src/core/core-bss.ld \
-z max-page-size=0x1000 \
-Ttext=0x100000 -gc-sections \
"$CORE_NOVA" "$TMPDIR/boot_modules.o" \
-o "image.elf"
'')