b182f09d21c7232b5cc66d9fdefa489c523bc60f
9 parser
= argparse
.ArgumentParser(description
='Tool to boot AVM EVA ramdisk images.')
10 parser
.add_argument('ip', type=str, help='IP-address to transfer the image to')
11 parser
.add_argument('image', type=str, help='Location of the ramdisk image')
12 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.')
13 args
= parser
.parse_args()
15 size
= stat(args
.image
).st_size
16 # arbitrary size limit, to prevent the address calculations from overflows etc.
17 assert size
< 0x2000000
23 # We need to align the address.
24 # A page boundary seems to be sufficient on 7362sl and 7412
25 addr
= ((0x8000000 - size
) & ~
0xfff)
26 haddr
= 0x80000000 + addr
28 img
= open(args
.image
, "rb")
29 ftp
= FTP(args
.ip
, 'adam2', 'adam2')
33 resp
= ftp
.sendcmd(cmd
)
35 assert resp
[0:3] == "200"
38 # The following parameters allow booting the avm recovery system with this
40 adam('SETENV memsize 0x%08x'%(addr))
41 adam('SETENV kernel_args_tmp mtdram1=0x%08x,0x88000000'%(haddr))
43 ftp
.storbinary('STOR 0x%08x 0x88000000'%(haddr), img
)