2023-12-18 23:42:29 +01:00
|
|
|
{
|
|
|
|
liminix
|
|
|
|
}:
|
2023-12-19 13:12:12 +01:00
|
|
|
let check = deviceName : ubootName :
|
2023-12-18 23:42:29 +01:00
|
|
|
let derivation = (import liminix {
|
2023-12-19 13:12:12 +01:00
|
|
|
device = import "${liminix}/devices/${deviceName}/";
|
2023-12-18 23:42:29 +01:00
|
|
|
liminix-config = ./configuration.nix;
|
|
|
|
});
|
|
|
|
img = derivation.outputs.tftpboot;
|
2023-12-19 13:12:12 +01:00
|
|
|
uboot = derivation.pkgs.${ubootName};
|
|
|
|
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
|
|
|
|
phram = 240 * 1024 * 1024;
|
2023-12-18 23:42:29 +01:00
|
|
|
in pkgsBuild.runCommand "check" {
|
|
|
|
nativeBuildInputs = with pkgsBuild; [
|
|
|
|
expect
|
|
|
|
socat
|
|
|
|
run-liminix-vm
|
|
|
|
] ;
|
|
|
|
} ''
|
|
|
|
mkdir vm
|
|
|
|
ln -s ${img} result
|
2023-12-19 13:12:12 +01:00
|
|
|
|
2023-12-18 23:42:29 +01:00
|
|
|
run-liminix-vm \
|
|
|
|
--background ./vm \
|
2023-12-19 13:12:12 +01:00
|
|
|
--u-boot ${uboot}/u-boot.bin \
|
|
|
|
--arch ${derivation.pkgs.stdenv.hostPlatform.qemuArch} \
|
|
|
|
--phram-address $(printf "0x%x" ${toString phram} ) \
|
2023-12-18 23:42:29 +01:00
|
|
|
--lan "user,tftp=`pwd`" \
|
|
|
|
--disk-image result/rootfs \
|
|
|
|
result/uimage result/rootfs
|
|
|
|
|
|
|
|
expect ${./script.expect} 2>&1 |tee $out
|
2023-12-19 13:12:12 +01:00
|
|
|
'';
|
|
|
|
in {
|
|
|
|
arm = check "qemu-armv7l" "ubootQemuArm";
|
|
|
|
aarch64 = check "qemu-aarch64" "ubootQemuAarch64";
|
|
|
|
}
|