2023-12-18 23:42:29 +01:00
|
|
|
{
|
|
|
|
liminix
|
|
|
|
}:
|
2023-12-29 18:07:47 +01:00
|
|
|
let check = deviceName : 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-29 18:07:47 +01:00
|
|
|
uboot = derivation.outputs.u-boot;
|
2023-12-19 13:12:12 +01:00
|
|
|
pkgsBuild = derivation.pkgs.pkgsBuildBuild;
|
2024-02-15 21:12:03 +01:00
|
|
|
in pkgsBuild.runCommand "check-${deviceName}" {
|
2023-12-18 23:42:29 +01:00
|
|
|
nativeBuildInputs = with pkgsBuild; [
|
|
|
|
expect
|
|
|
|
socat
|
|
|
|
run-liminix-vm
|
|
|
|
] ;
|
|
|
|
} ''
|
|
|
|
mkdir vm
|
|
|
|
ln -s ${img} result
|
2023-12-19 13:12:12 +01:00
|
|
|
|
2023-12-23 00:20:35 +01:00
|
|
|
touch empty empty2
|
|
|
|
|
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-23 00:20:35 +01:00
|
|
|
--disk-image empty2 \
|
|
|
|
empty empty2
|
2023-12-18 23:42:29 +01:00
|
|
|
|
|
|
|
expect ${./script.expect} 2>&1 |tee $out
|
2023-12-19 13:12:12 +01:00
|
|
|
'';
|
|
|
|
in {
|
2023-12-29 18:07:47 +01:00
|
|
|
aarch64 = check "qemu-aarch64" {};
|
|
|
|
arm = check "qemu-armv7l" {};
|
|
|
|
armZimage = check "qemu-armv7l" {
|
2023-12-22 23:15:54 +01:00
|
|
|
boot.tftp.kernelFormat = "zimage";
|
|
|
|
};
|
2023-12-29 18:07:47 +01:00
|
|
|
mips = check "qemu" {};
|
|
|
|
mipsLz = check "qemu" {
|
2023-12-23 00:20:35 +01:00
|
|
|
boot.tftp.compressRoot = true;
|
|
|
|
};
|
2024-02-15 21:12:03 +01:00
|
|
|
# this works on real hardware but I haven't figured out how
|
|
|
|
# to make it work on qemu: it says
|
|
|
|
# "OF: fdt: No chosen node found, continuing without"
|
|
|
|
|
|
|
|
# mipsOldUboot = check "qemu" {
|
|
|
|
# boot.tftp.appendDTB = true;
|
|
|
|
# };
|
2023-12-19 13:12:12 +01:00
|
|
|
}
|