From 0ad7b0e48b4e004060f68a4a53502831294df3f1 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Mon, 10 Apr 2023 22:53:56 +0100 Subject: [PATCH] don't hardcode mtd0 initramfs->second stage --- modules/initramfs.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/initramfs.nix b/modules/initramfs.nix index fe191342..ea724381 100644 --- a/modules/initramfs.nix +++ b/modules/initramfs.nix @@ -47,9 +47,18 @@ in slashinit = pkgs.writeScript "init" '' #!/bin/sh exec >/dev/console - echo IT MOVES + echo Running in initramfs mount -t proc none /proc - mount -t jffs2 mtd0 /target/persist + set -- $(cat /proc/cmdline) + for i in "$@" ; do + case "''${i}" in + root=*) + rootdevice="''${i#root=}" + ;; + esac + done + echo mount -t jffs2 ''${rootdevice} /target/persist + mount -t jffs2 ''${rootdevice} /target/persist mount -o bind /target/persist/nix /target/nix sh /target/persist/activate /target cd /target