Build QEMU script with ISO
This commit is contained in:
parent
410a6522c5
commit
20594a9962
|
@ -38,17 +38,24 @@ in {
|
||||||
|
|
||||||
x86_64-genode.buildNovaIso = { name, rom }:
|
x86_64-genode.buildNovaIso = { name, rom }:
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (hostPkgs) cdrkit syslinux;
|
inherit (hostPkgs) cdrkit syslinux;
|
||||||
coreNovaObj = "${testPkgs.genode-base-nova}/lib/core-nova.o";
|
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;
|
map' = with nixpkgs.lib;
|
||||||
l: f:
|
l: f:
|
||||||
concatStrings (imap0 (i: v: (f (toString i) v)) l);
|
concatStrings (imap0 (i: v: (f (toString i) v)) l);
|
||||||
|
|
||||||
mapNames = map' (builtins.attrNames rom);
|
mapNames = map' (builtins.attrNames rom');
|
||||||
mapValues = map' (builtins.attrValues rom);
|
mapValues = map' (builtins.attrValues rom');
|
||||||
|
|
||||||
modulesAsm = ''
|
modulesAsm = ''
|
||||||
.set MIN_PAGE_SIZE_LOG2, 12
|
.set MIN_PAGE_SIZE_LOG2, 12
|
||||||
|
@ -96,18 +103,20 @@ in {
|
||||||
syslinuxDir = "${syslinux}/share/syslinux";
|
syslinuxDir = "${syslinux}/share/syslinux";
|
||||||
|
|
||||||
in hostPkgs.stdenv.mkDerivation {
|
in hostPkgs.stdenv.mkDerivation {
|
||||||
name = name + ".iso";
|
name = name + "-iso";
|
||||||
preferLocalBuild = true;
|
passthru = rom;
|
||||||
buildInputs = [ testPkgs.stdenv.cc hostPkgs.cdrkit ];
|
passAsFile = [ "modulesAsm" ];
|
||||||
dontUnpack = true;
|
|
||||||
dontConfigure = true;
|
|
||||||
dontBuild = true;
|
|
||||||
inherit modulesAsm;
|
inherit modulesAsm;
|
||||||
installPhase = ''
|
preferLocalBuild = true;
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
buildInputs = [ testPkgs.stdenv.cc hostPkgs.cdrkit ];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
mkdir -p boot/syslinux
|
mkdir -p boot/syslinux
|
||||||
|
|
||||||
# compile the boot modules into one object file
|
# 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
|
# link final image
|
||||||
$LD -nostdlib \
|
$LD -nostdlib \
|
||||||
|
@ -130,11 +139,22 @@ in {
|
||||||
${syslinuxDir}/mboot.c32 \
|
${syslinuxDir}/mboot.c32 \
|
||||||
boot/syslinux
|
boot/syslinux
|
||||||
chmod +w boot/syslinux/isolinux.bin
|
chmod +w boot/syslinux/isolinux.bin
|
||||||
mkisofs -o $out \
|
mkisofs -o iso \
|
||||||
-b syslinux/isolinux.bin -c syslinux/boot.cat \
|
-b syslinux/isolinux.bin -c syslinux/boot.cat \
|
||||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||||
-iso-level 2 \
|
-iso-level 2 \
|
||||||
boot
|
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
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,6 @@ let
|
||||||
{
|
{
|
||||||
inherit testConfig;
|
inherit testConfig;
|
||||||
config = ./driver-config.xml;
|
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);
|
} // bootModules);
|
||||||
|
|
||||||
iso = lib.x86_64-genode.buildNovaIso {
|
iso = lib.x86_64-genode.buildNovaIso {
|
||||||
|
@ -81,7 +78,6 @@ let
|
||||||
set output $expect_out(buffer)
|
set output $expect_out(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
proc run_genode_until {{wait_for_re forever} {timeout_value 0} {running_spawn_id -1}} {
|
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
|
# If a running_spawn_id is specified, wait for the expected output
|
||||||
|
@ -92,8 +88,7 @@ let
|
||||||
}
|
}
|
||||||
|
|
||||||
global spawn_id
|
global spawn_id
|
||||||
spawn ${hostPkgs.qemu_test}/bin/qemu-system-x86_64 -cdrom ${iso} -nographic \
|
spawn ${iso}/bin/boot-qemu -nographic -m size=${toString qemuMem}
|
||||||
-machine q35 -m size=${toString qemuMem}
|
|
||||||
wait_for_output $wait_for_re $timeout_value $spawn_id
|
wait_for_output $wait_for_re $timeout_value $spawn_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue