U Boot Manual
U Boot Manual
c 2005 ADS
1. Overview
This document is the bootloader user manual for ADS single board computers that run the U-boot bootloader.
These boards use U-boot to boot and run the Linux operating system. If your ADS board does not run Uboot, please see the manual for your supported bootloader (either the XScale/PXA or SA1110 bootloader).
U-boot is an open-source, multi-platform bootloader, with ports for many dierent embedded platforms. Uboot supports interactive commands, environment variables, command scripting, and booting from external
media (PCMCIA/CF, MMC). You can nd more information about U-boot and download its source code
from U-boot's Sourceforge home page at http://u-boot.sourceforge.net/
This is not an exhaustive manual for U-boot. If you are looking for a detailed reference manual or command
index, you should consult the main U-boot manual 1 at http://www.denx.de/twiki/bin/view/DULG/Manual.
To get started, you will need a serial terminal program to view the output of U-boot. By default, U-boot
sends it's output the the \debug" port on your board. The manual for your board should indicate which
serial port is the debug port. Windows usually comes with a serial terminal program called \HyperTerminal";
many Linux distributions ship with either the minicom or the kermit serial terminal program installed. ADS
U-boot uses a baud rate of 38400, 8 data bits and no stop bits.
Most CF/MMC cards come formatted with supported FAT lesystems, so if you have a new
card, try it before you re-format it. The FAT requirement is only for U-boot; there are many
formats that work ne once Linux is running.
at a specic PowerPC board, but the majority of the document also applies to other boards
both a PCMCIA and a CF slot, only the PCMCIA slot (slot 0) can be used with U-boot
Page 1
The main script which U-boot loads and runs when booting from external media.
root cong.txt
This le controls the type and location of the kernel and root lesystem. Examples of root lesystems
include ext2 ramdisks loaded from external media, JFFS2 lesystems programmed into on-board
ash
and ext3 lesystems stored on a Microdrive or USB hard drive.
This le also controls whether a kernel and root lesystem will be booted directly from external media
or programmed into on-board
ash.
hw cong.txt
Congures machine-specic hardware registers (e.g., for framebuer bit depth).
This le is optional and is only required if you need to change the default register settings.
tty cong.txt
your board is equipped with both a PCMCIA and a CF slot, only the PCMCIA slot (slot 0) can be used with U-boot
Page 2
4. Insert your card into the board and apply power to boot your system.
Note:
It is not necessary to program a zImage and ramdisk.gz to
ash before booting it. This type
of root lesystem can be booted directly from a CF or MMC card.
Since a USB hard drive requires no initial ramdisk (initrd) to be used as a root lesystem, only the kernel
(zImage) is listed in images to
ash.
Note:
If your USB hard disk takes a longer time to become ready for Linux to use it, it may be
necessary to increase the 'rootdelay' parameter to give your hard drive more time to settle
before Linux mounts it.
Note:
In this example, since the mtd args have not been set in the root cong.txt, the default MTD
partitioning will be used.
Page 3
ADS provides a Microdrive installer script with the full ADS Debian distribution tarball that
will properly partition and format a Microdrive. If you use this script, you will only need to
copy the U-boot scripts onto the rst partition.
Place the le initrd.gz, along with the zImage and the U-boot scripts, on the rst (FAT) partition of your
Microdrive.
Place the following in your root cong.txt:
images to dram='zImage initrd.gz'
setenv root args root=/dev/hda3 initrd=$fINITRDg,3m ramdisk size=6500
setenv boot linux 'bootm zImage buffer'
Note:
When using an EXT2 initrd with a 2.6 kernel, do not include a \rootfstype=" parameter, as
it will confuse the kernel if the initrd and the root lesystem types are dierent.
When setting up an NFS server for any diskless system (such as this), you must export the
lesystem with the 'no root squash' option. Since this option is a potential security risk to the
NFS server, you should take appropriate security precautions on your network.
4 Flash
memory cells have a limited number of write/erase cycles and are not suitable for use as swap space
Page 4
3.5 Booting a kernel from external media using
ash as the root
lesystem
You can use an existing
ash lesystem (a JFFS2, CRAMFS, etc. that you have already programmed into
on-board
ash) as your root even when loading the kernel from external media. This is especially useful for
testing a new kernel as you do not need to reprogram your
ash.
To boot your board in this fashion, use the same root cong.txt that you used when programming the
ash
lesystem, 5 but replace the images to
ash line with the line:
images to dram='zImage'
It is not necessary to have the
ash lesystem image on the external media. Only the kernel and the U-boot
les are needed.
After programming your
ash, you should immediately remove the external media and delete
or rename the start.txt le so you don't accidentally reprogram your system later on.
section 4
Page 5
4. Insert your card into the board and apply power to boot your system.
Note:
The nal partition,
ashfs1, is not programmed with any image in this example. You can use
this partition from within Linux, however, by erasing it and mounting it as js2, as in this
example:
eraseall /dev/mtd4
mount -t jffs2 /dev/mtdblock4 /mnt/flash
The mount command or the rst write to the lesystem may take a few minutes to complete as the lesystem
is created/checked.
4. Insert your card into the board and apply power to boot your system.
Page 6
4. Insert your card into the board and apply power to boot your system.
and U-boot will fall back to it's compiled-in default environment. To prevent this message from occurring
again, type saveenv to save the environment into
ash.
at the U-boot prompt and resetting your board. When U-boot restarts, you will see the above error message
and U-boot will use it's compiled-in defaults. Again, you should save these defaults to on-board
ash by
typing:
saveenv
Page 7
Restoring the default environment will destroy any changes made to the environment variables,
including conguration information needed to boot lesystems installed in on-board
ash. You
should capture the output of the printenv command to back-up your environment if you
make changes.
6.1 start.txt
On boot, ADS U-boot looks for the le start.txt 8 on external media (CF or MMC, if present on your board)
and, if found, loads and executes it. Start.txt instructs U-boot to look for several other les which you can
modify to control how your ADS board boots Linux (root lesystems, hardware registers, etc.) Section 6.5
describes U-boot's behavior without the start.txt le.
Below is a list of the les start.txt uses to boot your system. In most circumstances, changes to these les
should be all that is necessary to make your board boot the way you want it to. You should not need to
make any changes to start.txt for typical operation.
Page 8
images to
ash Space-separated list of les to be programmed into on-board
ash. The le names should
correspond to MTD partition names in the mtd args section.
images to flash='zImage flashfs1'
mtd args Part of the kernel command line where MTD partitions are dened.
setenv mtd args mtdparts=flash0:$fFLBLOCKSZg(boot),$fFLBLOCKSZg(bootvars),2048k(zImage),-(flashfs1)
boot linux This is the command U-boot should run to nish booting linux. In most cases, this command
should copy the kernel into RAM and run it.
If you have already copied a kernel into the zImage buer (e.g., from external media), then 'boot linux'
only needs to run the loaded kernel:
setenv boot linux 'bootm zImage buffer'
Note:
When a kernel and root lesystem are programmed to on-board
ash using the 'images to
ash'
method, the environment variables are automatically saved to on-board
ash, as well.
tty args Part of the kernel command line where the console and serial ttys are congured
setenv tty args console=ttyS0,38400 SERIALGETTY=ttyS0 SERIALBAUD=38400
The 'console' parameter determines where the Linux kernel messages will be sent. The SERIALGETTY
and SERIALBAUD parameters are variables used by the init process to congure the serial login
terminals once Linux is running.
You can also specify a normal keyboard/LCD tty as the console by setting
console=tty1,38400
Note:
Some hardware will require a dierent tty name (ttyAM0, ttyS1) to function properly.
Page 9
The kernels for ADS Linux systems contain compiled-in default hardware settings that will be
used if hw cong.txt is not present when booting. These settings usually specify a 640x480
8-bit display for a LQ64D343 LCD display.
You will need to re-program your kernel and root lesystem or change the environment variables to point to
a proper root lesystem in order to boot Linux properly.
your bootvars partition is erased, the compiled-in defaults will be used for the environment.
Page 10
Using this format for hw cong.txt allows you to easily split up the le into multiple lines and keep the le
easy to read.
The u-boot.bin le MUST contain a valid version of U-boot for your ADS board. If
u-boot.bin is not a valid bootloader or contains bugs, using it can render your board
inoperable. If you have downloaded an updated u-boot.bin from the ADS support web
site, double-check to be sure you have downloaded the proper le for your model board.
Also, you should use md5 to verify that the le downloaded correctly.
2. Insert the card into your board, connect a serial terminal and boot your system.
3. After applying power (but before the three-second timer expires), press the Enter key to receive the
U-boot command prompt.
4. If you are using a CF card (either in a CF slot or a PCMCIA slot), type the command:
run p reprogram uboot
Page 11
Do not remove power from your board while U-boot is being programmed. Power loss
during a bootloader update may render your board unbootable. If this happens you may
have to return the board to ADS for reprogramming.
5. Once programming has completed, you will see the following message:
Copy to Flash... done
This will prevent you from getting a U-boot prompt. It will be necessary to erase U-boot's
environment from within Linux to get a U-boot prompt.
To prevent U-boot from reading external media at startup, you should change the 'start' environment variable
to boot your system only from on-board
ash. The 'start' variable stores the commands U-boot runs during
automatic boot. To set a minimal automatic boot command, type the following at the U-boot command
prompt:
setenv start 'test -n $fhw configg && run hw config; test -n $fboot linuxg && run boot linux'
This start command would only read the 'hw cong' and 'boot linux' commands from the saved environment
and not from external media. These commands would also need to be stored in the environment.
Note:
You must run the saveenv command to save your environment changes to
ash or they will be
lost when you reboot.
Page 12
When the silent variable is set, U-boot will set the Linux console to null (empty, console=) on the command
line automatically. If you wish to silence the serial gettys, as well, you should disable (comment out) the
serial login gettys in the le /etc/inittab.
To set the MAC address, provide the address as an argument to the macaddr command, as in the following
example:
Page 13
The MAC address can be entered with or without the colons between the bytes. No other type of separator
is allowed.
Note:
You board should come from the factory pre-programmed with a valid, unique MAC address.
You should not change your board's MAC address unless you have a valid reason for doing so.
You can also use this technique from within another text le script to call one script from another.
Note:
If les with the same name exist on both a CF and MMC card, the CF card will take precedence.
(Use printenv to observe the 'execute txt le' variable)
Location
-------0x00000000
0x00040000
0x00080000
0x00200000
0xa0000800
0xa0008000
0xa0600000
Size
---0x00040000
0x00040000
0x00180000
0x01e00000
0x00007800
0x00180000
0x01000000
Type
---Flash
Flash
Flash
Flash
DRAM
DRAM
DRAM
Source
-----bootargs
bootargs
bootargs
bootargs
Initial
Initial
Initial
Guard
----Off
Off
Off
Off
Off
Off
Off
These regions are used by many of the ADS-supplied scripts and default commands. The regions of type
\Flash" correspond to MTD partitions in on-board
ash, and are named according to the partition names.
The regions of the \DRAM" are sections in memory and are used to hold scripts, kernel images, ramdisks
and
ash images that are loaded by U-boot.
Page 14
U-boot interprets most numerical values as hexadecimal values even if a leading '0x' is not
supplied. A notable exception to this rule is the 'baudrate' value, which is interpreted as
decimal.
Page 15