How to Compile and build U-Boot

Compiling U-Boot

To configure and build U-Boot for a target board “cd” to, or copy the source tree to somewhere local and then type:

host% make distclean
host% make <config>
host% make

Where <config> is one of the configuration names given. ( check include/configs )

Note: If building for a 32-bit environment (SE=1) then the config will have a “se” suffix after the board name, otherwise, for 29-bit mode (SE=0) it will not.

This will create the following set of files:

  • u-boot – Elf executable file (for download with GDB)
  • u-boot.bin – binary file (for burning into Flash)
  • u-boot.map – Linker memory map file

For example, to build a 29-bit U-Boot for a STx7111 on a MB618 board, then run the following commands:

host% make distclean
host% make mb618_config
host% make

To build a 32-bit U-Boot for a STx7105 on a MB680 board, then run the following commands:

host% make distclean
host% make mb680se_config
host% make

U-Boot commands
The list of U-boot commands can be accessed while in the U-Boot prompt.
Type "help" or "?" for a complete listing of available commands.
 
Documentation on U-Boot may be found at http://www.denx.de/wiki/DULG/Manual .

Running Linux using U-Boot
Preparing the Linux images for U-Boot

Specific details on building the kernel for MicroBlaze are contained in 
the Build Kernel page.Instructions to obtain a root filesystem can be found
at the Build and Modify a Root File System page.
 
The kernel and the root filesystem must be wrapped with a U-Boot header 
in order for U-Boot to accept these files. The mkimage utility is used 
for this purpose, however, it is not part of the MicroBlaze GNU tools.
It is part of U-Boot itself and if U-Boot has been compiled as specified on
 this page, it will be found under <u-boot-src>/build/tools/ .
 
When building linux.bin, as explained in the Build Kernel page, the kernel
 build process automatically creates an additional image, with the ".ub" 
suffix. linux.bin.ub is the Linux binary image wrapped with a U-Boot header.
The Linux compilation process will automatically invoke mkimage, therefore,
it is important to include the path to the U-Boot tools in the PATH environment 
variable.
 
The root filesystem also needs to be wrapped with a U-Boot header as follows:
mkimage -A microblaze -O linux -T ramdisk -C gzip -d ramdisk.image.gz uramdisk.image.gz
Booting Linux
Once the kernel, root filesystem, and device tree images are present in memory,
the command to boot Linux is:
U-Boot> bootm <addr of kernel> <addr of rootfs> <addr of device tree blob (dtb)>
Note: Make sure the kernel and root filesystem images are wrapped by with the U-Boot 
header. The device tree blob does not need to be wrapped with the U-Boot header.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s