Trouble replacing firmware image using uboot #5

Closed
blackketter opened this Issue May 28, 2013 · 6 comments

3 participants

@blackketter

I seem to have corrupted flash and am trying to reload the sysupgrade image via uboot.

Using the latest openwrt-ar71xx-generic-carambola2-squashfs-sysupgrade.bin I followed the instructions in #1 (comment)

The kernel loads successfully, but the squashfs file system appears to be corrupt. Is there an additional step needed to write the rootfs correctly?

I am able to get to the failsafe prompt, but not boot completely.

Fragment of boot output:

[    2.950000] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    2.960000] Freeing unused kernel memory: 244k freed
[    4.310000] SQUASHFS error: xz_dec_run error, data probably corrupt
[    4.310000] SQUASHFS error: squashfs_read_data failed to read block 0x14616e
[    4.320000] SQUASHFS error: Unable to read fragment cache entry [14616e]
[    4.320000] SQUASHFS error: Unable to read page, block 14616e, size 14160
[    4.330000] SQUASHFS error: Unable to read fragment cache entry [14616e]
[    4.340000] SQUASHFS error: Unable to read page, block 14616e, size 14160
[    4.340000] SQUASHFS error: Unable to read fragment cache entry [14616e]
[    4.350000] SQUASHFS error: Unable to read page, block 14616e, size 14160
[    4.360000] SQUASHFS error: Unable to read fragment cache entry [14616e]
[    4.360000] SQUASHFS error: Unable to read page, block 14616e, size 14160
[    4.370000] SQUASHFS error: Unable to read fragment cache entry [14616e]
[    4.380000] SQUASHFS error: Unable to read page, block 14616e, size 14160
/etc/preinit: line 1: /sbin/hotplug2: Input/output error
/etc/preinit: line 1: can't open '/dev/null'
- preinit -
Press the [f] key and hit [enter] to enter failsafe mode
f
- failsafe -


BusyBox v1.19.4 (2013-04-25 10:50:29 EEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 BARRIER BREAKER (Bleeding Edge, r35770)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------
root@(none):/#  cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00200000 00010000 "kernel"
mtd3: 00d90000 00010000 "rootfs"
mtd4: 00b60000 00010000 "rootfs_data"
mtd5: 00010000 00010000 "nvram"
mtd6: 00010000 00010000 "art"
mtd7: 00f90000 00010000 "firmware"
root@(none):/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                    2304      2304         0 100% /
/dev/root                 2304      2304         0 100% /
tmpfs                    30892        16     30876   0% /tmp
tmpfs                      512         4       508   1% /dev
root@(none):/#

@gedass

Is anything connected to module SPI pins ?

@blackketter

Nothing connected to the SPI pins.

But maybe I wasn't clear. I think I have corrupted the flash by trying to write a bad image to it.

I am trying to recover using the default image, and the kernel seems to be written correctly but the rootfs is corrupted. Is there some more complete way to rewrite the factory software?

@gedass

How to upgrade image+fs
#1

@blackketter

Thanks, gedass, but that's what I tried first. (as mentioned in the first post).

Just tried it again, here's more of the log. I used YModem (don't have an ethernet port on this unit):

ar7240> loady 80060000
## Ready for binary (ymodem) download to 0x80060000 at 115200 bps...
CCC
### Send (Y) openwrt-ar71xx-gene#4E3F391.bin: 4390916 bytes, 10:47 elapsed, 6782 cps, 58%
xyzModem - CRC mode, 3(SOH)/4288(STX)/0(CAN) packets, 5 retries
## Total Size      = 0x00430004 = 4390916 Bytes
ar7240> erase 9f050000 +${filesize}
Erase Flash from 0x9f050000 to 0x9f48ffff in Bank # 1
First 0x5 last 0x48 sector size 0x10000
  72
Erased 68 sectors
ar7240> cp.b 80060000 9f050000 ${filesize}
Copy to Flash... write addr: 9f050000
done
ar7240>  setenv bootcmd 'bootm 9f050000'
ar7240> saveenv
Saving Environment to Flash...
Protect off 9F040000 ... 9F04FFFF
Un-Protecting sectors 4..4 in bank 1
Un-Protected 1 sectors
Erasing Flash...Erase Flash from 0x9f040000 to 0x9f04ffff in Bank # 1
First 0x4 last 0x4 sector size 0x10000
   4
Erased 1 sectors
Writing to Flash... write addr: 9f040000
done
Protecting sectors 4..4 in bank 1
Protected 1 sectors
ar7240> boot
## Booting image at 9f050000 ...
   Image Name:   MIPS OpenWrt Linux-3.7.9
   Created:      2013-05-24  12:49:29 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    933285 Bytes = 911.4 kB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9f050040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 3.7.9 (zilvinas@LX-buildd3) (gcc version 4.7.3 20121205 (prerelease) (
Linaro GCC 4.7-2012.12) ) #2 Fri May 24 15:49:17 EEST 2013
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:40.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x03ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x03ffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=CARAMBOLA2 console=ttyATH0,115200 mtdparts=spi0.0:256k(u
-boot)ro,64k(u-boot-env)ro,2048k(kernel),13888k(rootfs),64k(nvram),64k(art)ro,15936k@0x50000(firmwa
re) rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] __ex_table already sorted, skipping sort
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 61536k/65536k available (2159k kernel code, 4000k reserved, 408k data, 244k
init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 512
[    0.090000] NET: Registered protocol family 16
[    0.090000] MIPS: machine is 8devices Carambola2 board
[    0.550000] bio: create slab <bio-0> at 0
[    0.550000] Switching to clocksource MIPS
[    0.560000] NET: Registered protocol family 2
[    0.560000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.570000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.570000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.580000] TCP: reno registered
[    0.580000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.600000] NET: Registered protocol family 1
[    0.620000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.620000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Re
d Hat, Inc.
[    0.640000] msgmni has been set to 120
[    0.640000] io scheduler noop registered
[    0.640000] io scheduler deadline registered (default)
[    0.650000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.650000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
[    0.660000] console [ttyATH0] enabled, bootconsole disabled
[    0.660000] console [ttyATH0] enabled, bootconsole disabled
[    0.670000] ath79-spi ath79-spi: master is unqueued, this is deprecated
[    0.680000] m25p80 spi0.0: found w25q128, expected m25p80
[    0.680000] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.690000] 7 cmdlinepart partitions found on MTD device spi0.0
[    0.690000] Creating 7 MTD partitions on "spi0.0":
[    0.700000] 0x000000000000-0x000000040000 : "u-boot"
[    0.710000] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.710000] 0x000000050000-0x000000250000 : "kernel"
[    0.720000] 0x000000250000-0x000000fe0000 : "rootfs"
[    0.720000] mtd: partition "rootfs" set to be root filesystem
[    0.730000] mtd: partition "rootfs_data" created automatically, ofs=480000, len=B60000
[    0.740000] 0x000000480000-0x000000fe0000 : "rootfs_data"
[    0.740000] 0x000000fe0000-0x000000ff0000 : "nvram"
[    0.750000] 0x000000ff0000-0x000001000000 : "art"
[    0.750000] 0x000000050000-0x000000fe0000 : "firmware"
[    0.770000] libphy: ag71xx_mdio: probed
[    0.780000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    1.330000] eth0: Found an AR7240/AR9330 built-in switch
[    2.370000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.920000] ag71xx ag71xx.0 eth1: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Gen
eric PHY]
[    2.930000] TCP: cubic registered
[    2.930000] NET: Registered protocol family 17
[    2.940000] 8021q: 802.1Q VLAN Support v1.8
[    2.950000] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    2.960000] Freeing unused kernel memory: 244k freed
[    4.310000] SQUASHFS error: xz_dec_run error, data probably corrupt
[    4.310000] SQUASHFS error: squashfs_read_data failed to read block 0x14616e
[    4.320000] SQUASHFS error: Unable to read fragment cache entry [14616e]
[    4.320000] SQUASHFS error: Unable to read page, block 14616e, size 14160
[
@blackketter

Doh! Bad serial cable, both Kermit and YModem appeared to succeed, but switching to a different serial cable seemed to make it work.

Sorry for the trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment