Difference between revisions of "Loading Images with U-Boot"
(added configuration section) |
(Added Loading to RAM section) |
||
Line 18: | Line 18: | ||
host 192.168.2.1 is alive | host 192.168.2.1 is alive | ||
+ | == Loading Images to RAM == | ||
+ | Files are loaded directly into RAM from through TFTP. In order to load the image, you must know the physical address of the RAM device on the system. Refer to the documentation for your target board if you are unsure what value to use. The standard addresses for some common EMAC systems are shown in Table 1 below. | ||
+ | {| class="wikitable" | ||
+ | ! colspan="2"|Table 1: Physical RAM Addresses | ||
+ | |- | ||
+ | ! Product !! RAM Start Address | ||
+ | |- | ||
+ | | SoM-9260M || 0x20000000 | ||
+ | |- | ||
+ | | SoM-9G20M || 0x20000000 | ||
+ | |- | ||
+ | | SoM-9G45M || 0x70000000 | ||
+ | |- | ||
+ | | SoM-9M10M || 0x70000000 | ||
+ | |} | ||
+ | |||
+ | {{mbox | type = warning | text = Before transferring a file to the system, make sure that it does not exceed the size of the available RAM. }} | ||
+ | |||
+ | The <code>tftp</code> U-Boot command is used to transfer files to the system. The command requires two arguments: the address to load the file to and the filename of the image on the TFTP server. The example below demonstrates loading an image named <code>uImage-2.6.30</code> to RAM on an SoM-9G45M. | ||
+ | U-Boot> tftp 0x70000000 uImage-2.6.30 | ||
+ | macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) | ||
+ | Using macb0 device | ||
+ | TFTP from server 192.168.2.1; our IP address is 192.168.2.2 | ||
+ | Filename 'uImage-2.6.30'. | ||
+ | Load address: 0x70000000 | ||
+ | Loading: ################################################################# | ||
+ | ################################################################# | ||
+ | ################################################################# | ||
+ | ################################################################# | ||
+ | ############################ | ||
+ | done | ||
+ | Bytes transferred = 1472456 (1677c8 hex) | ||
+ | U-Boot> printenv filesize | ||
+ | filesize=1677C8 | ||
+ | |||
+ | {{mbox | type = notice | text = Note that the <code>filesize</code> variable has been automatically updated to the size of the file that was loaded.}} | ||
Revision as of 17:06, 6 May 2013
While U-Boot is used to load and execute the OS after initial programming, it can also be used to program the OS images to the local flash. This page describes the process of using U-Boot to load Linux kernel and filesystem images from a TFTP server and save them to the local flash for use during the boot process. Review the U-Boot Overview page for an introduction to U-Boot before continuing.
Requirements
A TFTP server must be accessible on the local network. The specific details of TFTP server setup and configuration are beyond the scope of this document. EMAC recommends the tftpd
package for use on Debian or Ubuntu Linux systems. For Windows, the Tftpd32 server works well.
Configuration
In order to load a file using TFTP, U-Boot must be configured to access the local network. Static networking configuration is recommended, although DHCP can be used on some systems. Typically, the IP address of the board and the IP address of the TFTP server are the only settings that need to be defined. The network mask and broadcast address will be determined automatically from these settings, and no default gateway setting is required if the server is on the same subnetwork as the board. Before continuing, determine a valid static network address for your local network; contact your IT department for more information on what address to use if required. The example below shows how to set the IP address of the board to 192.168.2.2 and the TFTP server IP address to 192.168.2.1:
U-Boot> setenv ipaddr 192.168.2.2 U-Boot> setenv serverip 192.168.2.1 U-Boot> saveenv Saving Environment to dataflash... U-Boot> reset
Once the network settings have been configured, attempt to ping the TFTP server to test the network connection as illustrated below:
U-Boot> ping 192.168.2.1 macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) Using macb0 device host 192.168.2.1 is alive
Loading Images to RAM
Files are loaded directly into RAM from through TFTP. In order to load the image, you must know the physical address of the RAM device on the system. Refer to the documentation for your target board if you are unsure what value to use. The standard addresses for some common EMAC systems are shown in Table 1 below.
Table 1: Physical RAM Addresses | |
---|---|
Product | RAM Start Address |
SoM-9260M | 0x20000000 |
SoM-9G20M | 0x20000000 |
SoM-9G45M | 0x70000000 |
SoM-9M10M | 0x70000000 |
Before transferring a file to the system, make sure that it does not exceed the size of the available RAM. |
The tftp
U-Boot command is used to transfer files to the system. The command requires two arguments: the address to load the file to and the filename of the image on the TFTP server. The example below demonstrates loading an image named uImage-2.6.30
to RAM on an SoM-9G45M.
U-Boot> tftp 0x70000000 uImage-2.6.30 macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) Using macb0 device TFTP from server 192.168.2.1; our IP address is 192.168.2.2 Filename 'uImage-2.6.30'. Load address: 0x70000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ############################ done Bytes transferred = 1472456 (1677c8 hex) U-Boot> printenv filesize filesize=1677C8
Note that the filesize variable has been automatically updated to the size of the file that was loaded. |