OpenWrt

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 2  →  ?path2? @ 3
/branches/18.06.1/scripts/flashing/eva_ramboot.py
@@ -1,32 +1,24 @@
#!/usr/bin/env python3
#!/usr/bin/python
 
import argparse
 
from ftplib import FTP
from sys import argv
from os import stat
 
parser = argparse.ArgumentParser(description='Tool to boot AVM EVA ramdisk images.')
parser.add_argument('ip', type=str, help='IP-address to transfer the image to')
parser.add_argument('image', type=str, help='Location of the ramdisk image')
parser.add_argument('--offset', type=lambda x: int(x,0), help='Offset to load the image to in hex format with leading 0x. Only needed for non-lantiq devices.')
args = parser.parse_args()
assert len(argv) == 3
ip = argv[1]
image = argv[2]
 
size = stat(args.image).st_size
size = stat(image).st_size
# arbitrary size limit, to prevent the address calculations from overflows etc.
assert size < 0x2000000
 
if args.offset:
addr = size
haddr = args.offset
else:
# We need to align the address.
# A page boundary seems to be sufficient on 7362sl and 7412
addr = ((0x8000000 - size) & ~0xfff)
haddr = 0x80000000 + addr
# 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")
 
img = open(args.image, "rb")
ftp = FTP(args.ip, 'adam2', 'adam2')
ftp = FTP(ip, 'adam2', 'adam2')
 
def adam(cmd):
print("> %s"%(cmd))