router: patch dtbsize in liminix

This commit is contained in:
sinavir 2024-01-19 19:46:05 +01:00
parent 50b22e0dcd
commit fc28547693
2 changed files with 34 additions and 1 deletions

View file

@ -2,4 +2,14 @@
, nixpkgs ? (import ./npins).nixpkgs , nixpkgs ? (import ./npins).nixpkgs
, liminix-config ? ./configuration.nix , liminix-config ? ./configuration.nix
}: }:
(import liminix { inherit nixpkgs liminix-config; device = import (liminix + "/devices/belkin-rt3200"); }) let
patchedLiminix = pkgs.applyPatches {
name = "liminix-patched";
src = liminix;
patches = [
./liminix-dtbsize.patch
];
};
pkgs = import nixpkgs {};
in
(import patchedLiminix { inherit nixpkgs liminix-config; device = import (patchedLiminix + "/devices/belkin-rt3200"); })

View file

@ -0,0 +1,23 @@
diff --git a/modules/outputs/tftpboot.nix b/modules/outputs/tftpboot.nix
index ad6ed63..9773042 100644
--- a/modules/outputs/tftpboot.nix
+++ b/modules/outputs/tftpboot.nix
@@ -73,8 +73,6 @@ in {
rootfsStart=${toString cfg.loadAddress}
rootfsSize=$(binsize64k ${o.rootfs} )
dtbStart=$(($rootfsStart + $rootfsSize))
- dtbSize=$(binsize ${o.dtb} )
- imageStart=$(($dtbStart + $dtbSize))
imageSize=$(binsize ${image})
ln -s ${o.manifest} manifest
@@ -102,6 +100,9 @@ in {
fdtput -p -t s dtb /reserved-memory/$node compatible phram
fdtput -p -t lx dtb /reserved-memory/$node reg $ac_prefix $(hex $rootfsStart) $sz_prefix $(hex $rootfsSize)
+ dtbSize=$(binsize ./dtb )
+ imageStart=$(($dtbStart + $dtbSize))
+
cmd="liminix ${cmdline} mtdparts=phram0:''${rootfsSize}(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsSize},${toString config.hardware.flash.eraseBlockSize} root=/dev/mtdblock0";
fdtput -t s dtb /chosen bootargs "$cmd"