mirror of
				git://git.openwrt.org/openwrt/openwrt.git
				synced 2025-11-03 14:34:27 -05:00 
			
		
		
		
	Added support WRV54G.
SVN-Revision: 14186
This commit is contained in:
		
							parent
							
								
									e1eab1038d
								
							
						
					
					
						commit
						9a74dd2faa
					
				@ -69,15 +69,21 @@ def get_flash_size():
 | 
				
			|||||||
        i = buf.find('mtd0:')
 | 
					        i = buf.find('mtd0:')
 | 
				
			||||||
        if i > 0:
 | 
					        if i > 0:
 | 
				
			||||||
            return int(buf[i+6:].split()[0],16)
 | 
					            return int(buf[i+6:].split()[0],16)
 | 
				
			||||||
        print "Can't find mtd0!"
 | 
					        # use different command
 | 
				
			||||||
 | 
					        tn.write("flash_layout\n")
 | 
				
			||||||
 | 
					        buf = tn.read_until("Returned 0", 3)
 | 
				
			||||||
 | 
					        i = buf.rfind('Range ')
 | 
				
			||||||
 | 
					        if i > 0:
 | 
				
			||||||
 | 
					            return int(buf[i+17:].split()[0],16)
 | 
				
			||||||
 | 
					        print "Can't determine flash size!"
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        print "Can't access /proc/mtd!"
 | 
					        print "Unable to obtain flash size!"
 | 
				
			||||||
    sys.exit(2)
 | 
					    sys.exit(2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def image_dump(tn, dumpfile):
 | 
					def image_dump(tn, dumpfile):
 | 
				
			||||||
    if not dumpfile:
 | 
					    if not dumpfile:
 | 
				
			||||||
        tn.write("ver\n");
 | 
					        tn.write("ver\n");
 | 
				
			||||||
        buf = tn.read_until("Returned 0")
 | 
					        buf = tn.read_until("Returned 0",2)
 | 
				
			||||||
        i = buf.find("Platform:")
 | 
					        i = buf.find("Platform:")
 | 
				
			||||||
        if i < 0:
 | 
					        if i < 0:
 | 
				
			||||||
	    platform="jungo"
 | 
						    platform="jungo"
 | 
				
			||||||
@ -86,12 +92,12 @@ def image_dump(tn, dumpfile):
 | 
				
			|||||||
	    i=line.find('\n')
 | 
						    i=line.find('\n')
 | 
				
			||||||
	    platform=line[:i].split()[-1]
 | 
						    platform=line[:i].split()[-1]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        tn.write("ifconfig -v %s\n" % device);
 | 
					        tn.write("rg_conf_print /dev/%s/mac\n" % device);
 | 
				
			||||||
        buf = tn.read_until("Returned 0")
 | 
					        buf = tn.read_until("Returned 0",3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	i = buf.find("mac = 0")
 | 
						i = buf.find("mac(")
 | 
				
			||||||
	if i > 0:
 | 
						if i > 0:
 | 
				
			||||||
	    i += 6
 | 
						    i += 4
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
	    print "No MAC address found! (use -f option)"
 | 
						    print "No MAC address found! (use -f option)"
 | 
				
			||||||
	    sys.exit(1)
 | 
						    sys.exit(1)
 | 
				
			||||||
@ -161,7 +167,7 @@ for o, a in opts:
 | 
				
			|||||||
	usage()
 | 
						usage()
 | 
				
			||||||
	sys.exit(1)
 | 
						sys.exit(1)
 | 
				
			||||||
    elif o in ("-V", "--version"):
 | 
					    elif o in ("-V", "--version"):
 | 
				
			||||||
	print "%s: 0.9" % sys.argv[0]
 | 
						print "%s: 0.10" % sys.argv[0]
 | 
				
			||||||
	sys.exit(1)
 | 
						sys.exit(1)
 | 
				
			||||||
    elif o in ("-d", "--no-dump"):
 | 
					    elif o in ("-d", "--no-dump"):
 | 
				
			||||||
	do_dump = 1
 | 
						do_dump = 1
 | 
				
			||||||
@ -245,7 +251,7 @@ if imagefile or url:
 | 
				
			|||||||
    if verbose:
 | 
					    if verbose:
 | 
				
			||||||
	print "Unlocking flash..."
 | 
						print "Unlocking flash..."
 | 
				
			||||||
    tn.write("unlock 0 0x%x\n" % flashsize)
 | 
					    tn.write("unlock 0 0x%x\n" % flashsize)
 | 
				
			||||||
    buf = tn.read_until("Returned 0")
 | 
					    buf = tn.read_until("Returned 0",5)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if verbose:
 | 
					    if verbose:
 | 
				
			||||||
	print "Writing new image..."
 | 
						print "Writing new image..."
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user