Revision as of 13:47, 25 July 2015 by Craig Peacock (Talk | contribs)

Compiling U-Boot for the BeagleBone Black

Download the latest version of U-Boot, extract the files to a working folder and patch:

wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjf u-boot-latest.tar.bz2
cd u-boot-2015.07
wget https://rcn-ee.com/repos/git/u-boot-patches/v2015.07/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch
patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch

Now cross compile U-Boot using the am335x BeagleBone Black configuration:

make CROSS_COMPILE=arm-linux-gnueabi- distclean
make CROSS_COMPILE=arm-linux-gnueabi- am335x_boneblack_config
make CROSS_COMPILE=arm-linux-gnueabi-

Compiling should conclude with output similar to below showing that an image of MLO - the first stage uBoot Bootloader is generated.

  LD      spl/u-boot-spl
  OBJCOPY spl/u-boot-spl.bin
  MKIMAGE MLO
  CFG     spl/u-boot-spl.cfg

Scrolling up the output messages, you should find where the second stage U-Boot bootloader (u-boot.img) is generated.

  LDS     u-boot.lds
  LD      u-boot
  OBJCOPY u-boot.bin
  MKIMAGE u-boot.img
  OBJCOPY u-boot.srec
  CFG     u-boot.cfg

Testing the fully featured second stage U-Boot Bootloader

If desired, you can test the second stage bootloader by loading it to RAM:

setenv ipaddr 192.168.0.250
setenv serverip 192.168.0.251
tftp 0x80800000 u-boot.bin
go 0x80800000

Saving the Bootloader Images to Flash/Card

Copy the files to the start of the uSD Card (/dev/sdb) or MMC Flash (/dev/mmcblk0):

dd if=MLO of=/dev/sdb count=1 seek=1 conv=notrunc bs=128k
dd if=u-boot.img of=/dev/sdb count=2 seek=1 conv=notrunc bs=384k