U-Boot: Images

From Compulab Mediawiki
Jump to: navigation, search

Image format

U-Boot uses special format for bootable images. The format is based on binary or text files which can be basically anything, preceded by a special header. the header defines the following image properties:

  • Target Operating System
  • Target CPU Architecture
  • Compression Type (uncompressed, gzip, bzip2)
  • Load Address
  • Entry Point
  • Image Name
  • Image Timestamp

The header is marked by a special Magic Number, and both the header and the data portions of the image are secured against corruption by CRC32 checksums.

Image types

Standalone Programs

"Standalone Programs" are directly runnable in the environment provided by U-Boot; it is expected that (if they behave well) you can continue to work in U-Boot after return from the Standalone Program.

OS Kernel Images

"OS Kernel Images" are usually images of some Embedded OS which will take over control completely. Usually these programs will install their own set of exception handlers, device drivers, set up the MMU, etc. - this means, that you cannot expect to re-enter U-Boot except by resetting the CPU.

Admolition note.png OS kernel Image should be used only with operating system supported by U-Boot. Otherwise the operating system (or its second stage bootloader) should be run as standalone program

RAMDisk Images

"RAMDisk Images" are more or less just data blocks, and their parameters (address, size) are passed to an OS kernel that is being started.

Multi-File Images

"Multi-File Images" contain several images, typically an OS (Linux) kernel image and one or more data images like RAMDisks. This construct is useful for instance when you want to boot over the network using BOOTP etc., where the boot server provides just a single image file, but you want to get for instance an OS kernel and a RAMDisk image.

Firmware Images

"Firmware Images" are binary images containing firmware (like U-Boot or FPGA images) which usually will be programmed to flash memory.

Script files

"Script files" are command sequences that will be executed by U-Boot's command interpreter; this feature is especially useful when you configure U-Boot to use a real shell (hush) as command interpreter.

Creating U-Boot images

U-Boot images should be created with mkimage utility that shipped as a part of supplementary tool with U-Boot sources. You can download the binaries of the mkimage utility here (mkimage.tar.gz). The archive contains both Windows and Linux executables.

Creating U-Boot script images

U-Boot image containing script can be created using the following command:

mkimage -A arm -T script -d <script.scr> <script.img>

Creating OS-kernel images

U-Boot image containing OS kernel can be created using the following command:

mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux kernel" -d arch/arm/boot/zImage uImage
Admolition note.png Linux kernel build system can create U-Boot images with make uImage command