U-Boot

Environment Variables

To print an environment variable, use the printenv command:

To set an environment variable, use the setenv command:

You don’t actually need the equals sign! This works also:

If you want to set a variable to something which includes special characters, such as spaces or semi-colons, you can enclose the value in single quotes:

The above variable, when executed, runs several commands.

Setting The Device’s IP Address

There are two ways of setting the IP address of the device running U-Boot (useful if you are going to boot via TFTP). You can either use the network DHCP or define a static IP address. To use the network DHCP:

To use a static IP address:

Booting Via TFTP

TFTP is a great way to boot Linux on your board when developing, because it is quick and requires no physical medium to be moved from your computer to the board (unlike the SD card option).

Setting TFTP Up On Development Computer

This following guide assumes you are running Ubuntu (this was tested on Ubuntu v14.04 64-bit):

Install the following packages:

Create a file called /etc/xinetd.d/tftp and save the text below inside it:

Create a folder called /ftpboot:

Restart the TFTP server:

The TFTP server should now be up and running!

Setting TFTP Up On Embedded Device

U-Boot needs to be told about the address of the TFTP server (this will be the IP address of your computer you are building the Linux image on):

We normally want to disable autoload, as this causes U-Boot to try and automatically download an image and boot from it as soon as we type dhcp:

Then we can force U-Boot to look for a DHCP server and request an IP address:

We can then use tftpboot commands to download files over TFTP and place them at specific locations in memory. This example below is for the Xilinx Zynq ZC702 development board:

These commands can be combined and saved to the boot variable:

Remember to use saveenv if you want these config parameters to persist when power cycling.

 

Posted: April 21st, 2017 at 7:54 am
Last Updated on: September 1st, 2017 at 11:08 am