AI7688 update issue

Hi all,

I have OpenWRT based, AI7688 board. I am trying to update firmware(sysupgrade image) into the board using loadb command. But when using cp command in u-boot then its not working.

Also, bootm command is not booting the firmware from the location. Its booting the firmware from the address where the firmware is loaded.

Below are the logs shown the issue occured

U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)
MT7628 # loadb 0x80a00000 57600
## Ready for binary (kermit) download to 0x80A00000 at 57600 bps...
[04050C08][04050C0E]
DDR Calibration DQS reg = 00008986


U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)

Board: Ralink APSoC
DRAM:  128 MB
relocate_code Pointer at: 87f68000
flash manufacture id: c2, device id 20 1a
find flash: MX25L51245G
============================================
Ralink UBoot Version: 4.3.0.0
--------------------------------------------
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Feb 16 2017  Time:08:19:34
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 580 MHZ ####
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!

GPIOMODE --> 50054404

GPIOMODE2 --> 5540551

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.

You choosed 4

 0


4: System Enter Boot Command Line Interface.

U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)
MT7628 # loadb 0x80a00000 57600
## Ready for binary (kermit) download to 0x80A00000 at 57600 bps...
## Total Size      = 0x01540004 = 22282244 Bytes
## Start Addr      = 0x80A00000
MT7628 # erase linux

 Erase linux kernel block !!
From 0x50000 length 0x3FB0000
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
MT7628 # cp.linux

 Copy linux image[1431655765 byte] to SPI Flash[0x00050000]....
MT7628 # help
?       - alias for 'help'
bootm   - boot application image from memory
cp      - memory copy
crc32   - checksum calculation
erase   - erase SPI FLASH memory
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
go      - start application at address 'addr'
help    - print online help
loadb   - load binary file over serial line (kermit mode)
md      - memory display
mdio   - Ralink PHY register R/W command !!
mm      - memory modify (auto-incrementing)
nm      - memory modify (constant address)
printenv- print environment variables
reset   - Perform RESET of the CPU
rf      - read/write rf register
saveenv - save environment variables to persistent storage
setenv  - set environment variables
spi     - spi command
tftpboot- boot image via network using TFTP protocol
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor version
MT7628 # help cp
cp
cp.uboot
    - copy uboot block
cp.linux
    - copy linux kernel block

MT7628 # cp.linux

 Copy linux image[1431655765 byte] to SPI Flash[0x00050000]....
MT7628 # bootm
## Booting image at 80a00000 ...
   Image Name:   MIPS OpenWrt Linux-3.18.23
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1194147 Bytes =  1.1 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 128

Starting kernel ...

[    0.000000] Linux version 3.18.23 (blogic@debian) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r49203) ) #5 Tue Sep 27 11:48:57 CEST 2016
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7688 ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is MediaTek LinkIt Smart 7688
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x07ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x07ffffff]
[    0.000000] Initmem setup node 0 [mem 0x00000000-0x07ffffff]
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS2,57600 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=0000d47c
[    0.000000] Readback ErrCtl register=0000d47c
[    0.000000] Memory: 126140K/131072K available (2658K kernel code, 129K rwdata, 532K rodata, 192K init, 190K bss, 4932K reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource_of_init: no matching clocksources found
[    0.000000] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.060000] pid_max: default: 32768 minimum: 301
[    0.060000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.080000] pinctrl core: initialized pinctrl subsystem
[    0.090000] NET: Registered protocol family 16
[    0.110000] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.120000] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.130000] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.140000] Switched to clocksource MIPS
[    0.150000] NET: Registered protocol family 2
[    0.150000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.170000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.180000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.190000] TCP: reno registered
[    0.200000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.210000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.220000] NET: Registered protocol family 1
[    0.230000] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.260000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.280000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.300000] msgmni has been set to 246
[    0.310000] io scheduler noop registered
[    0.310000] io scheduler deadline registered (default)
[    0.320000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.340000] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.360000] 10000d00.uart1: ttyS1 at MMIO 0x10000d00 (irq = 29, base_baud = 2500000) is a 16550A
[    0.380000] console [ttyS2] disabled
[    0.380000] 10000e00.uart2: ttyS2 at MMIO 0x10000e00 (irq = 30, base_baud = 2500000) is a 16550A
[    0.400000] console [ttyS2] enabled
[    0.400000] console [ttyS2] enabled
[    0.420000] bootconsole [early0] disabled
[    0.420000] bootconsole [early0] disabled
[    0.430000] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    0.450000] m25p80 spi32766.0: found mx66l51235l, expected mx25l25635e
[    0.470000] m25p80 spi32766.0: mx66l51235l (65536 Kbytes)
[    0.480000] m25p80 spi32766.0: using chunked io
[    0.490000] 4 ofpart partitions found on MTD device spi32766.0
[    0.500000] Creating 4 MTD partitions on "spi32766.0":
[    0.510000] 0x000000000000-0x000000030000 : "u-boot"
[    0.520000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.530000] 0x000000040000-0x000000050000 : "factory"
[    0.540000] 0x000000050000-0x000002000000 : "firmware"
[    0.650000] ralink_soc_eth 10100000.ethernet eth0: ralink at 0xb0100000, irq 5
[    0.660000] mt7621_wdt 10000120.watchdog: Initialized
[    0.670000] TCP: cubic registered
[    0.680000] NET: Registered protocol family 17
[    0.690000] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    0.720000] Bridge firewalling registered
[    0.720000] 8021q: 802.1Q VLAN Support v1.8
[    0.730000] mtk-linkit bootstrap: Version  :
[    0.740000] mtk-linkit bootstrap: Revision :
[    0.750000] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.770000] Please append a correct "root=" boot option; here are the available partitions:
[    0.780000] 1f00             192 mtdblock0  (driver?)
[    0.790000] 1f01              64 mtdblock1  (driver?)
[    0.800000] 1f02              64 mtdblock2  (driver?)
[    0.810000] 1f03           32448 mtdblock3  (driver?)
[    0.820000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.820000] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[04050C09][04050C0D]
DDR Calibration DQS reg = 00008987


U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)

Board: Ralink APSoC
DRAM:  128 MB
relocate_code Pointer at: 87f68000
flash manufacture id: c2, device id 20 1a
find flash: MX25L51245G
============================================
Ralink UBoot Version: 4.3.0.0
--------------------------------------------
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Feb 16 2017  Time:08:19:34
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 580 MHZ ####
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!

GPIOMODE --> 50054404

GPIOMODE2 --> 5540551

Please choose the operation:
   1: Load system code to SDRAM via TFTP.
   2: Load system code then write to Flash via TFTP.
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial.
   9: Load Boot Loader code then write to Flash via TFTP.

Can someone please let me know how can we get it resolved.

Thanks in advance,
Lad Dhawal Umesh

linux is usually only the kernel, you need a root file system too.

Its(sysupgrade) a combination of both linux and rootfs

in that case it's written/assembled incorrectly, or the root= param is wrong, as the kernel message says.

what does printenv say ?

you could try the recovery/install method described in https://openwrt.org/toh/seeed/linkit7688

The result of printenv is as mentioned below

MT7628 # printenv
bootcmd=tftp
bootdelay=3
baudrate=57600
ethaddr="00:AA:BB:CC:DD:10"
ipaddr=10.10.10.123
serverip=10.10.10.3
BackDoor=1
stdin=serial
stdout=serial
stderr=serial

Environment size: 160/4092 bytes

The site hase defaut firmware. But when loading the firmware avaliable in given link then same issue gets occur

the point was to use the hidden option ...

I usually boot an initramfs image from RAM, then use it to install the sysupgrade. This is safer than writing directly to flash, where a typo can erase critical partitions.

If you do want to write directly to flash, the cp.b command copies your specified number of bytes, so you can be sure the whole image has been flashed.

Yes, as per your suggection i also want to use the same, but the current uboot avaliable dosen't have the cp.b command support. So thats the reason i need to use cp.linux command.

Sorry but i can't get your point.
Can youo please elebrate it more please...

try (re)reading the wiki link provided ...

Okk I will go through it and let you know about the same

I have gone through the link but the firmware is also not working.

The cp.linux command is not working.
When I am using bootm command then its booting the firmware from the 0x80a00000 where the firmware is loadedd.

It's not copying the image to the defult booting location.
Due to this an issue is occured. Please provide the solution To update the firmwre in AI7688H module using serial communication.

Below steps shows the firmware is not getting cpoied to the default address at bc050000.

U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)

Board: Ralink APSoC
DRAM:  128 MB
relocate_code Pointer at: 87f68000
flash manufacture id: c2, device id 20 1a
find flash: MX25L51245G
============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Feb 16 2017  Time:08:19:34
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!

GPIOMODE --> 50054404

GPIOMODE2 --> 5540551

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 

You choosed 4

 0 

   
4: System Enter Boot Command Line Interface.

U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)
MT7628 # 
MT7628 # 
MT7628 # 
MT7628 # loadb 0x80000000 57600
## Ready for binary (kermit) download to 0x80000000 at 57600 bps...
## Total Size      = 0x00540164 = 5505380 Bytes
## Start Addr      = 0x80000000
MT7628 # help erase
erase 
erase all
    - erase all FLASH banks
erase uboot
    - erase uboot block
erase linux
    - erase linux kernel block

MT7628 # erase linux

 Erase linux kernel block !!
From 0x50000 length 0x3FB0000
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
MT7628 # help cp
cp 
cp.uboot
    - copy uboot block
cp.linux
    - copy linux kernel block

MT7628 # cp.linux 

 Copy linux image[1431655765 byte] to SPI Flash[0x00050000].... 
MT7628 # 

MT7628 # reset
[04050C09][04050C0D]
DDR Calibration DQS reg = 00008987


U-Boot 1.1.3 for AI7688H-64MB (Feb 16 2017 - 08:19:34)

Board: Ralink APSoC
DRAM:  128 MB
relocate_code Pointer at: 87f68000
******************************
Software System Reset Occurred
******************************
flash manufacture id: c2, device id 20 1a
find flash: MX25L51245G
============================================ 
Ralink UBoot Version: 4.3.0.0
-------------------------------------------- 
ASIC 7628_MP (Port5<->None)
DRAM component: 1024 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 128 MBytes
Flash component: SPI Flash
Date:Feb 16 2017  Time:08:19:34
============================================ 
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 580 MHZ #### 
 estimate memory size =128 Mbytes
RESET MT7628 PHY!!!!!!

GPIOMODE --> 50054404

GPIOMODE2 --> 5540551

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 
 2  1  0 
   
3: System Boot system code via Flash.
## Booting image at bc050000 ...
Bad Magic Number,FFFFFFFF 
[04050C09][04050C0E]
DDR Calibration DQS reg = 00008987

So, please provide the steps to update the firmware (kernel and rootfs) in AI7688H module using serail connection.

Seems there's a discrepancy here ....

Can you please provide the steps to update firmware using serial connection in AI7688H module...

Why do you think it should be copied to that address? The kernel log in your first post rather clearly says the firmware-partition starts at 0x50000 and according to the log, it is being written to the correct location, too.

Yes, bootm boots from RAM. It is working as intended.

1 Like

Just to clarify, you are trying to install AcSip's own, custom firmware and not official OpenWrt?

What I have gathered from these posts:

  • You are attempting to boot a kernel that is not for your device, which entails that the entire image isn't for your device. The kernel expects a 32MB flash, whereas your device has a 64MB one -- the kernel will work fine, but half the flash will go to waste.
  • Uboot's cp.linux only seems to copy the kernel, instead of the entire image, meaning that no rootfs gets copied?
  • When uboot complains that there's a bad magic number and can't boot from 0xBC050000, it doesn't refer to the address on the SPI flash, but instead a RAM-address. Why it fails to load the kernel to that address, I don't know, but it probably has something to do with the image being wrong.
1 Like

I have created image for 64mb flash. I need to update the firmware through loadb command.

File is getting downloaded using loadb command, but while using cp.linux command the binary is not getting copied to the flash location.

Due to which the firmware is not getting booted.

I am uploading sysupgrade image. So please let me knwo at which addres i need to upload the binary so that cp.linux command works successfully.

I think it would be far better for you to download an initramfs image, not sysupgrade image, and then use bootm to boot into the initramfs image. You can then download the sysupgrade image from there and just use the sysupgrade-command.

1 Like

@WereCatf ,

Thanks for your kind support and providing response as per query.

Myself Ritesh Prajapati working with Dhawal into same project

Here, We are struggling to flash kernel image or sysfsupgrade image from Boot Loader itself in which we are using cp.linux command from boot loader which has been already flashed by module manufacture using below link

GitHub - AcSiP/linkit-smart-7688-uboot at AI7688H__64MB

So, We just need one help regarding actual load address and flash address using which we can able to flash images using cp.linux command as flash is already erased except u-boot partition?

We have checked cp.linux command source code into boot loader but didn;t get exact address location from where it is going to copy image from RAM location to Flash Location. SO It would be good if you can provide some help for the understanding.

Let me know if need anything else from my end to understand issue

Regards,
Ritesh Prajapati

Is there some good reason why you are refusing to do it from initramfs?

I hope you didn't erase the factory partition.

cp.linux does write to the correct address on the SPI flash, but from the logs it looks like it is only writing the kernel, not the entire image, which is why I suggest doing it from initramfs instead. If you insist on not using initramfs, I suggest you check what help spi gives you instead -- maybe you can use those commands to write the full image instead of cp.linux

Another option would be to replace entire uboot itself with a newer one, like e.g. the Onion Omega - project has a far more user-friendly and capable uboot that you could use at https://github.com/OnionIoT/omega2-bootloader (though you'd have to modify it to support a 64MB flash as well and you might want to replace any Onion Omega - pictures and references with your company's ones)

1 Like