Eurotech U Boot PDF
Eurotech U Boot PDF
90000852_K
Digi International Inc. 2011. All Rights Reserved.
The Digi logo is a registered trademark of Digi International, Inc.
All other trademarks mentioned in this document are the property of their respective owners.
Information in this document is subject to change without notice and does not represent a commitment on the part of Digi International.
Digi provides this document as is, without warranty of any kind, either expressed or implied, including, but not limited to, the implied
warranties of fitness or merchantability for a particular purpose. Digi may make improvements and/or changes in this manual or in the
product(s) and/or the program(s) described in this manual at any time.
This product could include technical inaccuracies or typographical errors. Changes are periodically made to the information herein;
these changes may be incorporated in new editions of the publication.
2
Contents
6. Bootscript ..................................................................................... 19
6.1 Bootscript process ............................................................................................................... 19
6.2 Creating a bootscript ............................................................................................................ 19
6.2.1 Creating a bootscript in Windows ...................................................................................................... 20
6.3 Configuration for launching the bootscript ............................................................................ 20
6.4 Bootscript restrictions .......................................................................................................... 20
3
8.1 The 'flpart' command ........................................................................................................... 25
8.1.1 A partition table entry ......................................................................................................................... 25
8.1.2 Changing the partition table ............................................................................................................... 26
8.2 The intnvram command...................................................................................................... 26
8.2.1 Mappings of variables ........................................................................................................................ 28
4
1. Conventions used in this manual
This list shows the typographical conventions used in this guide:
Style Used for file and directory names, variables in commands, URLs
and new terms.
5
2. Acronyms and Abbreviations
BIOS Basic Input Output System
CPU Central Processing Unit
FAT File Allocation Table
I2C Inter-Integrated Circuit
MBR Master Boot Record
MII Media Independent Interface
NVRAM Non Volatile RAM
OS Operating System
PC Personal Computer
RAM Random Access Memory
TFTP Trivial File Transfer Protocol
USB Universal Serial Bus
6
3. Introduction
3.3.2 Monitor
U-Boot has a command shell (also called a monitor) in which you work with U-Boot commands to
create a customized boot process.
7
3.3.3 Variables
U-Boot uses environment variables that can be read or written to and from non-volatile media. Use
these variables to create scripts of commands (executed one after the other) and to configure the
boot process.
3.3.5 Numbers
Numbers used by U-Boot are always considered to be in hexadecimal format. For example, U-Boot
understands number 30100000 as 0x30100000.
DRAM: 64 MB
NAND: 128 MB
CPU: S3C2443@534MHz
Fclk = 534MHz, Hclk = 133MHz, Pclk = 66MHz
Autoscript from TFTP... [not available]
Hit any key to stop autoboot: 0
8
4. U-Boot commands
4.1 Overview
U-Boot has a set of built-in commands for booting the system, managing memory, and updating an
embedded systems firmware. By modifying U-Boot source code, you can create your own built-in
commands.
9
ls - list files in a directory (default /)
md - memory display
mm - memory modify (auto-incrementing)
mtest - simple RAM test
mw - memory write (fill)
nand - NAND sub-system
nboot - boot from NAND device
nfs - boot image via network using NFS protocol
nm - memory modify (constant address)
ping - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
printenv_dynamic- Prints all dynamic variables
rarpboot- boot image via network using RARP/TFTP protocol
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
sleep - delay execution for some time
sntp - synchronize RTC via network
tftpboot- boot image via network using TFTP protocol
update - Digi ConnectCore modules update commands
usb - USB sub-system
usbboot - boot from USB device
version - print monitor version
The available commands can vary according to the capabilities of your hardware platform.
For more information about a command, enter:
help command name
# help run
run var [...]
- run the commands in the environment variable(s) 'var'
As you enter the first letters of a command, U-Boot searches its list of built-in
commands until it finds a match. For example, if you enter save or sav or even
sa, U-Boot executes the saveenv command.
You need to enter enough letters for U-Boot to determine the command to
execute. For example, if you enter loa U-Boot cannot tell whether to execute
loadb, loads or loady, and you get an 'Unknown command' message.
10
nand bad Shows NAND bad blocks.
nand info Shows available NAND devices.
mii info <addr> Prints MII PHY info
version Displays U-Boot version and timestamp.
11
Netconsole is not supported, because of poor performance.
12
imls Prints information about all images found at sector
boundaries in flash.
icache [on|off] Turns instruction cache on or off.
md[.b, .w, .l] <address> [# of Displays the contents of the memory at address 'addr' for as
objects] many '[#of objects]' bytes, words, or long words.
mm[.b, .w, .l] <address> Lets you modify locations of memory, beginning at
address, which gets auto-incremented.
mw[.b, .w, .l] <address> <value > Writes 'value' into 'address' for as many 'count' bytes,
[count] words, or long words.
nm[.b, .w, .l] address Lets you modify a fixed location of memory.
nand[.jffs2] read <addr> <off> Copies the memory contents from flash address 'off' to
<size> RAM address 'addr' for as many 'size' bytes (only for NAND
flash memories). Bad block management is used, when
using .jffs2. The bad block management detects bad blocks
and skips them.
nand[.jffs2] write <addr> <off> Copies the memory contents from RAM address 'addr' to
<size> flash address 'off' for as many 'size' bytes (NAND flash
memories only). Bad block management is used, when
using .jffs2. The bad block management detects bad blocks
and skips them.
nand erase [off size] Erases 'size' bytes from address 'off'. Erases the entire
device if no parameters are specified (NAND flash
memories only).
U-Boot skips bad blocks and shows their addresses.
nand dump[.oob] off Dumps NAND page at address 'off' with optional out-of-
band data (only for NAND flash memories).
nand markbad <off> Marks block at 'off' as bad.
nand unmarkbad <off> Erases bad block at 'off'.
nboot address dev [off] Boots image from NAND device dev at offset off
(transferring it first to RAM address).
protect [on|off] ... Protects/unprotects NOR sector(s).
When writing your own boot macro, make sure data cache and
instruction cache are turned off right before booting the OS.
13
4.2.6 Serial port commands
Use these commands to work with the serial line:
Command Description
loadb [off] [baud] Loads binary file over serial line with offset 'off' and baud
rate 'baud' (Kermit mode)
loads [off] Loads S-Record file over the serial line with offset 'off'
loady [off] [baud] Loads binary file over the serial line with offset 'off' and
baud rate 'baud' (Ymodem mode)
14
5. Environment variables
5.1 Overview
U-Boot uses environment variables to tailor its operation. The environment variables configure
settings such as the baud rate of the serial connection, the seconds to wait before auto boot, the
default boot command, and so on.
These variables must be stored in either non-volatile memory (NVRAM) such as an EEPROM or a
protected flash partition.
The factory default variables and their values also are stored in the U-Boot binary image itself. In
this way, you can recover the variables and their values at any time with the envreset command.
Environment variables are stored as strings (case sensitive). Custom variables can be created as
long as there is enough space in the NVRAM.
To expand simple variables, enclose them in braces and prefix a dollar sign:
# setenv myNumber 123456
# setenv var This is my number: ${myNumber}
# printenv var
var=This is my number: 123456
Recursive variables (or scripts) contain one or more variables within their own value. The inner
variables are not expanded in the new variable. Instead, they are expanded when the recursive
variable is run as a command, as shown here:
# setenv dumpaddr md.b \${addr} \${bytes}
# printenv dumpaddr
dumpaddr=md.b ${addr} ${bytes}
# setenv addr 2C000
# setenv bytes 5
# run dumpaddr
0002c000: 00 00 00 00 00 .....
You must use the back slash '\' before '$' to prevent variables from being expanded into other
variables values.
5.3 Scripts
In U-Boot, a script is made up of variables that contain a set of commands; the commands are
executed one after another.
Consider this variable:
# printenv cmd1
setenv var val;printenv var;saveenv
If you were to run this script, with run cmd1 the var variable would be created with val value, the
value would be printed to the console, and the variables would be saved to either the EEPROM or
flash partition dedicated to variables.
# run cmd1
var=val
Saving Environment to Flash...
15
Un-Protected 1 sectors
Erasing Flash...
. done
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
Separate the commands in a script with semi-colons. (;). As with recursive variables, this sign must
be preceded by a back-slash sign or it is considered the termination of the first command itself.
This is how you would save cmd1:
For running commands stored in variables, use the run command and its variables separated by
spaces:
# setenv cmd1 setenv var val
# setenv cmd2 printenv var
# setenv cmd3 saveenv
# run cmd1 cmd2 cmd3
16
verify If set to 'n' or 'no,' disables the checksum calculation over the complete
image in the bootm command to trade speed for safety in the boot
process. Note that the header checksum is still verified.
ipaddr IP address of the target's Ethernet interface.
ipaddr_wlan IP address of the target's WLAN interface (for modules that have it).
netmask Subnet mask of Ethernet interface.
netmask_wlan Subnet mask of WLAN interface (for modules that have it).
gatewayip IP address used as network gateway.
serverip IP address of the host PC (for remote connections like TFTP transfers).
For more information, see the boot loader development chapter of your
development kit's documentation.
You can disable detection of user keys for customized hardware where these
keys don't exist. To do so, you need to reconfigure and recompile U-Boot. See
chapter 11 for information about U-Boot development.
17
5.4.4 Protected variables
Several variables are of great relevance for the system and are stored in a protected section of
NVRAM.
Some of these protected variables are, for example, the serial number of the module and the MAC
addresses of the network interfaces, which are programmed during production and normally should
not be changed.
18
6. Bootscript
The bootscript is an script that is automatically executed when the boot loader starts, and before
the OS auto boot process.
The bootscript allows the user to execute a set of predefined U-Boot commands automatically
before proceeding with normal OS boot. This is especially useful for production environments and
targets which dont have an available serial port for showing the U-Boot monitor.
The name of the output file must be in the form <platformname>-bootscript, where
<platformname> must be replaced with your targets platform name.
For example, to create the bootscript from the text file above and for a Connect ME 9210
platform, go to the U-Boot directory and execute:
$ tools/mkimage -T script -n Bootscript -C none -d myscript.txt
cme9210js-bootscript
19
6.2.1 Creating a bootscript in Windows
There are some important caveats when producing a bootscript in a Windows host PC.
$ dos2unix.exe myscript.txt
20
7. Boot commands
7.1 Overview
U-Boot runs code placed in RAM, although it can also read data from other media. The boot
process normally takes place in two steps:
Reading the OS image from media (Ethernet, flash, USB, MMC) into RAM
Jumping to the first instruction of the image in RAM
The TFTP transfer takes place between the serverip address (host) and the ipaddr address
(target). The host must be running a TFTP server and have bootfilename archive placed in the
TFTP-exposed directory.
For Linux kernel images, if the autostart variable is set to yes, this command directly boots the
kernel after downloading it.
This command reads file bootfilename from device dev, partition partition of the USB flash disk into
the RAM address loadAddress. Device and partition are given as a number (0, 1, 2...).
If no partition is specified, partition 1 is assumed.
21
To read an image from an MMC card formatted in FAT, enter:
# mmcinit
# fatload mmc <dev>[:partition] <loadAddress> <bootfilename>
This command reads file bootfilename from device dev, partition partition of the MMC card into the
RAM address loadAddress. Device and partition are given as a number (0, 1, 2...).
If no partition is specified, partition 1 is assumed.
This command copies count bytes, words, or long words (depending on the suffix used -: b, w, l -
from sourceAddress into loadAddress.
In targets with NAND flash memories, the special NAND commands must be used:
# go <loadAddress>
# bootm <loadAddress>
where loadAddress (in both cases) is the address in RAM at which the image resides.
Windows CE images must be compiled with the information
about the address in RAM from which they will be booted. For
example, if a WinCE kernel is compiled with a boot address of
0x2C0000, it can be transferred to a different address, but the
system can boot only from the compiled-in address.
22
7.4 Direct booting
To simplify the boot process, Digi's U-Boot version includes the dboot built-in command, which
reads the OS image from the media and runs it from RAM in a single step.
The syntax for the dboot command is:
where
os is either linux, wce or netos.
media is either flash, tftp, nfs, usb, mmc, or hsmmc.
dev[:partition] is the device index (only for USB, MMC, HSMMC media) starting at 0 and the
partition number (starting at 1) where the image to boot resides. If not provided, device 0 and
partition 1 are assumed
filesystem is either fat, ext2, or ext3 (only for USB, MMC, HSMMC media) and must match the
file system of the partition that holds the image to boot. If not provided, FAT is assumed.
bootfilename is the name of the kernel image file to download and boot. If not provided, the
filename is taken from kimg variable for Linux, or wimg for Windows CE
If booting from a network media (tftp, nfs) and the dhcp variable is set to yes or
on, the command first gets an IP address from a DHCP.
Boot default Linux image stored in an SD card with partition 3 formatted in ext3, plugged in the
USB host device 0:
Refer to your OS user manual for further instructions on booting your kernel
image.
23
In other words, automatic booting has the same effect as doing either of the next two examples:
# run bootcmd
# boot
If, for example, if you want to automatically boot a WinCE image from TFTP server, set bootcmd
like this:
Or, if you want to automatically boot a Linux image from flash, set bootcmd like this:
24
8. Using NVRAM
An embedded OS requires some persistent settings; for example, MAC address, IP address, Internet
gateway, flash partition table, and U-Boot environment variables. You change some of these only in
production and others only during custom setup.
These settings must be stored in non-volatile memory (NVRAM) so they are not lost when you power the
target off.
A partition called NVRAM on the flash memory is used to store these settings. The contents are protected
by a CRC32 checksum and they are also mirrored to a different location in the partition. This way, if
anything goes wrong reading these data or data becomes corrupted, the information can be restored from
the mirrored data.
25
FlashFX
Unknown
Flags Flags (non-exclusive):
read-only
mount read-only
rootfs
You add, modify, or delete partitions step-by-step; the command prompts you for the necessary
information.
Start and Size values can be given as hexadecimal numbers (prefixed with 0x)
or as decimal numbers followed with k (for KiB) or m (for MiB).
The partition table also can be reset to the default values. In this case, because the partition table
differs according to the targets OS, you select the OS you want.
Changes take effect only after quitting 'flpart' and saving the
changes.
When the size or start address of a partition has been changed,
it is always necessary to erase it and write a new image to it.
26
DO NOT USE THE intnvram COMMAND UNLESS YOU ARE
COMPLETELY SURE OF WHAT YOU ARE DOING. INCORRECT USE
CAN DESTROY SENSITIVE NVRAM DATA FOREVER AND MAKE
THE MODULE UNUSABLE
Changes made to NVRAM with the intnvram command are kept in RAM. U-Boot writes the
changes to NVRAM only when you execute the saveenv command or intnvram save command.
Here is the syntax of the intnvram command:
Usage: intnvram help|print <params>|printall|repair|reset|save|set <params>
Params trailed with '=' require a value in the set command. In the print
command, '=' mustn't be used.
Specify the group of the parameter before the parameter itself. For example, to print the module IP
for the wired Ethernet interface, execute:
# intnvram print network ip1
ip1=192.168.42.30
27
For printing different parameters of a block, the block must be used only once. For example, to print
the module's MAC address and serial number, execute:
# intnvram print module ethaddr1 serialnr
ethaddr1=00:40:9D:2E:92:D4
serialnr=0700-94000329A
To access a partition parameter, address the specific partition with the parameter select=n, where
n is the index to the partition. This example prints the names of partitions 1 and 2:
# intnvram print partition select=0 name select=1 name
name=U-Boot
name=NVRAM
28
9. Firmware update commands
9.1 Overview
The boot loader, kernel, and other data stored in flash form the firmware of the device. Because
U-Boot can write any part of flash, its flash commands can be used to reprogram (update) any part
of the firmware. This includes the boot loader itself.
The update process normally takes place in three steps:
Reading image from media (Ethernet, USB, MMC) into RAM memory
Erasing the flash that is to be updated
Copying the image from RAM into flash
The first command erases size bytes beginning at address. The second command copies count
bytes, words or long words (depending on the suffix used: b, w, l) from sourceAddress into
targetAddress.
For NAND flash memory:
# nand erase address size
# nand write sourceAddress targetAddress count
The first command erases size bytes beginning at address. The second command copies count
bytes from sourceAddress into targetAddress.
29
9.3 Direct updating
Digi's U-Boot version includes the built-in update command. This command copies the image from
the media to RAM, erases the flash size needed for the image, and moves the image from RAM
into flash in a single step, simplifying the update process.
Here is the syntax for update:
# help update
update partition [source [device:part filesystem] [file]]
- updates 'partition' via 'source'
values for 'partition': uboot, linux, rootfs, userfs, eboot, wce, wcez,
netos, netos_loader, splash, or any partition name
values for 'source': tftp, nfs, usb, mmc, hsmmc
'device:part': number of device and partition, for 'usb', 'mmc', 'hsmmc'
sources
values for 'filesystem': fat|vfat, ext2|ext3
values for 'file' : the file to be used for updating
source is the place to take the image from. If not provided, tftp is assumed.
dev[:partition] is the device index (only for USB, MMC, HSMMC media) starting at 0, and the
partition number (starting at 1) where the image to update resides. If not provided, device 0 and
partition 1 are assumed
filesystem is either fat, ext2, or ext3 (only for USB, MMC, HSMMC media). If not provided, FAT
is assumed.
file is the name of the image to download and update. If not provided, the filename is taken
from one of the following U-Boot environment variables (depending on the partition to be
updated):
o kimg: for the Linux kernel image
o wimg: for the Windows CE kernel image
o nimg: for the NET+OS kernel image
o uimg: for the boot loader image
o usrimg: for the user image
o rimg: for the Linux root file system image
o simg: for the Splash screen image
o fimg: for the FPGA image
o nloader: for the Windows CE kernel image
If updating from a network media (tftp, nfs) and the dhcp variable is set to yes
or on, the command first gets an IP address from a DHCP server.
For example, to update the Splash screen partition using a file called mylogo.bmp that resides on
the second partition (formatted in ext3) of an SD card which is plugged in the first MMC device
(index 0), the update command would be:
30
To update the boot loader from the TFTP exposed folder with the default name image stored in
variable uimg, the update command would be:
# update uboot
For updating partitions with files larger than the available RAM memory, see
your OS-specific update flash tool.
31
10. Customize U-Boot
10.1 Overview
U-Boot has a lot of functionalities, which can only be enabled before compiling U-Boot. To
configure U-Boot options and customize the boot loader, refer to your OS specific user manual.
Description of some available configurations follow:
Before you can start using JTAG-Console you have to configure your debugger for using the Direct
Communication Channel. Using a BDI200 you have to add the following line in section [TARGET]
to your BDI configuration file:
DCC 7
After that type:
$ telnet <bdi2000 ip-address> 7
Connected to bdi2000.
Escape character is '^]'.
Using a Segger jlink the version 3.87i or higher of jlink-software is required. Start the
jlinkcommander and type:
$ term
After starting your target you can switch output and input independently to JTAG console by typing
# setenv stdout jtag
# setenv stdin jtag
# setenv stderr jtag
# saveenv
After reboot the JTAG console is used by default, if you have stored the
environment.
32
10.3 Silent Console
The target does not display any output when the console is set to silent mode. Before using a boot
loader with silent console, you should first define a way to recover from it. Otherwise you will not be
able to disable it in the future.
The first possibility is using the key environments variables (see topic 5.4.3):
# setenv key1 setenv silent no\;saveenv
# saveenv
The second possibility to recover from silent mode is using a gpio. To use this functionality you
have to define the gpio number and the level of the gpio, which signals the console to leave the
silent mode. The number of the gpios can be found in the hardware reference.
You will need the JTAG interface to flash the firmware, when
the function to recover from silent mode is undefined.
After reboot you can recover from silent mode, by setting the gpio to the defined level short after
the target starts to boot or when the target end to boot. The second point is only reached, when
autoboot is not used or the execution fails.
# printenv_dynamic
If it exists and has some value, there should also be a partition for the splash screen image. Check
it with command flpart and option p to print the partition table. If there is no splash screen partition,
refer to chapter 8.1 to create one. If there is, you can go to chapter 10.4.3 to see how to upload a
splash image to the flash partition.
33
10.4.1 Enable splash screen support in U-Boot
Go to your OS configuration tool for U-Boot and enable the Display support and splash screen
support. You will need to select the displays you want to support (more than one can be
supported):
Display resolution
Sharp LQ057Q3DC12I 320x240
Sharp LQ064V3DG01 640x480
VGA monitor 640x480
EDT 8-inch QVGA 320x240
Sharp LQ070Y3DG3B1 800x480
Note that, depending on your platform, some displays might not be available.
Save the changes and recompile U-Boot. Then update the U-Boot image in your target.
34
4 | User-JFFS2 |20736 KiB | 10 MiB |Filesystem | JFFS2 |
5 | Splash | 31 MiB | 1 MiB |Splash-Screen | |
Cmd (? for help)>q
Partition table has been modified. Save? (y): y
Writing Parameters to NVRAM
Or, if the variable simg contains the BMP filename, you can simply execute:
# update splash
A splash image takes about 75 KiB for QVGA resolution and 300 KiB for VGA
resolution.
LQ057Q3DC12I
LQ064V3DG01
VGA
EDT28
35
LQ070Y3DG3B1
In order to change the selected display without recompiling U-Boot, each display
must have support enabled. See in topic 10.4.1.
The default location of the frame buffer is at the end of U-Boot in RAM. The location can be
changed by setting:
The default is also used if the passed address for the frame buffer is inside of a protected area (for
example if the address points to the U-Boot code).
36
11. U-Boot development
U-Boot is an open source project. Sources are freely distributed, and you can modify them to meet
your requirements for a boot loader.
The project sources are ready to be installed and compiled in a Linux environment. If you do not
have a Linux machine for development, you can install the Cygwin X-Tools software
(http://www.cygwin.com). The X-Tools provide a Unix-like development environment for Windows,
based on Cygwin and the GNU toolchain, to cross-compile the boot loader.
For information about installing the U-Boot sources, modifying platform-specific sources, and
recompiling the boot loader, see your development kit documentation. Procedures may vary
according to hardware platform and OS.
37
12. Troubleshooting
192.168.42.40 mytarget
38