Utilite U-Boot User How-To's

From Utilite Wiki

Jump to: navigation, search


Get help with U-Boot commands

Each of the following commands print the full list of commands supported by U-Boot:


To get help for a specific command, run:

help <command>

Working with environment variables

The U-Boot environment is a collection of settings which are stored in environment variables. You can view, create, delete, and modify environment variables using U-Boot commands.

All changes you make to the environment will be discarded after reset, unless the
command is used to save the changes.
  • To see all the environment variables and their values, run
  • To see the value of only one variable, run
printenv <variable_name>

When typing the variable name, you can press Tab to auto complete the variable name, or see a list of completion candidates if there's more than one possible completion.

  • To set a value to an environment variable, run
setenv <variable_name> '<new_value>'

The above command will create the environment variable if it does not exist.

  • To delete an environment variable, run
setenv <variable_name>

Working with storage

U-Boot supports various types of storage, including USB, MMC, SATA, and NAND. With the exception of NAND, all storage types should be detected manually before they can be used. NAND storage is detected automatically by U-Boot.

  • The following command detects the SATA storage
sata init
  • The following command scans for an MMC/SD card
mmc rescan
  • The following command detects all USB devices connected to the system
usb start

Once the storage has been detected, it is possible to read/write into the storage, as well as get information on the storage device. The ls and load commands can be used to display and load the contents of storage devices regardless of the device type and the filesystem on it. To use the ls and load commands, first determine the number of the storage device:

  • On NAND, the device number is always 0
  • On SATA, the device number is always 0
  • On MMC, the device number is always 2
  • On USB, the device number can be between 0 and 4. To find the number of the USB storage you want to use, run
    usb storage

Once you've determined the interface and device number for the storage, you are ready to use the ls and load commands. For example:

  • To display the contents of the first USB storage device run
ls usb 0
  • To load a file from the first USB storage to the memory address 0x10800000, run
load usb 0 10800000 <filename>


To setup networking, run


The above command will contact the local DHCP server and obtain network parameters such as IP address, netmask, TFTP server IP, and more. All of the network parameters can also be setup manually by editing the appropriate environment variables. See Working with environment variables for instructions on how to modify U-Boot environment variables.

List of networking environment variables:

  • gatewayip
  • ipaddr: the IP address assigned to the module
  • netmask
  • serverip: the default IP for the TFTP and NFS servers when using the 'tftp' or 'nfs' command

After the network is setup, you can use U-Boot network commands.

  • To ping an IP address, run
ping <IP address>
  • To load a file to memory using TFTP, run
tftp <memory address> <filename>
  • To load a file to memory using NFS, run
nfs <memory address> <filename>

Running scripts

U-Boot commands can be executed as precompiled scripts. To run a script, first load the script file into memory usinb one of the methods described in Networking or Working with storage. For example:

tftp 10800000 myscript.img

Then, to run the script, execute

source 10800000

Enabling HDMI console

  • The following commands enable HDMI console:
setenv panel HDMI
setenv stdout serial,vga
setenv stderr serial,vga

Enabling USB keyboard

  • Plug a USB keyboard into a USB port
  • Use the following command to make U-Boot detect it:
usb start
  • To tell U-Boot to accept console input from a USB keyboard, run the following commands:
setenv stdin serial,usbkbd
  • To make U-Boot detect the USB keyboard on boot, run the following commands:
setenv preboot "usb start"


The steps for booting linux are:

  • Setup the kernel arguments by modifying the bootargs environment variable. For example:
setenv bootargs 'console=ttymxc3,115200 root=/dev/sda2 rootfstype=ext4 rw rootwait'

See Working with environment variables for instructions on how to modify U-Boot environment variables.

  • Load the kernel from where it is stored. For example, for a kernel stored on SSD:
sata init
load sata 0 10800000 uImage-cm-fx6

See the Networking or Working with storage sections for details on loading files from network or other storage devices.

  • Execute the boot command
bootm 10800000

OS boot countdown

  • After booting, U-Boot begins a countdown before initiating OS boot. OS boot can be interrupted before countdown reaches 0 by pressing any key.
  • If the countdown time is set to 0 seconds, it is still possible to stop OS boot by holding Ctrl+C while U-Boot boots.
  • To change the countdown time, run the following commands:
setenv bootdelay <seconds>
Personal tools