diff --git a/devices/belkin-rt3200/default.nix b/devices/belkin-rt3200/default.nix index 218bcff..c226e8a 100644 --- a/devices/belkin-rt3200/default.nix +++ b/devices/belkin-rt3200/default.nix @@ -38,7 +38,7 @@ }; }; - module = {pkgs, config, lib, ... }: + module = {pkgs, config, lib, lim, ... }: let firmware = pkgs.stdenv.mkDerivation { name = "wlan-firmware"; phases = ["installPhase"]; @@ -143,7 +143,7 @@ }; boot = { commandLine = [ "console=ttyS0,115200" ]; - tftp.loadAddress = "0x4007ff28"; + tftp.loadAddress = lim.parseInt "0x4007ff28"; imageFormat = "fit"; }; filesystem = diff --git a/devices/gl-ar750/default.nix b/devices/gl-ar750/default.nix index 068a147..aba6030 100644 --- a/devices/gl-ar750/default.nix +++ b/devices/gl-ar750/default.nix @@ -144,7 +144,7 @@ }; }; boot.tftp = { - loadAddress = "0x00A00000"; + loadAddress = lim.parseInt "0x00A00000"; }; kernel = { src = pkgs.pkgsBuildBuild.fetchurl { diff --git a/devices/gl-mt300a/default.nix b/devices/gl-mt300a/default.nix index d796560..55ae68c 100644 --- a/devices/gl-mt300a/default.nix +++ b/devices/gl-mt300a/default.nix @@ -43,7 +43,7 @@ ''; - module = { pkgs, config, lib, ...}: + module = { pkgs, config, lib, lim, ...}: let inherit (pkgs.liminix.networking) interface; inherit (pkgs) openwrt; @@ -120,7 +120,7 @@ }; }; boot.tftp = { - loadAddress = "0x00A00000"; + loadAddress = lim.parseInt "0x00A00000"; }; kernel = { diff --git a/devices/gl-mt300n-v2/default.nix b/devices/gl-mt300n-v2/default.nix index 21dc336..be3c4a6 100644 --- a/devices/gl-mt300n-v2/default.nix +++ b/devices/gl-mt300n-v2/default.nix @@ -36,7 +36,7 @@ ''; - module = { pkgs, config, lib, ...}: + module = { pkgs, config, lib, lim, ...}: let inherit (pkgs.liminix.networking) interface; inherit (pkgs.liminix.services) oneshot; @@ -116,7 +116,7 @@ boot.tftp = { # 20MB seems to give enough room to uncompress the kernel # without anything getting trodden on. 10MB was too small - loadAddress = "0x1400000"; + loadAddress = lim.parseInt "0x1400000"; }; kernel = { diff --git a/modules/base.nix b/modules/base.nix index 75bb3b3..521bfb2 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -58,7 +58,7 @@ in { }; tftp = { loadAddress = mkOption { - type = types.str; + type = types.ints.unsigned; description = '' RAM address at which to load data when transferring via TFTP. This is not the address of the flash storage, diff --git a/modules/outputs/flashimage.nix b/modules/outputs/flashimage.nix index 73967d7..42d0bce 100644 --- a/modules/outputs/flashimage.nix +++ b/modules/outputs/flashimage.nix @@ -106,9 +106,9 @@ in { cat > $out << EOF setenv serverip ${tftp.serverip} setenv ipaddr ${tftp.ipaddr} - tftp 0x$(printf %x ${tftp.loadAddress}) result/firmware.bin + tftp 0x${toHexString tftp.loadAddress} result/firmware.bin erase 0x$(printf %x ${flash.address}) +${flash.size} - cp.b 0x$(printf %x ${tftp.loadAddress}) 0x$(printf %x ${flash.address}) \''${filesize} + cp.b 0x${toHexString tftp.loadAddress} 0x$(printf %x ${flash.address}) \''${filesize} echo command line was ${builtins.toJSON (concatStringsSep " " config.boot.commandLine)} EOF '';