diff --git a/default.nix b/default.nix index e372095..1070930 100644 --- a/default.nix +++ b/default.nix @@ -52,7 +52,7 @@ let borderVmConf ]; }).config.system; -in { +in rec { inherit evalModules; outputs = config.system.outputs // { @@ -90,4 +90,16 @@ in { lua ]; }; + + try-nand = pkgs.pkgsBuildBuild.writeShellScriptBin "try-nand.sh" '' + rootfs=$(mktemp) + cp ${outputs.default}/rootfs $rootfs + ${pkgs.pkgsBuildBuild.qemuLim}/bin/qemu-system-mips \ + -M malta -echr 16 -m 272 \ + -device nand,chip_id=0x59,id=nand -drive format=raw,file=''${rootfs},if=mtd,id=nand \ + -serial mon:stdio -kernel ${outputs.default}/vmlinux \ + -append "root=/dev/mtdblock0 console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8 root=/dev/mtdblock0 rootfstype=squashfs fw_devlink=off mem=256M liminix mtdparts=phram0:16M(rootfs) phram.phram=phram0,0x90000000,16Mi,65536" \ + -display none + rm $rootfs + ''; } diff --git a/overlay.nix b/overlay.nix index dda4ddc..c909a90 100644 --- a/overlay.nix +++ b/overlay.nix @@ -254,6 +254,7 @@ extraPkgs // { qemuLim = let q = prev.qemu.overrideAttrs (o: { patches = o.patches ++ [ ./pkgs/qemu/arm-image-friendly-load-addr.patch + ./pkgs/qemu/mips-with-nand.patch ]; }); in q.override { nixosTestRunner = true; sdlSupport = false; }; diff --git a/pkgs/qemu/mips-with-nand.patch b/pkgs/qemu/mips-with-nand.patch new file mode 100644 index 0000000..d4df4ed --- /dev/null +++ b/pkgs/qemu/mips-with-nand.patch @@ -0,0 +1,25 @@ +From 875b1f312b6a5b432e020723007a374d82a797f1 Mon Sep 17 00:00:00 2001 +From: Raito Bezarius +Date: Mon, 7 Oct 2024 13:05:06 +0200 +Subject: [PATCH] feat: support NAND devices for MIPS + +Signed-off-by: Raito Bezarius +--- + hw/mips/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/hw/mips/Kconfig b/hw/mips/Kconfig +index 692bede538..60738ac659 100644 +--- a/hw/mips/Kconfig ++++ b/hw/mips/Kconfig +@@ -10,6 +10,7 @@ config MALTA + select MIPS_CPS + select PIIX + select PFLASH_CFI01 ++ select NAND + select SERIAL + select SMBUS_EEPROM + +-- +2.46.0 +