VoCore2: Boot from memory/USB

Sometimes we need to do some test fast, or test new system like ECOS, so maybe boot from flash is not a good idea, it is slow to write and load. Then maybe good idea is boot from memory.

First, enable ramdisk from openwrt menuconfig, this is default enabled normally.

If not, it is at make menuconfig => Target Images => [*] ramdisk

After setup and compile, you will find openwrt-ramips-mt76x8-vocore_vocore2-initramfs-kernel.bin at openwrt/bin/targets/ramips/mt76x8 folder.

Then we can copy it to a USB disk which formatted in FAT(because default uboot only support this disk format), rename to ram.bin (because FAT might not good at support too long file name)

Plug the usb disk to your VoCore2, and power on it. When uboot menu shows up from UART, press 4 to entry uboot command console. Then call “usb start” to enable usb, “usb storage” to load usb disk, “fatload usb 0:1 0x81000000 ram.bin” to load ram.bin to memory and final “bootm 0x81000000 ” to boot from memory.

PS: if your flash is 32MB or more, need to modify start address.

The log I attach here:

flash manufacture id: ef, device id 40 18                                       
find flash: W25Q128BV                                                           
Ralink UBoot Version: VOCORE2                                                   
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:Aug  8 2019  Time:16:16:35                                                 
icache: sets:512, ways:4, linesz:32 ,total:65536                                
dcache: sets:256, ways:4, linesz:32 ,total:32768                                
 ##### The CPU freq = 575 MHZ ####                                              
 estimate memory size =128 Mbytes                                               
RESET MT7628 PHY!!!!!!                                                          
Please choose the operation:                                                    
   0: Load system code then write to Flash via Serial.                          
   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.                                         
   5: Load system code then write to Flash via USB Storage.                     
   7: Load Boot Loader code then write to Flash via Serial.                     
   9: Load Boot Loader code then write to Flash via TFTP.                       
   r: Reset firmware to first boot.                                             
You choosed 4                                                                   
4: System Enter Boot Command Line Interface.                                    
U-Boot 1.1.3 (Aug  8 2019 - 16:16:35)                                           
MT7628 # usb start                                                              
(Re)start USB...                                                                
USB0:   *********ehci_hcd_init**********                                        
Mediatek/Ralink USB EHCI host init hccr b01c0000 and hcor b01c0010 hc_length 16 
 6. u2phydcr0(0xb0120860)=0x00aaaa02                                            
 FM_OUT value: u4FmOut = 0(0x00000000)                                          
 FM_OUT value: u4FmOut = 149(0x00000095)                                        
 FM detection done! loop = 1                                                    
 SR calibration value u1SrCalVal = 5                                            
Register 1111 NbrPorts 1                                                        
USB EHCI 1.00                                                                   
scanning bus 0 for devices... 2 USB Device(s) found                             
       scanning bus for storage devices... 1 Storage Device(s) found            
MT7628 # usb storage                                                            
  Device 0: Vendor: Generic  Prod.: STORAGE DEVICE   Rev: 0272                  
            Type: Removable Hard Disk                                           
            Capacity: 29862.0 MB = 29.1 GB (61157376 x 512)                                                                    
MT7628 # fatload                                                                
usage: fatload <interface> <dev[:part]> <addr> <filename> [bytes]               
MT7628 # fatload usb 0:1 0x81000000 ram.bin                                     
reading ram.bin                                                                 
5420311 bytes read                                                              
MT7628 #                                                                        
MT7628 # bootm 0x81000000                                                       
## Booting image at 81000000 ...                                                
   Image Name:   MIPS OpenWrt Linux-5.4.215                                     
   Image Type:   MIPS Linux Kernel Image (lzma compressed)                      
   Data Size:    5420247 Bytes =  5.2 MB                                        
   Load Address: 80000000                                                       
   Entry Point:  80000000                                                       
   Verifying Checksum ... OK                                                    
   Uncompressing Kernel Image ... OK                                            
No initrd                                                                       
## Transferring control to Linux (at address 80000000) ...                      
[    0.000000] Linux version 5.4.215 (...)
[    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 MT7628AN ver:1 eco:2                          
[    0.000000] printk: bootconsole [early0] enabled                             
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)                          
[    0.000000] MIPS: machine is VoCore2                                         
[    0.000000] Initrd not found or empty - disabling initrd                     
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.