Difference between revisions of "U-Boot Overview"
(added categories) |
m (Added Where To Go Next) |
||
(13 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{todo|Complete;(12-31-13-11:30->MG+);(12.31.13:11:52->KY+);(03.06.14-15:25->BS-);(04.11.14-14:45->BS+)(11.18.2015-16:30->MD+)|Michael Welling|project=oe 4,oe 5,mw,mg,Complete,ky,bs}} | ||
+ | |||
+ | {{#seo:|title=U-Boot Overview|titlemode=append|keywords=U-Boot Bootloader,U-Boot Environment,bootargs,bootcmd,Boot Variables|description=This page provides an introduction to U-Boot and common commands.}} | ||
Das U-Boot is the bootloader used on the majority of EMAC's ARM-based systems. It is loaded by the processor boot-ROM or low-level bootstrap code and performs device initialization followed by loading and starting the OS. EMAC has made modifications to U-Boot to add additional features when necessary. While generally used to load Linux, EMAC also uses U-Boot to load Windows CE and other operating systems. This page provides an introduction to U-Boot and common commands. Complete U-Boot documentation can be found at http://www.denx.de/wiki/U-Boot/WebHome | Das U-Boot is the bootloader used on the majority of EMAC's ARM-based systems. It is loaded by the processor boot-ROM or low-level bootstrap code and performs device initialization followed by loading and starting the OS. EMAC has made modifications to U-Boot to add additional features when necessary. While generally used to load Linux, EMAC also uses U-Boot to load Windows CE and other operating systems. This page provides an introduction to U-Boot and common commands. Complete U-Boot documentation can be found at http://www.denx.de/wiki/U-Boot/WebHome | ||
Line 4: | Line 7: | ||
By default, U-Boot is set up to automatically boot the OS after a set timeout. The following steps will interrupt the boot process and access the U-Boot prompt. | By default, U-Boot is set up to automatically boot the OS after a set timeout. The following steps will interrupt the boot process and access the U-Boot prompt. | ||
<ol> | <ol> | ||
− | <li>Configure a serial connection with the target board using the settings specified for the hardware. Refer to the [[ | + | <li>Configure a serial connection with the target board using the settings specified for the hardware. Refer to the [[Serial Connections]] page or other documentation for more information.</li> |
<li>After a serial connection has been established, reboot the board.</li> | <li>After a serial connection has been established, reboot the board.</li> | ||
<li>When initial boot messages are printed to the serial terminal, press Enter in the serial terminal application. This should bring up the U-Boot prompt as seen below:</li> | <li>When initial boot messages are printed to the serial terminal, press Enter in the serial terminal application. This should bring up the U-Boot prompt as seen below:</li> | ||
Line 110: | Line 113: | ||
{{mbox | type = notice | text = Note that <code>saveenv</code> commits the entire environment to flash in its current state, not only the most recent change.}} | {{mbox | type = notice | text = Note that <code>saveenv</code> commits the entire environment to flash in its current state, not only the most recent change.}} | ||
− | [[Category:Bootloaders]] | + | === Important Variables === |
+ | Two of the U-Boot variables need special attention as they effect the Linux kernel boot process. These variables, <code>bootargs</code> and <code>bootcmd</code>, are described in detail in the section below. | ||
+ | |||
+ | ==== bootargs ==== | ||
+ | The <code>bootargs</code> variable contains parameters used by the Linux kernel during boot. It specifies the boot partition, serial console for boot messages, and other possible boot parameters. | ||
+ | |||
+ | For example, here is the bootargs string on the SoM-9G45: | ||
+ | bootargs=console=ttyS0,115200 mtdparts=atmel_nand:128M(root),-(aux) root=/dev/mtdblock0 rootfstype=jffs2 ro video=LG | ||
+ | |||
+ | Everything after the first equals sign is contained within the <code>bootargs</code> variable. The following explains each of the variables in the bootargs: | ||
+ | {| class="wikitable" | ||
+ | ! colspan="2"|Table 1: bootargs parameters | ||
+ | |- | ||
+ | ! Parameter !! Description | ||
+ | |- | ||
+ | | console || The UART device node and baud rate for the boot messages. | ||
+ | |- | ||
+ | | mtdparts || Enumerates flash partition. The name and size for each partition is specified. | ||
+ | |- | ||
+ | | root || Sets which MTD partition to mount as the root file system. | ||
+ | |- | ||
+ | | rootfstype || The file system formatting used on the root partition. | ||
+ | |- | ||
+ | | ro || Mounts the root partition read-only. | ||
+ | |- | ||
+ | | video || Sets the video mode for the display. | ||
+ | |} | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! colspan="2"|Table 2: video parameter values | ||
+ | |- | ||
+ | ! Value !! Description | ||
+ | |- | ||
+ | | LG || 4.3" LCD distributed with the SoM-200, SoM-210, and SoM-212 carriers. | ||
+ | |- | ||
+ | | PRIMEVIEW || 7" LCD distributed with the SoM-250ES (PPC-E7+) | ||
+ | |- | ||
+ | | AMPIRE || 10" LCD distributed with the SoM-250ES (PPC-E10) | ||
+ | |} | ||
+ | {{ imbox | type=notice | text=The video option is not available on all systems. The values listed are specific to the SoM-9G45 and SoM-9M10. }} | ||
+ | ==== bootcmd ==== | ||
+ | The <code>bootcmd</code> variable is a set of instructions used to relocate and boot the Linux kernel. This command will vary from machine to machine based on Flash and RAM types. | ||
+ | |||
+ | {{:Templateimpl:moreinfo | initials=MD | title=System Logging | desc=The page describes how to system log. | project=OE 5.0 }} | ||
+ | * [[Loading_Images_with_U-Boot | Loading Images with U-Boot]] | ||
+ | * [[Loading_Linux_Kernels_Onto_a_Board | Loading Linux Kernels Onto a Board]] | ||
+ | * [[Loading_JFFS2_Images_Onto_a_Board | Loading JFFS2 Images Onto a Board]] | ||
+ | * [[Archiving_JFFS2_Images | Archiving JFFS2 Images]] | ||
+ | * [[Loading_Images_onto_eMMC_Devices | Loading Images onto eMMC Devices]] | ||
+ | |||
+ | |||
+ | <!--[[Category:Bootloaders]]--> |
Latest revision as of 16:30, 18 November 2015
Das U-Boot is the bootloader used on the majority of EMAC's ARM-based systems. It is loaded by the processor boot-ROM or low-level bootstrap code and performs device initialization followed by loading and starting the OS. EMAC has made modifications to U-Boot to add additional features when necessary. While generally used to load Linux, EMAC also uses U-Boot to load Windows CE and other operating systems. This page provides an introduction to U-Boot and common commands. Complete U-Boot documentation can be found at http://www.denx.de/wiki/U-Boot/WebHome
Contents
Accessing the U-Boot Console
By default, U-Boot is set up to automatically boot the OS after a set timeout. The following steps will interrupt the boot process and access the U-Boot prompt.
- Configure a serial connection with the target board using the settings specified for the hardware. Refer to the Serial Connections page or other documentation for more information.
- After a serial connection has been established, reboot the board.
- When initial boot messages are printed to the serial terminal, press Enter in the serial terminal application. This should bring up the U-Boot prompt as seen below:
- U-Boot commands may be entered at this prompt. To see all available commands, type
help
. Individual command help can be accessed by passing the command name as an argument to thehelp
command. Available commands may differ between systems depending on applicable features.
U-Boot 2009.06-rc1-svn1357 (Jul 08 2010 - 13:31:57) EMAC Inc. SOM-9M10/G45M DRAM: 128 MB NAND: 256 MiB DataFlash:AT45DB321 Nb pages: 8192 Page Size: 528 Size= 4325376 bytes Logical address: 0xC0000000 Area 0: C0000000 to C00041FF (RO) Bootstrap Area 1: C0004200 to C00083FF Environment Area 2: C0008400 to C0041FFF (RO) U-Boot Area 3: C0042000 to C0251FFF Kernel Area 4: C0252000 to C041FFFF FS In: serial Out: serial Err: serial Net: macb0 macb0: Starting autonegotiation... macb0: Autonegotiation complete macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) Hit any key to stop autoboot: 0 U-Boot>
The U-Boot Environment
The U-Boot environment is stored in a pre-determined area of non-volatile storage. This is generally the same device that stores the U-Boot image and Linux Kernel. On systems that use raw NAND flash as the primary storage device, there is generally a secondary storage device used for low-level boot images such as U-Boot, the U-Boot environment, and the Linux kernel due to the complexities of bad-block handling with NAND flash. Devices using NOR flash typically use a portion of the NOR flash to store the bootloader and kernel. The flinfo
command can provide an idea of the storage layout on the device, see below for an example:
U-Boot> flinfo DataFlash:AT45DB321 Nb pages: 8192 Page Size: 528 Size= 4325376 bytes Logical address: 0xC0000000 Area 0: C0000000 to C00041FF (RO) Bootstrap Area 1: C0004200 to C00083FF Environment Area 2: C0008400 to C0041FFF (RO) U-Boot Area 3: C0042000 to C0251FFF Kernel Area 4: C0252000 to C041FFFF FS
Standard Environment Variables
U-Boot uses a set of environmental variables to control the operation of the system. There are standard variables that are used for specific purposes by the system. The user can also add and combine variables to customize the system operation. The printenv
command is used to view the current environment, as shown below:
U-Boot> printenv baudrate=115200 stdin=serial stdout=serial stderr=serial ethact=macb0 ethaddr=00:50:C2:C9:2B:D6 bootdelay=1 bootargs=console=ttyS0,115200 root=/dev/mtdblock0 mtdparts=atmel_nand:128M(root),-(aux) ro rootfstype=jffs2 bootcmd=cp.b 0xC0042000 0x70000000 0x210000; bootm 0x70000000 kernel_name=uImage-2.6.30 rootfs_name=rootfs.jffs2 filesize=130B194 fileaddr=70000000 ipaddr=10.0.2.24 serverip=10.0.2.60 Environment size: 771/16892 bytes
Table 1 below defines many of the standard variables shown above.
Variable Name | Purpose |
---|---|
buadrate |
Serial console baud rate |
stdin |
The device to use for the console standard input |
stdout |
The device to use for the console standard output |
stderr |
The device to use for the console standard error outout |
ethact |
Defines the Ethernet device |
bootdelay |
The number of seconds to wait after loading before running the command stored in bootcmd
|
bootargs |
Kernel command line passed to Linux on boot |
bootcmd |
Commands to run to boot the system. This is generally used to load and boot the OS. |
filesize |
Automatically set to the size of the last file loaded on the system |
fileaddr |
Automatically set to the logical address used for the last file loaded to the system |
ipaddr |
The static IP address to use for network communications |
serverip |
The IP address of the TFTP server on the local network to use for file transfer |
Accessing Variables
To access the value of a variable, use the variable name enclosed in ${}
. For example, printenv ${bootcmd}
will print the current value of the bootcmd
variable.
Setting Variables
The setenv
command is used to set the value of a new or existing variable. For example, the following command will set the ipaddr
variable to a value of 192.168.2.1:
U-Boot> setenv ipaddr 192.168.2.1
When U-Boot loads, it loads the current environment from flash into RAM. Using setenv
only changes the volatile copy of the environment but does not commit the change to flash. If a change needs to be committed to non-volatile memory, the saveenv
command must be used to save the current environment. This will allow changes to be preserved for the next time that U-Boot is loaded.
Note that saveenv commits the entire environment to flash in its current state, not only the most recent change. |
Important Variables
Two of the U-Boot variables need special attention as they effect the Linux kernel boot process. These variables, bootargs
and bootcmd
, are described in detail in the section below.
bootargs
The bootargs
variable contains parameters used by the Linux kernel during boot. It specifies the boot partition, serial console for boot messages, and other possible boot parameters.
For example, here is the bootargs string on the SoM-9G45:
bootargs=console=ttyS0,115200 mtdparts=atmel_nand:128M(root),-(aux) root=/dev/mtdblock0 rootfstype=jffs2 ro video=LG
Everything after the first equals sign is contained within the bootargs
variable. The following explains each of the variables in the bootargs:
Table 1: bootargs parameters | |
---|---|
Parameter | Description |
console | The UART device node and baud rate for the boot messages. |
mtdparts | Enumerates flash partition. The name and size for each partition is specified. |
root | Sets which MTD partition to mount as the root file system. |
rootfstype | The file system formatting used on the root partition. |
ro | Mounts the root partition read-only. |
video | Sets the video mode for the display. |
Table 2: video parameter values | |
---|---|
Value | Description |
LG | 4.3" LCD distributed with the SoM-200, SoM-210, and SoM-212 carriers. |
PRIMEVIEW | 7" LCD distributed with the SoM-250ES (PPC-E7+) |
AMPIRE | 10" LCD distributed with the SoM-250ES (PPC-E10) |
The video option is not available on all systems. The values listed are specific to the SoM-9G45 and SoM-9M10. |
bootcmd
The bootcmd
variable is a set of instructions used to relocate and boot the Linux kernel. This command will vary from machine to machine based on Flash and RAM types.
Further Information
Where to Go Next
- Loading Images with U-Boot
- Loading Linux Kernels Onto a Board
- Loading JFFS2 Images Onto a Board
- Archiving JFFS2 Images
- Loading Images onto eMMC Devices