convert tftp.loadAddress from string to int

This commit is contained in:
Daniel Barlow 2023-11-12 18:37:33 +00:00
parent 0131686661
commit 185117843b
6 changed files with 10 additions and 10 deletions

View file

@ -38,7 +38,7 @@
}; };
}; };
module = {pkgs, config, lib, ... }: module = {pkgs, config, lib, lim, ... }:
let firmware = pkgs.stdenv.mkDerivation { let firmware = pkgs.stdenv.mkDerivation {
name = "wlan-firmware"; name = "wlan-firmware";
phases = ["installPhase"]; phases = ["installPhase"];
@ -143,7 +143,7 @@
}; };
boot = { boot = {
commandLine = [ "console=ttyS0,115200" ]; commandLine = [ "console=ttyS0,115200" ];
tftp.loadAddress = "0x4007ff28"; tftp.loadAddress = lim.parseInt "0x4007ff28";
imageFormat = "fit"; imageFormat = "fit";
}; };
filesystem = filesystem =

View file

@ -144,7 +144,7 @@
}; };
}; };
boot.tftp = { boot.tftp = {
loadAddress = "0x00A00000"; loadAddress = lim.parseInt "0x00A00000";
}; };
kernel = { kernel = {
src = pkgs.pkgsBuildBuild.fetchurl { src = pkgs.pkgsBuildBuild.fetchurl {

View file

@ -43,7 +43,7 @@
''; '';
module = { pkgs, config, lib, ...}: module = { pkgs, config, lib, lim, ...}:
let let
inherit (pkgs.liminix.networking) interface; inherit (pkgs.liminix.networking) interface;
inherit (pkgs) openwrt; inherit (pkgs) openwrt;
@ -120,7 +120,7 @@
}; };
}; };
boot.tftp = { boot.tftp = {
loadAddress = "0x00A00000"; loadAddress = lim.parseInt "0x00A00000";
}; };
kernel = { kernel = {

View file

@ -36,7 +36,7 @@
''; '';
module = { pkgs, config, lib, ...}: module = { pkgs, config, lib, lim, ...}:
let let
inherit (pkgs.liminix.networking) interface; inherit (pkgs.liminix.networking) interface;
inherit (pkgs.liminix.services) oneshot; inherit (pkgs.liminix.services) oneshot;
@ -116,7 +116,7 @@
boot.tftp = { boot.tftp = {
# 20MB seems to give enough room to uncompress the kernel # 20MB seems to give enough room to uncompress the kernel
# without anything getting trodden on. 10MB was too small # without anything getting trodden on. 10MB was too small
loadAddress = "0x1400000"; loadAddress = lim.parseInt "0x1400000";
}; };
kernel = { kernel = {

View file

@ -58,7 +58,7 @@ in {
}; };
tftp = { tftp = {
loadAddress = mkOption { loadAddress = mkOption {
type = types.str; type = types.ints.unsigned;
description = '' description = ''
RAM address at which to load data when transferring via RAM address at which to load data when transferring via
TFTP. This is not the address of the flash storage, TFTP. This is not the address of the flash storage,

View file

@ -106,9 +106,9 @@ in {
cat > $out << EOF cat > $out << EOF
setenv serverip ${tftp.serverip} setenv serverip ${tftp.serverip}
setenv ipaddr ${tftp.ipaddr} 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} 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)} echo command line was ${builtins.toJSON (concatStringsSep " " config.boot.commandLine)}
EOF EOF
''; '';