Reset Search



How to use USB stick to update kernel and rootfs based on u-boot

« Go Back


How to use USB stick to update kernel and rootfs based on u-boot?
The example is based on SAM9X5-EK.
Firstly, the u-boot must be upgraded to version 2012.10 and later. 
And then, please follow the commands as below: 

U-Boot> usb info 
USB is stopped. Please issue 'usb start' first. 
U-Boot> usb start 
(Re)start USB... 
USB0:   scanning bus 0 for devices... 2 USB Device(s) found 
       scanning usb for storage devices... 1 Storage Device(s) found 
U-Boot> usb info 
1: Hub,  USB Revision 1.10 
 -  OHCI Root Hub 
 - Class: Hub 
 - PacketSize: 8  Configurations: 1 
 - Vendor: 0x0000  Product 0x0000 Version 0.0 
   Configuration: 1 
   - Interfaces: 1 Self Powered 0mA 
     Interface: 0 
     - Alternate Setting 0, Endpoints: 1 
     - Class Hub 
     - Endpoint 1 In Interrupt MaxPacket 2 Interval 255ms 

2: Mass Storage,  USB Revision 2.0 
 - Kingston DataTraveler 2.0 0019E06C5346F99012CF08C3 
 - Class: (from Interface) Mass Storage 
 - PacketSize: 64  Configurations: 1 
 - Vendor: 0x0951  Product 0x1607 Version 1.0 
   Configuration: 1 
   - Interfaces: 1 Bus Powered 100mA 
     Interface: 0 
     - Alternate Setting 0, Endpoints: 2 
     - Class Mass Storage, Transp. SCSI, Bulk only 
     - Endpoint 1 In Bulk MaxPacket 64 
     - Endpoint 2 Out Bulk MaxPacket 64 

U-Boot> usb storage 
  Device 0: Vendor: Kingston Rev: 1.00 Prod: DataTraveler 2.0 
            Type: Removable Hard Disk 
            Capacity: 7643.9 MB = 7.4 GB (15654848 x 512) 
U-Boot> fatls usb 0 
 51642368   rootfs.ubi 
  2351676   uimage 
    21482   demo_at91so101.s19 
    21482   cts-anypay.s19 
      156   demo_at91so101_res1.s19 
    44636   background2.jpg 
   130177   agit7-2.png 
   131533   agit7-3.png 
      645   launchjtagload_demo_at91so101.bat 
       56   .dropbox.device 

11 file(s), 4 dir(s) 

U-Boot> fatload usb 0 0x20000000 uimage 
reading uimage 
2351676 bytes read in 6296 ms (364.3 KiB/s) 
U-Boot> nand       
nand - NAND sub-system 

nand info - show available NAND devices 
nand device [dev] - show or set current device 
nand read - addr off|partition size 
nand write - addr off|partition size 
    read/write 'size' bytes starting at offset 'off' 
    to/from memory address 'addr', skipping bad blocks. 
nand read.raw - addr off|partition [count] 
nand write.raw - addr off|partition [count] 
    Use read.raw/write.raw to avoid ECC and access the flash as-is. 
nand write.trimffs - addr off|partition size 
    write 'size' bytes starting at offset 'off' from memory address 
    'addr', skipping bad blocks and dropping any pages at the end 
    of eraseblocks that contain only 0xFF 
nand erase[.spread] [clean] off size - erase 'size' bytes from offset 'off' 
    With '.spread', erase enough for given file size, otherwise, 
    'size' includes skipped bad blocks. 
nand erase.part [clean] partition - erase entire mtd partition' 
nand erase.chip [clean] - erase entire chip' 
nand bad - show bad blocks 
nand dump[.oob] off - dump page 
nand scrub [-y] off size | scrub.part partition | scrub.chip 
    really clean NAND erasing bad blocks (UNSAFE) 
nand markbad off [...] - mark bad block(s) at offset (UNSAFE) 
nand biterr off - make a bit error at offset (UNSAFE) 
U-Boot> nand erase 0x200000 0xf800000 

NAND erase: device 0 offset 0x200000, size 0xf800000 
Erasing at 0xf9e0000 -- 100% complete. 
U-Boot> nand write.trimffs 0x20000000 0x200000 0x23e23c 

NAND write: device 0 offset 0x200000, size 0x23e23c 
 2351676 bytes written: OK 
U-Boot> fatload usb 0 0x22000000 rootfs.ubi             
reading rootfs.ubi 
51642368 bytes read in 136831 ms (368.2 KiB/s) 
U-Boot> nand write.trimffs 0x22000000 0x800000 0x3140000 

NAND write: device 0 offset 0x800000, size 0x3140000 
 51642368 bytes written: OK 
U-Boot> boot 

NAND read: device 0 offset 0x200000, size 0x300000 
 3145728 bytes read: OK 
## Booting kernel from Legacy Image at 22000000 ... 
   Image Name:   Angstrom/2.6.39/at91sam9x5ek 
   Image Type:   ARM Linux Kernel Image (uncompressed) 
   Data Size:    2351612 Bytes = 2.2 MiB 
   Load Address: 20008000 
   Entry Point:  20008000 
   Verifying Checksum ... OK 
   Loading Kernel Image ... OK 

Starting kernel ...



Was this article helpful?



Please tell us how we can make this article more useful.

Characters Remaining: 255