world leader in high performance signal processing
Trace: » uimage

Bootable U-Boot Images

While U-Boot can boot a variety of file types (ldr files, elf files, binary files) and it includes support for its own special format - the U-Boot image format (or uImage).

The format stores information about the operating system type, the load address, the entry point, basic integrity verification (via CRC), compression types, and free description text. Some common bootable U-Boot images you will encounter are files typically named uImage or vmImage.

These images are operated on in directly addressable memory regions. So you can boot directly out of external memory or flash hooked up to the asynchronous memory banks. If the image is stored elsewhere (say serial or NAND flash), you'll have to boot indirectly.

For information on loading a bootable image into the board, please consult the loading files via TFTP or the loading files via the serial port documents. For information on writing an image into storage, please consult the appropriate page (see the U-Boot index).

Commands

iminfo

The iminfo command just displays information about the image stored at the specified memory address and verifies the checksum.

bfin> iminfo 0x1000000
## Checking Image at 01000000 ...
   Image Name:   Linux-2.6.24.4-ADI-2008R2-pre-sv
   Created:      2008-03-31  20:07:15 UTC
   Image Type:   Blackfin Linux Kernel Image (gzip compressed)
   Data Size:    5142286 Bytes =  4.9 MB
   Load Address: 00001000
   Entry Point:  00244000
   Verifying Checksum ... OK

bootm

If you wish to actually boot an image, you give the bootm command the address in memory where the image is stored.

bfin> bootm 0x1000000
## Booting image at 01000000 ...
   Image Name:   Linux-2.6.24.4-ADI-2008R2-pre-sv
   Created:      2008-03-31  20:07:15 UTC
   Image Type:   Blackfin Linux Kernel Image (gzip compressed)
   Data Size:    5142286 Bytes =  4.9 MB
   Load Address: 00001000
   Entry Point:  00244000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Starting Kernel at = 244000
Linux version 2.6.24.4-ADI-2008R2-pre-svn4516 (vapier@G5) (gcc version 4.1.2 (ADI svn)) #89 Mon Mar 31 16:07:02 EDT 2008

This does the following things:

  • Verifies crc32 checksum
  • decompresses the image at the specified address (in this case “0x1000000”) to its load address “0x1000”. Care must be taken that the decompressed image does not over-write the compressed image. To determine if this will be a problem - the size of the decompressed image (which is only known at compression time) should be added to the load address. If the compressed image is located anywhere overlapping the destination of the decompressed image, you will have problems.
  • copies the bootargs to the scratchpad memory (where the kernel looks for it).
  • Jumps to the image entry point (in this case “0x244000”).

Creation

Normally you do not need to create a boot image yourself as the uClinux-dist and Linux kernel will generate appropriate images for you. But in case you need to, the command to use is called mkimage. You can either find this with the toolchain (just add the corresponding bfin-… prefix), or you can find it in the U-Boot source directory in the tools folder.

The help for the mkimage utility:

Usage: mkimage -l image
          -l ==> list image header information
       mkimage [-x] -A arch -O os -T type -C comp -a addr -e ep -n name -d data_file[:data_file...] image
          -A ==> set architecture to 'arch'
          -O ==> set operating system to 'os'
          -T ==> set image type to 'type'
          -C ==> set compression type 'comp'
          -a ==> set load address to 'addr' (hex)
          -e ==> set entry point to 'ep' (hex)
          -n ==> set image name to 'name'
          -d ==> use image data from 'datafile'
          -x ==> set XIP (execute in place)

For example, if we want to create an image with a gzipped compressed kernel in it, we would just do:

$ gzip -9 vmlinux
$ mkimage \
	-A blackfin -O linux -T kernel \
	-C gzip \
	-n 'My Linux Image' \
	-a 0x1000 -e 0x1000 \
	-d vmlinux.gz vmImage
Here we create an image for the Blackfin Linux kernel that will load and boot at 0x1000. You'll obviously need to change these values for your own needs.