Jan 2012
23

Les Ubiquiti Nanostation sont relativement tolérantes aux fausses manipulations, mais elles peuvent être rendues inutilisables par une corruption de la partition cfg de la mémoire flash, le reflashage par un firmware d’origine ne résout pas le problème.

Une connexion série (paramètre de connexion 115200 8N1) permet d’accéder au menu U-Boot, de visualiser la log de démarrage  et de réinitialiser la partition cfg si besoin.


 U-Boot 1.1.4.2 (Jul 13 2010 - 20:06:30)
Board: Ubiquiti Networks XM board (rev 0.0 e005)
 DRAM:  32 MB
 Flash:  8 MB
 Net:   eth0, eth1
 Hit any key to stop autoboot:  0
 ## Booting image at 9f050000 ...
 Image Name:   MIPS Ubiquiti Linux-2.6.15-5.2
 Created:      2011-04-29  14:46:35 UTC
 Image Type:   MIPS Linux Kernel Image (lzma compressed)
 Data Size:    779146 Bytes = 760.9 kB
 Load Address: 80002000
 Entry Point:  80002000
 Verifying Checksum ... OK
 Uncompressing Kernel Image ... OK
Starting kernel ...
Booting...
 ...mounts done
 ...filesystem init done
 ...base ok
 ...update ok
 ...symlinks ok
 ...httpd ok
 ...detect ok
 ...running /sbin/init

La Nanostation reste bloquée au démarrage dans le /sbin/init … probablement à cause d’un script de démarrage qui tourne en rond.

On redémarre la Nanostation, la frappe d’une touche à l’invite permet d’accéder au menu U-Boot.

U-Boot 1.1.4.2 (Jul 13 2010 - 20:06:30)
Board: Ubiquiti Networks XM board (rev 0.0 e005)
 DRAM:
U-Boot 1.1.4.2 (Jul 13 2010 - 20:06:30)
Board: Ubiquiti Networks XM board (rev 0.0 e005)
 DRAM:  32 MB
 Flash:  8 MB
 Net:   eth0, eth1
 Hit any key to stop autoboot:  0
 ar7240> printenv
 baudrate=115200
 ethaddr=00:15:6d:0d:00:00
 serverip=192.168.1.254
 bootdelay=5
 ethact=eth0
 mtdparts=mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),1024k(kernel),6528k(rootfs),256k(cfg),64k
 (EEPROM)
 bootcmd=bootm 0x9f050000
 bootargs=console=ttyS0,115200 root=31:03 rootfstype=squashfs init=/init
 ipaddr=192.168.1.20
 stdin=serial
 stdout=serial
 stderr=serial

ar7240> help
 ?       - alias for 'help'
 autoscr - run script from memory
 base    - print or set address offset
 boot    - boot default, i.e., run 'bootcmd'
 bootd   - boot default, i.e., run 'bootcmd'
 bootelf - Boot from an ELF image in memory
 bootm   - boot application image from memory
 cmp     - memory compare
 cp      - memory copy
 crc32   - checksum calculation
 echo    - echo args to console
 erase   - erase FLASH memory
 flinfo  - print FLASH memory information
 go      - start application at address 'addr'
 help    - print online help
 iminfo  - print header information for application image
 imls    - list all images found in flash
 loop    - infinite loop on address range
 md      - memory display
 mii     - MII utility commands
 mm      - memory modify (auto-incrementing)
 mtdparts- define flash/nand partitions
 mtest   - simple RAM test
 mw      - memory write (fill)
 nm      - memory modify (constant address)
 ping    - send ICMP ECHO_REQUEST to network host
 printenv- print environment variables
 protect - enable or disable FLASH write protection
 reset   - Perform RESET of the CPU
 run     - run commands in an environment variable
 saveenv - save environment variables to persistent storage
 setenv  - set environment variables
 sleep   - delay execution for some time
 tftpboot- boot image via network using TFTP protocol
 urescue - start TFTP server and wait for firmware
 version - print monitor version
 ar7240> help erase
 erase start end
 - erase FLASH from addr 'start' to addr 'end'
 erase start +len
 - erase FLASH from addr 'start' to the end of sect w/addr 'start'+'len'-1
 erase N:SF[-SL]
 - erase sectors SF-SL in FLASH bank # N
 erase bank N
 - erase FLASH bank # N
 erase <part-id>
 - erase partition
 erase all
 - erase all FLASH banks

Déterminer la zone de la flash à effacer :

ar7240> imls
Image at 9F050000:
   Image Name:   MIPS Ubiquiti Linux-2.6.15-5.2
   Created:      2011-01-14  12:43:09 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    771914 Bytes = 753.8 kB
   Load Address: 80002000
   Entry Point:  80002000
   Verifying Checksum ... OK

ar7240> mtdparts
device nor0 <ar7240-nor0>, # parts = 6
 #: name                        size            offset          mask_flags
 0: u-boot                      0x00040000      0x00000000      0
 1: u-boot-env                  0x00010000      0x00040000      0
 2: kernel                      0x00100000      0x00050000      0
 3: rootfs                      0x00660000      0x00150000      0
 4: cfg                         0x00040000      0x007b0000      0
 5: EEPROM                      0x00010000      0x007f0000      0
active partition: nor0,0 - (u-boot) 0x00040000 @ 0x00000000
defaults:
mtdids  : nor0=ar7240-nor0
mtdparts: mtdparts=ar7240-nor0:256k(u-boot),64k(u-boot-env),1024k(kernel),6528k(rootfs),256k(cfg),64k(EEPROM)

Erase de la partition cfg :

ar7240> erase 0x9f7b0000 +0x00040000
 .... done
 Erased 4 sectors

Et redémarrage de la Nanostation :

ar7240> reset
Resetting...
U-Boot 1.1.4.2 (Jul 13 2010 - 20:06:30)
Board: Ubiquiti Networks XM board (rev 0.0 e005)
 DRAM:  32 MB
 Flash:  8 MB
 Net:   eth0, eth1
 Hit any key to stop autoboot:  0
 ## Booting image at 9f050000 ...
 Image Name:   MIPS Ubiquiti Linux-2.6.15-5.2
 Created:      2011-01-14  12:43:09 UTC
 Image Type:   MIPS Linux Kernel Image (lzma compressed)
 Data Size:    771914 Bytes = 753.8 kB
 Load Address: 80002000
 Entry Point:  80002000
 Verifying Checksum ... OK
 Uncompressing Kernel Image ... OK
Starting kernel ...
Booting...
 ...mounts done
 ...filesystem init done
 ...base ok
 ...update ok
 ...symlinks ok
 ...httpd ok
 ...detect ok
 ...running /sbin/init

Public key portion is:
 ssh-rsa AAAAB3NzaC1yc2EAA ... jBSP1dMbC// ubnt@UBNT
 Fingerprint: md5 7e:ba:4d:f9:ee:58:a2:77:b0:0c:d1:8e:e7:6d:6d:f8
 Public key portion is:
 ssh-dss AAAAB3NzaC1kc3MAA ... azALa18= ubnt@UBNT
 Fingerprint: md5 ...
Please press Enter to activate this console.
 UBNT login:

 

Log de la séquence de flashage du firmware par TFTP

U-Boot 1.1.4.2 (Jul 13 2010 - 20:06:30)
Board: Ubiquiti Networks XM board (rev 0.0 e005)
 DRAM:
U-Boot 1.1.4.2 (Jul 13 2010 - 20:06:30)
Board: Ubiquiti Networks XM board (rev 0.0 e005)
 DRAM:  32 MB
 Flash:  8 MB
 Net:   eth0, eth1
 Hit any key to stop autoboot:  0
 Setting default IP 192.168.1.20
 Starting TFTP server...
 Using eth0 (192.168.1.20), address: 0x81000000
 Waiting for connection: /
 Receiving file from 192.168.1.34:50234
 Received 6835018 bytes
 Firmware Version: XM.ar7240.v5.3.7782.110114.1442
 Setting U-Boot environment variables
 Un-Protected 1 sectors
 Erasing Flash.... done
 Erased 1 sectors
 Writing to Flash... done
 Protected 1 sectors
 Will not overwrite u-boot partition! Skipped.
 Copying partition 'kernel' to flash memory:
 erasing range 0x9F050000..0x9F10FFFF: ............ done
 Erased 12 sectors
 writing to address 0x9f050000, length 0x000c0000 ...
 Copying partition 'rootfs' to flash memory:
 erasing range 0x9F150000..0x9F6EFFFF: ......................................................
 .................................... done
 Erased 90 sectors
 writing to address 0x9f150000, length 0x005a0000 ...
Firmware update complete.
Resetting...

Note

Sur certains modèles la variable bootargs est à modifier pour obtenir la console sur le port série.

ar7240> setenv bootargs console=ttyS0,115200 root=31:03 rootfstype=squashfs init=/init
ar7240> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash.... done
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
ar7240> reset

Références

 Table of hardware OpenWRT
 

 

5 commentaires pour “Nanostation M : RAZ de la partition cfg”

  1. lexcyr a dit :

    bonjour,
    j’aimerai connaitre la configuration complète du cable a utiliser. Es ce qu’il faut seulement un cable serie ou alors cela peu aussi se faire avec un cable réseau avec a l’autre extrémité un connecteur RJ45??
    Merci d’avance

  2. Marc Dilasser a dit :

    Deux câbles sont utilisés, le câble réseau pour alimenter en POE la Nanostation et un cable série capable de faire la conversion TTL; ce dernier n’a rien à voir avec un câble éthernet.
    On en trouve sur Ebay, en recherchant « USB to serial adapter PL2303 ».

  3. Leo a dit :

    Could you please explain me, why did you write this:
    erase 0x9f7b0000 +0x00040000
    instead of
    erase 0x007b0000 +0x00040000

  4. Marc Dilasser a dit :

    Kernel image is at 0x9F050000 (imls command), with an offset of 0x050000 from start of the nand.
    So, cfg with an offset of 0x007b0000, is at 0x0x9f7b0000.

  5. Leo a dit :

    Thank you. I appreciate it

Répondre

*