convert flash params to int
This commit is contained in:
parent
abfb35a231
commit
f9f4d97bb8
11 changed files with 21 additions and 21 deletions
|
@ -106,9 +106,9 @@
|
||||||
loadAddress = lim.parseInt "0x80060000";
|
loadAddress = lim.parseInt "0x80060000";
|
||||||
entryPoint = lim.parseInt "0x80060000";
|
entryPoint = lim.parseInt "0x80060000";
|
||||||
flash = {
|
flash = {
|
||||||
address = "0x9F060000";
|
address = lim.parseInt "0x9F060000";
|
||||||
size ="0xfa0000";
|
size = lim.parseInt "0xfa0000";
|
||||||
eraseBlockSize = "65536";
|
eraseBlockSize = 65536;
|
||||||
};
|
};
|
||||||
rootDevice = "/dev/mtdblock5";
|
rootDevice = "/dev/mtdblock5";
|
||||||
dts = {
|
dts = {
|
||||||
|
|
|
@ -69,9 +69,9 @@
|
||||||
# 0x000000260000-0x000000f80000 : "rootfs"
|
# 0x000000260000-0x000000f80000 : "rootfs"
|
||||||
|
|
||||||
flash = {
|
flash = {
|
||||||
address = "0xbc050000";
|
address = lim.parseInt "0xbc050000";
|
||||||
size ="0xf80000";
|
size = lim.parseInt "0xf80000";
|
||||||
eraseBlockSize = "65536";
|
eraseBlockSize = 65536;
|
||||||
};
|
};
|
||||||
rootDevice = "/dev/mtdblock5";
|
rootDevice = "/dev/mtdblock5";
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,9 @@
|
||||||
entryPoint = lim.parseInt "0x80000000";
|
entryPoint = lim.parseInt "0x80000000";
|
||||||
|
|
||||||
flash = {
|
flash = {
|
||||||
address = "0xbc050000";
|
address = lim.parseInt "0xbc050000";
|
||||||
size = "0xfb0000";
|
size = lim.parseInt "0xfb0000";
|
||||||
eraseBlockSize = "65536";
|
eraseBlockSize = 65536;
|
||||||
};
|
};
|
||||||
rootDevice = "/dev/mtdblock5";
|
rootDevice = "/dev/mtdblock5";
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
entryPoint = lim.parseInt "0x0";
|
entryPoint = lim.parseInt "0x0";
|
||||||
rootDevice = "/dev/mtdblock0";
|
rootDevice = "/dev/mtdblock0";
|
||||||
|
|
||||||
flash.eraseBlockSize = "65536"; # c.f. pkgs/mips-vm/mips-vm.sh
|
flash.eraseBlockSize = 65536; # c.f. pkgs/mips-vm/mips-vm.sh
|
||||||
networkInterfaces =
|
networkInterfaces =
|
||||||
let inherit (config.system.service.network) link;
|
let inherit (config.system.service.network) link;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
entryPoint = lim.parseInt "0x00010000";
|
entryPoint = lim.parseInt "0x00010000";
|
||||||
rootDevice = "/dev/mtdblock0";
|
rootDevice = "/dev/mtdblock0";
|
||||||
|
|
||||||
flash.eraseBlockSize = "65536"; # c.f. pkgs/mips-vm/mips-vm.sh
|
flash.eraseBlockSize = 65536; # c.f. pkgs/mips-vm/mips-vm.sh
|
||||||
networkInterfaces =
|
networkInterfaces =
|
||||||
let inherit (config.system.service.network) link;
|
let inherit (config.system.service.network) link;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
in {
|
in {
|
||||||
defaultOutput = "vmroot";
|
defaultOutput = "vmroot";
|
||||||
rootDevice = "/dev/mtdblock0";
|
rootDevice = "/dev/mtdblock0";
|
||||||
flash.eraseBlockSize = "65536"; # c.f. pkgs/run-liminix-vm/run-liminix-vm.sh
|
flash.eraseBlockSize = 65536;
|
||||||
networkInterfaces =
|
networkInterfaces =
|
||||||
let inherit (config.system.service.network) link;
|
let inherit (config.system.service.network) link;
|
||||||
in {
|
in {
|
||||||
|
|
|
@ -48,15 +48,15 @@ in {
|
||||||
kernel uimage and root fs. Usually not the entire flash, as
|
kernel uimage and root fs. Usually not the entire flash, as
|
||||||
we don't want to clobber the bootloader, calibration data etc
|
we don't want to clobber the bootloader, calibration data etc
|
||||||
'';
|
'';
|
||||||
type = types.str;
|
type = types.ints.unsigned;
|
||||||
};
|
};
|
||||||
size = mkOption {
|
size = mkOption {
|
||||||
type = types.str;
|
type = types.ints.unsigned;
|
||||||
description = "Size in bytes of the firmware partition";
|
description = "Size in bytes of the firmware partition";
|
||||||
};
|
};
|
||||||
eraseBlockSize = mkOption {
|
eraseBlockSize = mkOption {
|
||||||
description = "Flash erase block size in bytes";
|
description = "Flash erase block size in bytes";
|
||||||
type = types.str;
|
type = types.ints.unsigned;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
loadAddress = mkOption { type = types.ints.unsigned; default = null; };
|
loadAddress = mkOption { type = types.ints.unsigned; default = null; };
|
||||||
|
|
|
@ -37,7 +37,7 @@ in
|
||||||
cp ${systemConfiguration}/bin/activate $TMPDIR/empty/activate
|
cp ${systemConfiguration}/bin/activate $TMPDIR/empty/activate
|
||||||
ln -s ${pkgs.s6-init-bin}/bin/init $TMPDIR/empty/init
|
ln -s ${pkgs.s6-init-bin}/bin/init $TMPDIR/empty/init
|
||||||
grafts=$(sed < ${systemConfiguration}/etc/nix-store-paths 's/^\(.*\)$/--graft \1:\1/g')
|
grafts=$(sed < ${systemConfiguration}/etc/nix-store-paths 's/^\(.*\)$/--graft \1:\1/g')
|
||||||
mkfs.jffs2 --compression-mode=size ${endian} -e ${config.hardware.flash.eraseBlockSize} --enable-compressor=lzo --pad --root $TMPDIR/empty --output $out $grafts --squash --faketime
|
mkfs.jffs2 --compression-mode=size ${endian} -e ${toString config.hardware.flash.eraseBlockSize} --enable-compressor=lzo --pad --root $TMPDIR/empty --output $out $grafts --squash --faketime
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,7 +75,7 @@ in {
|
||||||
firmware =
|
firmware =
|
||||||
let
|
let
|
||||||
o = config.system.outputs;
|
o = config.system.outputs;
|
||||||
bs = config.hardware.flash.eraseBlockSize;
|
bs = toString config.hardware.flash.eraseBlockSize;
|
||||||
in pkgs.runCommand "firmware" {} ''
|
in pkgs.runCommand "firmware" {} ''
|
||||||
dd if=${o.uimage} of=$out bs=${bs} conv=sync
|
dd if=${o.uimage} of=$out bs=${bs} conv=sync
|
||||||
dd if=${o.rootfs} of=$out bs=${bs} conv=sync,nocreat,notrunc oflag=append
|
dd if=${o.rootfs} of=$out bs=${bs} conv=sync,nocreat,notrunc oflag=append
|
||||||
|
@ -107,8 +107,8 @@ in {
|
||||||
setenv serverip ${tftp.serverip}
|
setenv serverip ${tftp.serverip}
|
||||||
setenv ipaddr ${tftp.ipaddr}
|
setenv ipaddr ${tftp.ipaddr}
|
||||||
tftp 0x${toHexString tftp.loadAddress} result/firmware.bin
|
tftp 0x${toHexString tftp.loadAddress} result/firmware.bin
|
||||||
erase 0x$(printf %x ${flash.address}) +${flash.size}
|
erase 0x${toHexString flash.address} +0x${toHexString flash.size}
|
||||||
cp.b 0x${toHexString tftp.loadAddress} 0x$(printf %x ${flash.address}) \''${filesize}
|
cp.b 0x${toHexString tftp.loadAddress} 0x${toHexString 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
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -74,7 +74,7 @@ in {
|
||||||
rootfsBytes=$(($(stat -L -c %s ${o.rootfs}) + 0x100000 &(~0xfffff)))
|
rootfsBytes=$(($(stat -L -c %s ${o.rootfs}) + 0x100000 &(~0xfffff)))
|
||||||
rootfsBytes=$(($rootfsBytes + ${toString cfg.freeSpaceBytes} ))
|
rootfsBytes=$(($rootfsBytes + ${toString cfg.freeSpaceBytes} ))
|
||||||
rootfsMb=$(($rootfsBytes >> 20))
|
rootfsMb=$(($rootfsBytes >> 20))
|
||||||
cmd="mtdparts=phram0:''${rootfsMb}M(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsBytes},${config.hardware.flash.eraseBlockSize} root=/dev/mtdblock0";
|
cmd="mtdparts=phram0:''${rootfsMb}M(rootfs) phram.phram=phram0,''${rootfsStart},''${rootfsBytes},${toString config.hardware.flash.eraseBlockSize} root=/dev/mtdblock0";
|
||||||
|
|
||||||
dtbStart=$(printf %x $((${toString cfg.loadAddress} + $rootfsBytes + 0x100000 + $uimageSize )))
|
dtbStart=$(printf %x $((${toString cfg.loadAddress} + $rootfsBytes + 0x100000 + $uimageSize )))
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ in {
|
||||||
buildPhaseUImage = ''
|
buildPhaseUImage = ''
|
||||||
test -f tmp.dtb && ${objcopy} --update-section .appended_dtb=tmp.dtb vmlinux.elf || ${objcopy} --add-section .appended_dtb=tmp.dtb vmlinux.elf
|
test -f tmp.dtb && ${objcopy} --update-section .appended_dtb=tmp.dtb vmlinux.elf || ${objcopy} --add-section .appended_dtb=tmp.dtb vmlinux.elf
|
||||||
${stripAndZip}
|
${stripAndZip}
|
||||||
mkimage -A ${arch} -O linux -T kernel -C lzma -a 0x${lib.toHexString loadAddress} -e 0x${lib.tohexString entryPoint} -n '${lib.toUpper arch} Liminix Linux ${extraName}' -d vmlinux.bin.lzma kernel.uimage
|
mkimage -A ${arch} -O linux -T kernel -C lzma -a 0x${lib.toHexString loadAddress} -e 0x${lib.toHexString entryPoint} -n '${lib.toUpper arch} Liminix Linux ${extraName}' -d vmlinux.bin.lzma kernel.uimage
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhaseFIT = ''
|
buildPhaseFIT = ''
|
||||||
|
|
Loading…
Reference in a new issue