Booting Linux from QSPI on AMC1 with RFS on NFS

From DSignT Support Database
Jump to: navigation, search


1 Preparation

Boot into U-Boot and stop execution by pressing a key

U-Boot 2017.01 (Nov 14 2017 - 13:37:55 +0100)

CPU  : AM437X-GP rev 1.2
I2C:   ready
DRAM:  512 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB, m
apped at 30000000
In:    serial
Out:   serial
Err:   serial
Net:   cpsw
Hit any key to stop autoboot:  0
AMC1>


To boot a Linux Kernel from QSPI Flash you first need to load a Kernel and a DTB from either TFTP server or from USB stick and store these images on the QSPI Flash at suitable address offsets. Ref. to Serial FLASH mapping on AMC1.




2 Load Kernel Image and DTB

2.1 Use TFTP server

2.1.1 Network settings

To access the TFTP server you need to do a proper network configuration first. Either enter all necessary environment variables manually on the U-Boot command prompt or use script AMC1_NetConfig.ser to make all these settings automatically.

Required network settings:
eth1addr - own MAC address

   AMC1> setenv eth1addr c4:be:84:cb:1f:ff

ipaddr - own IP address

   AMC1> setenv ipaddr 192.168.168.197

serverip - remote server IP

   AMC1> setenv serverip 192.168.168.208

2.1.2 Load compressed Linux image from TFTP server

If all network settings are correct, a compressed Linux image can be loaded from TFTP server:

  tftpboot ${loadaddr} zImage-dsignt_amc1.bin

${loadaddr} is a pre-defined environment variable that specifies a free DDR RAM location for general purpose. We use it here as a temporary storage address for the TFTP transfer.

When the TFTP transfer succeeds, each received block (512 bytes) a '#' is printed on the terminal else a 'T' for timeout signals a problem connecting the server. A successful transmission can look like this (of course the IP addresses vary depending on your network configuration):

MC1> tftpboot ${loadaddr} zImage-dsignt_amc1.bin
link up on port 1, speed 1000, full duplex
Using cpsw device
TFTP from server 192.168.168.208; our IP address is 192.168.168.194
Filename 'zImage-dsignt_amc1.bin'.
Load address: 0x80200000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ####################
         1.3 MiB/s
done
Bytes transferred = 3759704 (395e58 hex)
AMC1>




2.1.3 Load DTB from TFTP server

tftpboot ${fdtaddr} amc1.dtb

${fdtaddr} is a pre-defined environment variable that specifies a free DDR RAM location for general purpose. We use it here as a temporary storage address for the TFTP transfer.

AMC1> tftpboot ${fdtaddr} amc1.dtb
link up on port 1, speed 1000, full duplex
Using cpsw device
TFTP from server 192.168.168.208; our IP address is 192.168.168.194
Filename 'amc1.dtb'.
Load address: 0x88000000
Loading: #########
         1.2 MiB/s
done
Bytes transferred = 42545 (a631 hex)
AMC1>



Continue with step 3 Write Image and DTB to Flash




2.2 Use USB Stick

2.2.1 usb start and usb info

  usb start

Initialize the USB controler and enumerate all USB devices

AMC1> usb start
starting USB...
USB0:   Register 2000440 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
AMC1>



  usb info

Print detailed information of enumerated devices

AMC1> usb info
1: Hub,  USB Revision 3.0
 - U-Boot XHCI Host Controller
 - Class: Hub
 - PacketSize: 9  Configurations: 1
 - Vendor: 0x0000  Product 0x0000 Version 1.0
   Configuration: 1
   - Interfaces: 1 Self Powered 0mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 1
     - Class Hub
     - Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms

2: Mass Storage,  USB Revision 2.0
 - USBest Technology USB Mass Storage Devie 1009135102477e
 - Class: (from Interface) Mass Storage
 - PacketSize: 64  Configurations: 1
 - Vendor: 0x1307  Product 0x0165 Version 1.0
   Configuration: 1
   - Interfaces: 1 Bus Powered 98mA
     Interface: 0
     - Alternate Setting 0, Endpoints: 3
     - Class Mass Storage, Transp. SCSI, Bulk only
     - Endpoint 1 Out Bulk MaxPacket 512
     - Endpoint 2 In Bulk MaxPacket 512
     - Endpoint 3 In Interrupt MaxPacket 64 Interval 8ms

AMC1>



2.2.2 Load compressed Linux image from USB stick

  fatload usb 0 ${loadaddr} zimage-dsignt_amc1.bin

Load Kernel image from USB mass storage device into RAM

AMC1> fatload usb 0 ${loadaddr} zimage-dsignt_amc1.bin
reading zimage-dsignt_amc1.bin
3759704 bytes read in 2080 ms (1.7 MiB/s)
AMC1>



2.2.3 Load DTB from USB stick

  fatload usb 0 ${fdtaddr} amc1.dtb

Load DTB from USB mass storage device into RAM

AMC1> fatload usb 0 ${fdtaddr} amc1.dtb
reading amc1.dtb
41451 bytes read in 44 ms (919.9 KiB/s)
AMC1>



Continue with step 3 Write Image and DTB to Flash




3 Write Image and DTB to Flash

3.1 sf probe

First check if a serial FLASH is available:

AMC1> sf probe
SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB, m
apped at 30000000
AMC1>



3.2 sf erase

If the probe command finds a serial FLASH, use the erase command to clear the U-Boot FLASH area:

DTB:

AMC1> sf erase 0x120000 0x10000
SF: 65536 bytes @ 0x120000 Erased: OK
AMC1>

Linux Kernel (assumed filesize < 0x400000):

AMC1> sf erase 0x200000 0x400000
SF: 4194304 bytes @ 0x200000 Erased: OK
AMC1>



3.3 sf write

sf write writes a previously loaded image from RAM to serial FLASH

DTB:

AMC1> sf write ${fdtaddr} 0x120000 0x10000
device 0 offset 0x120000, size 0x10000
SF: 65536 bytes @ 0x120000 Written: OK
AMC1>

Linux Kernel:

AMC1> sf write ${loadaddr} 0x200000 0x400000
device 0 offset 0x200000, size 0x400000
SF: 4194304 bytes @ 0x200000 Written: OK
AMC1>



4 re-boot and load the image

After re-boot you need to probe for the SF first:

AMC1> sf probe
SF: Detected w25q64cv with page size 256 Bytes, erase size 4 KiB, total 8 MiB, m
apped at 30000000
AMC1>



4.1 Load Kernel and DTB from QSPI Flash

   sf read ${loadaddr} 0x200000 0x400000
   sf read ${fdtaddr} 0x120000 0x10000
AMC1> sf read ${loadaddr} 0x200000 0x400000
device 0 offset 0x200000, size 0x400000
SF: 4194304 bytes @ 0x200000 Read: OK
AMC1> sf read ${fdtaddr} 0x120000 0x10000
device 0 offset 0x120000, size 0x10000
SF: 65536 bytes @ 0x120000 Read: OK
AMC1>



4.2 Set bootargs

The global environment variable bootargs is automatically passed to the booting Linux. Make sure nfsroot points to the valid NFS path on your NFS server:

setenv bootargs root=/dev/nfs rw rootfstype=ext4 rootwait fixrtc  nfsroot=${serverip}:/home/sitara/ti-processor-sdk-linux-am437x-evm-04.01.00.06/targetNFS,vers=3 ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${device}:${autoconf}

In this case with installed SDK 04.01.00.06 tools on server ${serverip} the correct path is:

${serverip}:/home/sitara/ti-processor-sdk-linux-am437x-evm-04.01.00.06/targetNFS





4.3 Boot Linux zImage

  bootz ${loadaddr} - ${fdtaddr}
AMC1> bootz ${loadaddr} - ${fdtaddr}
Kernel image @ 0x80200000 [ 0x000000 - 0x395e58 ]
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Using Device Tree in place at 88000000, end 8800d630

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.41-ge3a80a1c5c (sitara@sitara-sdk401)
...





Arr u.png    back to top

5 Additional Tags

Serial FLASH mapping on AMC1


Contact Post.png Support Tool.png