Building U-Boot

Note: this stub is to help with the LEON3 Qemu tutorial. The following instructions built the image and were run on a Debian Sqeeze host.= Building U-Boot (mkimage) from Source =

Download the latest release of the universal boot loader from the ftp or, you can check out the developer branch using git.

$ git clone git:// $ cd u-boot

Some hardware vendors provide their own patches for building u-boot, which are sometimes necessary to apply to build the mkimage...

Locate the board to build. For example, if you wanted to build u-boot for the leon3...

u-boot$ grep -R "leon3"

Set the toolchain

$ export CROSS_COMPILE=/opt/rtems-4.11/bin/sparc-rtems4.11-

TODO: looks like the CONFIG_SYS_TEXT_BASE might also have to be set... Where the prefix is the location of the RTEMS toolchain for your machine.

Build the package with the following commands:

u-boot$ make grsim_config u-boot$ make

Making a U-boot Image

TODO: want image to provide functionality similar to the grub script below... # have the following commands: ls pc multiboot gpt fat boot reboot configfile cat help # have access to at least ??? kB of memory # use qemu's vfat for access # read rtems-boot.cfg for the boot menu (if easy to do) # make sure networking has been addressed in u-boot image script

Below was a cut-and-paste from the grub tutorial, need to modify for u-boot. To make the floppy image follow the instructions in the Building Grub. This script is adapted from the instructions:

#! /bin/sh -x grub=/tmp/g2/build workspace=/tmp/g2 mnt=$workspace/mnt/loop file=$workspace/rtems-boot.img export PATH=$grub/bin:$grub/sbin:$PATH mkdir -p $workspace cd $workspace grub-mkimage -o core.img _chain ls pc multiboot gpt fat boot reboot configfile cat help dd if=/dev/zero of=$file bs=512 count=2880 /sbin/mkdosfs $file mkdir -p $mnt mount -o loop -t vfat $file $mnt mkdir -p $mnt/boot/grub cp $grub/lib/grub/i386-pc/boot.img core.img $grub/lib/grub/i386-pc/*.mod $mnt/boot/grub echo "configfile (hd0,0)/rtems-grub.cfg" > $mnt/boot/grub/grub.cfg echo '(fd0)' $file > grub-setup -d $mnt/boot/grub -r '(fd0)' -m '(fd0)' rm -f umount $mnt


# #

Last modified on Feb 23, 2013 at 10:42:51 AM Last modified on Feb 23, 2013, 10:42:51 AM