michellefleischer

How to U-boot...

Blog Post created by michellefleischer Employee on Sep 11, 2018

How to Uboot...  I thought I would write this up as many developers using Layerscape, QoriQ and Qonverge devices will start with a boot loader as the first access to their own newly minted hardware.  There are two paths here.  The first is to get our SDK and find the uboot source in that, modify it as needed.  This is time consuming as you need to build an image to have Yocto pull the source code, and you need to jump through some hoops to rebuild with yocto after making your own custom uboot. 

 

The second is to go straight to the git repo, pull it and build with the cross compiler toolchain that seems most appropriate.  This can be easier in general...  To do this:

 

Step 1. Install your tools! 

Cross-compiler

For example when compiling for ARM: 

Go here and find a specific version, download and untar/zip

https://releases.linaro.org/components/toolchain/binaries/latest/ 

or:

$ sudo apt-get install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev
$ sudo apt-get install gcc-arm-linux-gnueabi

For example when compiling for Power Architecture: 

$ sudo apt-get install gcc-4.8-powerpc-linux-gnu g++-4.8-powerpc-linux-gnu binutils-4.8-powerpc-linux-gnu

Device Tree Compiler (Uboot builds use this also)
$ sudo apt-get install device-tree-compiler

Or
$ git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git
$ cd dtc
$ make

Step 2.  Pull the latest uboot Source latest from the repo:

 

$  git clone -b master git://git.denx.de/u-boot.git

 

Step 3.  set up your build environment

 

Add the DTC tools to your path (below shows where they are in a yocto install, your path would be different)

 

$ export PATH=$PATH:/home/michelle/Work/QorIQ-SDK-V2.0-20160527-yocto/build_ls2080ardb/tmp/sysroots/x86_64-linux/usr/bin/

 

Add the cross compiler location to your path (below shows a typical path, your path will depend where you install the tools):

$export PATH=$PATH:/opt/fsl/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/bin

Step 4:  Customize your uboot source and configuration as needed

Set a custom configuration, customize DDR settings, add or remove board peripherals (if there is interest I can post a step by step for these items also)

 

Step 5:  Start building

Set your configuration:
$ make CROSS_COMPILE=/opt/fsl/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- - ls2080aqds_qspi_defconfig

(note in this case I am picking up a default uboot configuration for QSPI boot on an LS208x)

 

Build u-boot


$ make CROSS_COMPILE=/opt/fsl/gcc-linaro-4.9-2016.02-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- -j8

(Note that here I am building the configuration, -j8 makes up to 8 compile tasks for speeding up the build on multicore hosts).

 

Output should be a u-boot.bin, uboot. and uboot.elf along with other image files.

 

I hope this is helpful to someone! 

Outcomes