summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorValentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE>2018-03-09 20:17:16 +0100
committerMathias Kresin <dev@kresin.me>2018-03-18 22:22:38 +0100
commit7a303fe5d135d223d84ee8157aa2c5eebcc4182e (patch)
treec2241ce80dfd2a52cee2a60bc54c156d287dab8b /scripts
parentd13b05741a4d05a271d26fc3be61e76530025098 (diff)
downloadmtk-20170518-7a303fe5d135d223d84ee8157aa2c5eebcc4182e.zip
mtk-20170518-7a303fe5d135d223d84ee8157aa2c5eebcc4182e.tar.gz
mtk-20170518-7a303fe5d135d223d84ee8157aa2c5eebcc4182e.tar.bz2
scripts: add EVA ramboot script
Use the EVA bootloader to load a small linux system into the ram and boot it from there: ./scripts/flashing/eva_ramboot.py 192.168.178.1 path/to/initramfs-kernel.bin Signed-off-by: Valentin Spreckels <Valentin.Spreckels@Informatik.Uni-Oldenburg.DE> Acked-by: John Crispin <john@phrozen.org> [reworded commit message] Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/flashing/eva_ramboot.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/scripts/flashing/eva_ramboot.py b/scripts/flashing/eva_ramboot.py
new file mode 100755
index 0000000..b825d27
--- /dev/null
+++ b/scripts/flashing/eva_ramboot.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+from ftplib import FTP
+from sys import argv
+from os import stat
+
+assert len(argv) == 3
+ip = argv[1]
+image = argv[2]
+
+size = stat(image).st_size
+# arbitrary size limit, to prevent the address calculations from overflows etc.
+assert size < 0x2000000
+
+# We need to align the address. A page boundary seems to be sufficient on 7362sl
+# and 7412
+addr = ((0x8000000 - size) & ~0xfff)
+haddr = 0x80000000 + addr
+img = open(image, "rb")
+
+ftp = FTP(ip, 'adam2', 'adam2')
+
+def adam(cmd):
+ print("> %s"%(cmd))
+ resp = ftp.sendcmd(cmd)
+ print("< %s"%(resp))
+ assert resp[0:3] == "200"
+
+ftp.set_pasv(True)
+# The following parameters allow booting the avm recovery system with this
+# script.
+adam('SETENV memsize 0x%08x'%(addr))
+adam('SETENV kernel_args_tmp mtdram1=0x%08x,0x88000000'%(haddr))
+adam('MEDIA SDRAM')
+ftp.storbinary('STOR 0x%08x 0x88000000'%(haddr), img)
+img.close()
+ftp.close()