From 4cfaed7303699d297597cd880f8363c88458a767 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 26 Apr 2023 22:16:15 +0100 Subject: [PATCH] specify root device as /dev/mtdblockn the (openwrt?) magic that autodetects it based on mtd labels won't work with a two-stage boot --- devices/gl-ar750/default.nix | 2 +- devices/gl-mt300a/default.nix | 2 +- devices/gl-mt300n-v2/default.nix | 2 +- modules/base.nix | 1 + modules/initramfs.nix | 5 +++++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/devices/gl-ar750/default.nix b/devices/gl-ar750/default.nix index 0d4b762..64e03c9 100644 --- a/devices/gl-ar750/default.nix +++ b/devices/gl-ar750/default.nix @@ -89,7 +89,7 @@ size ="0xfa0000"; eraseBlockSize = "65536"; }; - rootDevice = "1f05"; + rootDevice = "/dev/mtdblock5"; dts = { src = "${openwrt.src}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts"; includes = [ diff --git a/devices/gl-mt300a/default.nix b/devices/gl-mt300a/default.nix index 3682d2f..13529c0 100644 --- a/devices/gl-mt300a/default.nix +++ b/devices/gl-mt300a/default.nix @@ -47,7 +47,7 @@ size ="0xf80000"; eraseBlockSize = "65536"; }; - rootDevice = "1f05"; + rootDevice = "/dev/mtdblock5"; dts = { src = "${openwrt.src}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts"; diff --git a/devices/gl-mt300n-v2/default.nix b/devices/gl-mt300n-v2/default.nix index 168831d..59b69fb 100644 --- a/devices/gl-mt300n-v2/default.nix +++ b/devices/gl-mt300n-v2/default.nix @@ -44,7 +44,7 @@ size = "0xfb0000"; eraseBlockSize = "65536"; }; - rootDevice = "1f05"; + rootDevice = "/dev/mtdblock5"; dts = { src = "${openwrt.src}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts"; diff --git a/modules/base.nix b/modules/base.nix index b2d1857..a03218a 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -119,6 +119,7 @@ in { }; boot.commandLine = [ "console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8" + "root=${config.hardware.rootDevice}" "rootfstype=${config.rootfsType}" "fw_devlink=off" ]; diff --git a/modules/initramfs.nix b/modules/initramfs.nix index a459fcf..4116424 100644 --- a/modules/initramfs.nix +++ b/modules/initramfs.nix @@ -31,6 +31,11 @@ in dir /dev 0755 0 0 nod /dev/console 0600 0 0 c 5 1 nod /dev/mtdblock0 0600 0 0 b 31 0 + nod /dev/mtdblock1 0600 0 0 b 31 1 + nod /dev/mtdblock2 0600 0 0 b 31 2 + nod /dev/mtdblock3 0600 0 0 b 31 3 + nod /dev/mtdblock4 0600 0 0 b 31 4 + nod /dev/mtdblock5 0600 0 0 b 31 5 dir /target 0755 0 0 dir /target/persist 0755 0 0 dir /target/nix 0755 0 0