2023-12-18 23:42:29 +01:00
|
|
|
{
|
|
|
|
liminix
|
|
|
|
}:
|
2023-12-22 23:15:54 +01:00
|
|
|
let check = deviceName : ubootName : config :
|
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-22 23:15:54 +01:00
|
|
|
liminix-config = { pkgs, ... } : {
|
|
|
|
imports = [./configuration.nix];
|
|
|
|
inherit config;
|
|
|
|
};
|
2023-12-18 23:42:29 +01:00
|
|
|
});
|
|
|
|
img = derivation.outputs.tftpboot;
|
2023-12-19 13:12:12 +01:00
|
|
|
uboot = derivation.pkgs.${ubootName};
|
|
|
|
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
|
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} \
|
2023-12-21 11:47:08 +01:00
|
|
|
--wan "user,tftp=`pwd`" \
|
2023-12-18 23:42:29 +01:00
|
|
|
--disk-image result/rootfs \
|
|
|
|
result/uimage result/rootfs
|
|
|
|
|
|
|
|
expect ${./script.expect} 2>&1 |tee $out
|
2023-12-19 13:12:12 +01:00
|
|
|
'';
|
|
|
|
in {
|
2023-12-22 23:15:54 +01:00
|
|
|
aarch64 = check "qemu-aarch64" "ubootQemuAarch64" {};
|
|
|
|
arm = check "qemu-armv7l" "ubootQemuArm" {};
|
|
|
|
armZimage = check "qemu-armv7l" "ubootQemuArm" {
|
|
|
|
boot.tftp.kernelFormat = "zimage";
|
|
|
|
};
|
|
|
|
mips = check "qemu" "ubootQemuMips" {};
|
2023-12-19 13:12:12 +01:00
|
|
|
}
|