Browse Source

nova-image: write image to stdout

20.02
Emery Hemingway 2 years ago
parent
commit
e88537c411
  1. 4
      apps/default.nix
  2. 12
      apps/nova-image/default.nix
  3. 2
      apps/nova-iso/default.nix
  4. 2
      tests/driver-nova.nix

4
apps/default.nix

@ -30,8 +30,8 @@ rec {
type = "app";
program = "${drv}/bin/nova-image";
function = attrs: bootDesc:
nixpkgs.runCommand "nova-iso" (attrs // { inherit bootDesc; })
"XDG_CACHE_HOME=$TMPDIR ${drv}/bin/nova-image $bootDesc > $out";
nixpkgs.runCommand "nova-iso" attrs
''XDG_CACHE_HOME=$TMPDIR ${drv}/bin/nova-image "${bootDesc}" > $out'';
};
nova-iso = let

12
apps/nova-image/default.nix

@ -10,14 +10,6 @@ in nixpkgs.writeScriptBin "nova-image" (with nixpkgs.buildPackages;
#!${runtimeShell}
set -eu
out="$1"
shift
if [ -e "$out" ]; then
echo "refusing to overwrite $out as output" > /dev/stderr
exit 1
fi
CC="${cc}/bin/${cc.targetPrefix}cc"
LD="${buildPackages.binutils}/bin/${buildPackages.binutils.targetPrefix}ld"
@ -39,6 +31,6 @@ in nixpkgs.writeScriptBin "nova-image" (with nixpkgs.buildPackages;
-T${base-nova.src}/repos/base-nova/src/core/core-bss.ld \
-z max-page-size=0x1000 \
-Ttext=0x100000 -gc-sections \
"''${CORE_NOVA:-${base-nova}/lib/core-nova.o}" "$TMPDIR/boot_modules.o" \
-o "$out"
"''${CORE_NOVA:-${base-nova}/lib/core-nova.o}" "$TMPDIR/boot_modules.o"
cat a.out
'')

2
apps/nova-iso/default.nix

@ -15,7 +15,7 @@ nixpkgs.writeScriptBin "nova-iso" (with nixpkgs.buildPackages;
trap "rm -rf $TMPDIR" err exit
mkdir -p "$TMPDIR/boot/syslinux"
${nova-image.program} "$TMPDIR/boot/image.elf" $@
${nova-image.program} $@ > "$TMPDIR/boot/image.elf"
pushd "$TMPDIR" > /dev/null
out="nova.iso"

2
tests/driver-nova.nix

@ -145,7 +145,7 @@ let
sotest = hostPkgs.runCommand "nova-${name}-sotest" env' ''
export XDG_CACHE_HOME=''${TMPDIR:-/tmp}
${apps.nova-image.program} \
image.elf "${./driver-nova-config.dhall} ${testConfig}"
"${./driver-nova-config.dhall} ${testConfig}" > image.elf
cp "${testPkgs.bender}" bender
cp "${testPkgs.NOVA}/hypervisor-x86_64" hypervisor
mkdir -p $out/nix-support

Loading…
Cancel
Save