2
0
Fork 0

Build QEMU script with ISO

This commit is contained in:
Ehmry - 2019-11-10 10:19:32 +01:00
parent 410a6522c5
commit 20594a9962
2 changed files with 78 additions and 63 deletions

View File

@ -38,17 +38,24 @@ in {
x86_64-genode.buildNovaIso = { name, rom }:
let
inherit (hostPkgs) cdrkit syslinux;
coreNovaObj = "${testPkgs.genode-base-nova}/lib/core-nova.o";
addressType = ".quad"; # TODO: 32 or 64 bit?!
rom' = (with testPkgs; {
init = "${genode-os}/bin/init";
"ld.lib.so" = "${depot.base-nova}/lib/ld.lib.so";
timer = "${genode-base-nova}/bin/nova_timer_drv";
}) // rom;
addressType = ".quad"; # TODO: 32bit?!
map' = with nixpkgs.lib;
l: f:
concatStrings (imap0 (i: v: (f (toString i) v)) l);
mapNames = map' (builtins.attrNames rom);
mapValues = map' (builtins.attrValues rom);
mapNames = map' (builtins.attrNames rom');
mapValues = map' (builtins.attrValues rom');
modulesAsm = ''
.set MIN_PAGE_SIZE_LOG2, 12
@ -96,18 +103,20 @@ in {
syslinuxDir = "${syslinux}/share/syslinux";
in hostPkgs.stdenv.mkDerivation {
name = name + ".iso";
preferLocalBuild = true;
buildInputs = [ testPkgs.stdenv.cc hostPkgs.cdrkit ];
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
name = name + "-iso";
passthru = rom;
passAsFile = [ "modulesAsm" ];
inherit modulesAsm;
installPhase = ''
preferLocalBuild = true;
dontUnpack = true;
buildInputs = [ testPkgs.stdenv.cc hostPkgs.cdrkit ];
buildPhase = ''
mkdir -p boot/syslinux
# compile the boot modules into one object file
$CC -c -x assembler -o boot_modules.o - <<< $modulesAsm
$CC -c -x assembler -o boot_modules.o $modulesAsmPath
# link final image
$LD -nostdlib \
@ -130,11 +139,22 @@ in {
${syslinuxDir}/mboot.c32 \
boot/syslinux
chmod +w boot/syslinux/isolinux.bin
mkisofs -o $out \
mkisofs -o iso \
-b syslinux/isolinux.bin -c syslinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-iso-level 2 \
boot
# build test script
cat > boot-qemu << EOF
#!/bin/sh
${hostPkgs.qemu_test}/bin/qemu-system-x86_64 -cdrom $out/iso -machine q35 \$@
EOF
'';
installPhase = ''
install -Dm444 iso $out/iso
install -Dm555 boot-qemu $out/bin/boot-qemu
'';
};

View File

@ -43,9 +43,6 @@ let
{
inherit testConfig;
config = ./driver-config.xml;
init = "${genode-os}/bin/init";
"ld.lib.so" = "${depot.base-nova}/lib/ld.lib.so";
timer = "${genode-base-nova}/bin/nova_timer_drv";
} // bootModules);
iso = lib.x86_64-genode.buildNovaIso {
@ -81,7 +78,6 @@ let
set output $expect_out(buffer)
}
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
#
# If a running_spawn_id is specified, wait for the expected output
@ -92,8 +88,7 @@ let
}
global spawn_id
spawn ${hostPkgs.qemu_test}/bin/qemu-system-x86_64 -cdrom ${iso} -nographic \
-machine q35 -m size=${toString qemuMem}
spawn ${iso}/bin/boot-qemu -nographic -m size=${toString qemuMem}
wait_for_output $wait_for_re $timeout_value $spawn_id
}