BeagleBone Black Das uboot bootloader compilation

By | March 22, 2016

Introduction :

Das uboot is the most famous second/third stage bootloader  in a embedded Linux system. In this post, let’s compile the opensource Das uboot and boot BeagleBone black till uboot prompt. In the upcoming posts, we will explore more u-boot options, NFS boot, MMC boot, TFTP boot etc ..

BeagleBone Black uboot

BeagleBone Development Environment :

  • Hardware
    • BeagleBone black Rev c
    • USB to TTL converter (3v3)
    • Mini USB cable
    • Micro SD card – class 10
  • Software
    • Ubuntu 14.04

BeagleBone Required Ubuntu Tools :

We need to install common Ubuntu tools in the host computer such as minicom, git, ncurses.

  1. $ CTRL+ALT+T (Open new terminal)
  2. $ sudo apt-get install minicom git ncurses-dev 

Obtain uboot source : 

Lets fetch the latest u-boot source. This can be done by simply issuing the following command in the Linux terminal. This command will create a u-boot folder and downloads the source to that folder.

  • $ git clone git://git.denx.de/u-boot.git

Checkout desired tag, I have tested with v2016.01-rc4 tag.

  • git checkout v2016.01-rc4 -b v2016.01-rc4

Install cross compiler :

Use below command to install to cross compiler. This command installs Linaro gcc version 4.7.3 arm compiler.

  • $ sudo apt-get install gcc-arm-linux-gnueabi

Compile uboot for BeagleBone black :

Now you need to compile the u-boot source for BegalBone black board.

  1. Enter u-boot directory
    • $ cd u-boot
  2.  Setup cross compiler environment for the terminal.
    • $ export ARCH=arm
    • $ export CROSS_COMPILE=arm-linux-gnueabi-
  3. Configure u-boot for BeagleBone Black by applying am335x_boneblack_defconfig
    • $  make am335x_boneblack_defconfig
  4. Compile the u-boot source by issuing the ‘make’ command
    • $ make -j4

u-boot compilation takes several minutes. If compilation is successful then you will end up with below messages.

……………

MKIMAGE u-boot.img
LD spl/drivers/built-in.o
LD spl/u-boot-spl
OBJCOPY spl/u-boot-spl.bin
MKIMAGE MLO

Setting up memory card :

Compilation will generate two binaries.

  1. MLO – uboot spl/ Second stage bootloader
  2. u-image.img – Third stage bootloader

Format micro SD to FAT and copy MLO and u-image.img binaries to memory card.

Connect BeagleBone  UART to Computer and setup minicom: 

DEBUG UART pinouts of BeagleBone black can be found on J1 connector as shown in the below figure. Connect RxD and TxD of BeagleBone black to USB to TTL converter’s TxD and RxD pins.

BeagleBone balck UART pinouts

Connect “UART to TTL” converter to the Ubuntu computer. You will see a ttyUSBx under /dev/. Then follow below steps to setup the minicom.

Below command  will show the ttyUSBx entry of USB to TTL converter.

$dmesg | tail  

Setup minicom :

  1. sudo minicom -s
  2. select “Serial port setup”
  3. select “Serial Device” to /dev/ttyUSBx
  4. Change baud rate to 115200
  5. Change Hardware and Software Flow control to ‘No’
  6. Exit

minicom setup

 

Let’s Boot :

  1. Insert the Micro SD card to board. Content of SD card shall be u-boot.img and MLO.
  2. Hold S2 push button to boot from external micro SD card.
  3. Power on the board by connecting Mini USB cable.
  4. Then release S2 button

You will see similar messages in your serial terminal.

U-Boot SPL 2016.01-rc4-00002-g3861d78-dirty (Jan 16 2016 - 15:52:33)
Trying to boot from MMC
MMC: block number 0x100 exceeds max(0x0)
MMC: block number 0x200 exceeds max(0x0)
*** Error - No Valid Environment Area found
*** Warning - bad CRC, using default environment
reading u-boot.img
reading u-boot.img
U-Boot 2016.01-rc4-00002-g3861d78-dirty (Jan 16 2016 - 15:52:33 +0530)

Watchdog enabled
I2C: ready
DRAM: 512 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Net: cpsw, usb_ether
=>

Download pre compiled uboot binaries for BeagleBone black :

You can download pre compiled uboot binaries from the below link.

u-boot and MLO for BeagleBone Black

 

3 thoughts on “BeagleBone Black Das uboot bootloader compilation

  1. Swapnil

    Is there is no need to uEnv.txt for booting. And dtb in linux for booting .

    Reply
  2. kirti kumbhar

    I have error while make
    CHK include/config/uboot.release
    CHK include/generated/timestamp_autogenerated.h
    UPD include/generated/timestamp_autogenerated.h
    CHK include/generated/version_autogenerated.h
    CHK include/generated/generic-asm-offsets.h
    CHK include/generated/asm-offsets.h
    HOSTCC tools/mkenvimage.o
    HOSTCC tools/fit_image.o
    HOSTCC tools/image-host.o
    HOSTCC tools/dumpimage.o
    HOSTCC tools/mkimage.o
    HOSTLD tools/mkenvimage
    HOSTLD tools/dumpimage
    HOSTLD tools/mkimage
    CC cmd/version.o
    CC common/main.o
    LD cmd/built-in.o
    CC common/board_f.o
    CC common/env_common.o
    LD common/built-in.o
    common/env_nowhere.o: In function `env_relocate_spec’:
    /home/kirti/u-boot-master/common/env_nowhere.c:21: multiple definition of `env_relocate_spec’
    common/env_mmc.o:/home/kirti/u-boot-master/common/env_mmc.c:212: first defined here
    common/env_nowhere.o: In function `env_relocate_spec’:
    /home/kirti/u-boot-master/common/env_nowhere.c:21: multiple definition of `env_init’
    common/env_mmc.o:/home/kirti/u-boot-master/common/env_mmc.c:45: first defined here
    common/env_nowhere.o: In function `env_relocate_spec’:
    /home/kirti/u-boot-master/common/env_nowhere.c:21: multiple definition of `env_ptr’
    common/env_mmc.o:/home/kirti/u-boot-master/common/env_mmc.c:45: first defined here
    CC drivers/usb/gadget/f_fastboot.o
    scripts/Makefile.build:359: recipe for target ‘common/built-in.o’ failed
    make[1]: *** [common/built-in.o] Error 1
    Makefile:1230: recipe for target ‘common’ failed
    make: *** [common] Error 2
    make: *** Waiting for unfinished jobs….
    LD drivers/usb/gadget/built-in.o

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *