Compare commits
4 Commits
151dc88c28
...
67768004ee
Author | SHA1 | Date | |
---|---|---|---|
67768004ee | |||
26c6eac937 | |||
4cfaed7303 | |||
6d6dbe1cbb |
@ -89,7 +89,7 @@
|
|||||||
size ="0xfa0000";
|
size ="0xfa0000";
|
||||||
eraseBlockSize = "65536";
|
eraseBlockSize = "65536";
|
||||||
};
|
};
|
||||||
rootDevice = "1f05";
|
rootDevice = "/dev/mtdblock5";
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
src = "${openwrt.src}/target/linux/ath79/dts/qca9531_glinet_gl-ar750.dts";
|
||||||
includes = [
|
includes = [
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
size ="0xf80000";
|
size ="0xf80000";
|
||||||
eraseBlockSize = "65536";
|
eraseBlockSize = "65536";
|
||||||
};
|
};
|
||||||
rootDevice = "1f05";
|
rootDevice = "/dev/mtdblock5";
|
||||||
|
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts";
|
src = "${openwrt.src}/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts";
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
size = "0xfb0000";
|
size = "0xfb0000";
|
||||||
eraseBlockSize = "65536";
|
eraseBlockSize = "65536";
|
||||||
};
|
};
|
||||||
rootDevice = "1f05";
|
rootDevice = "/dev/mtdblock5";
|
||||||
|
|
||||||
dts = {
|
dts = {
|
||||||
src = "${openwrt.src}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
src = "${openwrt.src}/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts";
|
||||||
|
@ -25,7 +25,7 @@ let
|
|||||||
in rec {
|
in rec {
|
||||||
boot = {
|
boot = {
|
||||||
tftp = {
|
tftp = {
|
||||||
enable = true;
|
freeSpaceBytes = 3 * 1024 * 1024;
|
||||||
serverip = "10.0.0.1";
|
serverip = "10.0.0.1";
|
||||||
ipaddr = "10.0.0.8";
|
ipaddr = "10.0.0.8";
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
let
|
let
|
||||||
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
inherit (lib) mkEnableOption mkOption types isDerivation hasAttr ;
|
||||||
inherit (pkgs.pseudofile) dir symlink;
|
inherit (pkgs.pseudofile) dir symlink;
|
||||||
# inherit (pkgs) busybox;
|
|
||||||
inherit (pkgs.liminix.networking) address interface;
|
inherit (pkgs.liminix.networking) address interface;
|
||||||
inherit (pkgs.liminix.services) bundle;
|
inherit (pkgs.liminix.services) bundle;
|
||||||
|
|
||||||
@ -52,7 +51,6 @@ in {
|
|||||||
# the right to change them if I think of better ones.
|
# the right to change them if I think of better ones.
|
||||||
ipaddr = mkOption { type = types.str; };
|
ipaddr = mkOption { type = types.str; };
|
||||||
serverip = mkOption { type = types.str; };
|
serverip = mkOption { type = types.str; };
|
||||||
enable = mkOption { type = types.boolean; };
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -119,6 +117,7 @@ in {
|
|||||||
};
|
};
|
||||||
boot.commandLine = [
|
boot.commandLine = [
|
||||||
"console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8"
|
"console=ttyS0,115200 panic=10 oops=panic init=/bin/init loglevel=8"
|
||||||
|
"root=${config.hardware.rootDevice}"
|
||||||
"rootfstype=${config.rootfsType}"
|
"rootfstype=${config.rootfsType}"
|
||||||
"fw_devlink=off"
|
"fw_devlink=off"
|
||||||
];
|
];
|
||||||
|
@ -53,7 +53,7 @@ in {
|
|||||||
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$(printf %x ${tftp.loadAddress}) result/firmware.bin
|
||||||
erase 0x$(printf %x ${flash.address}) +\''${filesize})
|
erase 0x$(printf %x ${flash.address}) +${flash.size}
|
||||||
cp.b 0x$(printf %x ${tftp.loadAddress}) 0x$(printf %x ${flash.address}) \''${filesize}
|
cp.b 0x$(printf %x ${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
|
||||||
|
@ -31,6 +31,11 @@ in
|
|||||||
dir /dev 0755 0 0
|
dir /dev 0755 0 0
|
||||||
nod /dev/console 0600 0 0 c 5 1
|
nod /dev/console 0600 0 0 c 5 1
|
||||||
nod /dev/mtdblock0 0600 0 0 b 31 0
|
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 0755 0 0
|
||||||
dir /target/persist 0755 0 0
|
dir /target/persist 0755 0 0
|
||||||
dir /target/nix 0755 0 0
|
dir /target/nix 0755 0 0
|
||||||
|
@ -9,6 +9,10 @@ let
|
|||||||
cfg = config.boot.tftp;
|
cfg = config.boot.tftp;
|
||||||
in {
|
in {
|
||||||
imports = [ ./ramdisk.nix ];
|
imports = [ ./ramdisk.nix ];
|
||||||
|
options.boot.tftp.freeSpaceBytes = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 0;
|
||||||
|
};
|
||||||
config = {
|
config = {
|
||||||
boot.ramdisk.enable = true;
|
boot.ramdisk.enable = true;
|
||||||
|
|
||||||
@ -33,8 +37,8 @@ in {
|
|||||||
uimageSize=$(($(stat -L -c %s ${config.outputs.uimage}) + 0x1000 &(~0xfff)))
|
uimageSize=$(($(stat -L -c %s ${config.outputs.uimage}) + 0x1000 &(~0xfff)))
|
||||||
rootfsStart=0x$(printf %x $((${cfg.loadAddress} + 0x100000 + $uimageSize)))
|
rootfsStart=0x$(printf %x $((${cfg.loadAddress} + 0x100000 + $uimageSize)))
|
||||||
rootfsBytes=$(($(stat -L -c %s ${config.outputs.rootfs}) + 0x100000 &(~0xfffff)))
|
rootfsBytes=$(($(stat -L -c %s ${config.outputs.rootfs}) + 0x100000 &(~0xfffff)))
|
||||||
rootfsMb=$(($rootfsBytes >> 20))
|
rootfsBytes=$(($rootfsBytes + ${toString cfg.freeSpaceBytes} ))
|
||||||
cmd="mtdparts=phram0:''${rootfsMb}M(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsMb}Mi,${config.hardware.flash.eraseBlockSize} memmap=''${rootfsMb}M\$''${rootfsStart} root=/dev/mtdblock0";
|
cmd="mtdparts=phram0:''${rootfsMb}M(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsBytes},${config.hardware.flash.eraseBlockSize} memmap=''${rootfsBytes}\$''${rootfsStart} root=/dev/mtdblock0";
|
||||||
|
|
||||||
cat > $out << EOF
|
cat > $out << EOF
|
||||||
setenv serverip ${cfg.serverip}
|
setenv serverip ${cfg.serverip}
|
||||||
|
Loading…
Reference in New Issue
Block a user