ramips: raeth: unmap rx DMA address in ramips_cleanup_dma
[openwrt.git] / scripts / flashing / jungo-image.py
old mode 100644 (file)
new mode 100755 (executable)
index 08ca9db..9947e7c
@@ -62,22 +62,39 @@ def start_server(server):
 ####################
 
 def get_flash_size():
+    # make sure we don't have an A0 stepping
+    tn.write("cat /proc/cpuinfo\n")
+    buf = tn.read_until("Returned 0", 3)
+    if not buf:
+        print "Unable to obtain CPU information; make sure to not use A0 stepping!"
+    elif buf.find('rev 0') > 0:
+        print "Warning: IXP42x stepping A0 detected!"
+        if imagefile or url:
+            print "Error: No linux support for A0 stepping!"
+            sys.exit(2)
+
+    # now get flash size
     tn.write("cat /proc/mtd\n")
-    # wait for prompt
     buf = tn.read_until("Returned 0", 3)
     if buf:
         i = buf.find('mtd0:')
         if i > 0:
             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:
-        print "Can't access /proc/mtd!"
+        print "Unable to obtain flash size!"
     sys.exit(2)
 
 def image_dump(tn, dumpfile):
     if not dumpfile:
         tn.write("ver\n");
-        buf = tn.read_until("Returned 0")
+        buf = tn.read_until("Returned 0",2)
         i = buf.find("Platform:")
         if i < 0:
            platform="jungo"
@@ -86,12 +103,12 @@ def image_dump(tn, dumpfile):
            i=line.find('\n')
            platform=line[:i].split()[-1]
 
-        tn.write("ifconfig -v %s\n" % device);
-        buf = tn.read_until("Returned 0")
+        tn.write("rg_conf_print /dev/%s/mac\n" % device);
+        buf = tn.read_until("Returned 0",3)
 
-       i = buf.find("mac = 0")
+       i = buf.find("mac(")
        if i > 0:
-           i += 6
+           i += 4
        else:
            print "No MAC address found! (use -f option)"
            sys.exit(1)
@@ -161,7 +178,7 @@ for o, a in opts:
        usage()
        sys.exit(1)
     elif o in ("-V", "--version"):
-       print "%s: 0.9" % sys.argv[0]
+       print "%s: 0.11" % sys.argv[0]
        sys.exit(1)
     elif o in ("-d", "--no-dump"):
        do_dump = 1
@@ -245,7 +262,7 @@ if imagefile or url:
     if verbose:
        print "Unlocking flash..."
     tn.write("unlock 0 0x%x\n" % flashsize)
-    buf = tn.read_until("Returned 0")
+    buf = tn.read_until("Returned 0",5)
 
     if verbose:
        print "Writing new image..."
This page took 0.023117 seconds and 4 git commands to generate.