Login

Why register?

  • Download software and technical materials
  • Purchase products at our on-line shop
  • Receive design news to stay up-to-date with Emcraft's new solutions

 

 

Running U-Boot Print


Each SOLOX System-On-Module (SOM) comes pre-loaded with U-Boot. U-Boot runs as the primary firmware from the on-module Flash on each power-on / reset.

U-Boot is probably the most popular firmware monitor for Linux. It is developed and maintained by DENX Software Engineering (www.denx.de). If you need detailed information on any aspects of U-Boot operation, DENX publishes extensive U-Boot user documentation at their web site.

On the SOLOX SOM, U-Boot image is stored in the NAND Flash device. On a power-on / reset, U-Boot is reloaded to the SDRAM and runs from there.

As soon as the module is powered on or reset, the i.MX6 proceeds to boot the U-Boot firmware printing the following output to the serial console:

U-Boot 2015.04-imx6sx-2.3.0 (Jan 25 2017 - 17:25:40)

CPU: Freescale i.MX6SX rev1.2 at 792 MHz
CPU: Temperature 39 C
Reset cause: POR
Board: Emcraft SLX-SOM
I2C: ready
DRAM: 512 MiB
NAND: 1024 MiB
MMC: FSL_SDHC: 0
Display: LCD-TN43 (480x272)
Video: 480x272x24
gis input --- No input
In: serial
Out: serial
Err: serial
Net: FEC [PRIME]
Normal Boot
Hit any key to stop autoboot: 0
SLX-SOM U-Boot >

Note: Bad blocks are a normal thing for NAND Flash. The messages regarding bad blocks in the output above are a benign indication that U-Boot has correctly handled bad blocks found in the NAND Flash.

If you hit any key on the serial console before the number of seconds defined by the U-Boot bootdelay variable has elapsed, you will enter the U-Boot interactive command monitor. From the command monitor you can run U-Boot commands to examine memory, load an image from Ethernet, boot Linux from a loaded image or perform any other action supported by U-Boot.

U-Boot makes use of the so-called environment variables to define various aspects of the target functionality. On the SOLOX SOM, the U-Boot environment is stored in the on-module NAND Flash and is persistent across power or reset cycles. Parameters defined by the U-boot environment variables include: target IP address, target MAC address, location in RAM where a Linux bootable image will be loaded, and many others.

To manipulate the U-Boot environment the following commands are used:

  • printenv <var> - print the value of the variable var. Without arguments, prints all environment variables:
  • SLX-SOM U-Boot > printenv
    ...
    bootcmd=run reliableboot
    bootdelay=1
    baudrate=115200
    ...
    SLX-SOM U-Boot >

  • setenv <var> <val> - set the variable var to the value val:
  • SLX-SOM U-Boot > setenv image vlad/rootfs.uImage
    SLX-SOM U-Boot>

    Running setenv <var> will unset (undefine) a specified U-Boot variable.

  • saveenv - save the up-to-date U-Boot environment, possibly updated using setenv commands, into the Flash. Running saveenv makes sure that any updates you have made to the U-Boot environment are persistent across power cycles and resets.
  • SLX-SOM U-Boot >saveenv
    Saving Environment to NAND...
    Erasing NAND...
    Erasing at 0xa0000 -- 100% complete.
    Writing to NAND... done
    SLX-SOM U-Boot >

The autoboot sequence in U-Boot is controlled by the two environment variables called bootdelay and bootcmd.

The bootdelay variable defines a delay, in seconds, before running the autoboot command defined by bootcmd. During the bootdelay countdown, you can interrupt the autobooting by pressing any key. This will let you enter the U-Boot command line interface.

The bootcmd variable defines a command executed by U-Boot automatically after the bootdelay countdown is over. Typically, this would be run netboot to boot Linux from TFTP during development or run flashboot to boot Linux from the on-module Flash on deployed units.

In deployed configurations, where boot time to the service provided by your embedded device is critical, you will probably want to set bootdelay to 0:

SLX-SOM U-Boot > set bootdelay 0
SLX-SOM U-Boot > saveenv
SLX-SOM U-Boot >

This will make sure that on each power on / reset U-Boot immediately executes the command defined by bootcmd, typically booting Linux from the on-module Flash.

With bootdelay set to 0 the U-Boot countdown is disabled, so there is a question how you enter the U-Boot command monitor, should you need to enter it for some reason. To do so, push the Ctrl-C keys down and don't release them until you have hit the reset button on the baseboard. This will interrupt the U-Boot bootcmd sequence and let you enter the U-Boot command monitor:

U-Boot 2015.04-imx6sx-2.3.0 (Jan 25 2017 - 17:25:40)
...
Hit any key to stop autoboot:  0
SLX-SOM U-Boot > <INTERRUPT>

From the command monitor, you would be able to reset bootdelay to 3 or whatever value makes sense to you.