How to build U-Boot, Kernel and Linux application(s) without Yocto

Document created by Yuri Muhin Employee on Jun 21, 2017Last modified by Yuri Muhin Employee on Oct 25, 2017
Version 3Show Document
  • View in full screen mode

 This article uses i.MX Linux® User's Guide, Rev. L4.1.15_2.1.0-ga, 05/2017

as an example (it may be found as attachment), please refer to section 4.5.12 (How to build

U-Boot and Kernel in standalone environment).

  First, generate a development SDK, which includes the tools, toolchain, and small rootfs to compile against

to put on the host machine.


  • Generate an SDK from the Yocto Project build environment with the following command. To set up the Yocto Project build

environment, follow the steps in the i.MX Yocto Project User's Guide (IMXLXYOCTOUG). In the following command,

set <Target-Machine> to the machine you are building for.


<Target-Machine> may be one of the following :


• imx6qpsabreauto

• imx6qpsabresd

• imx6ulevk

• imx6ull14x14evk

• imx6ull9x9evk

• imx6dlsabreauto

• imx6dlsabresd

• imx6qsabreauto

• imx6qsabresd

• imx6slevk

• imx6sllevk

• imx6solosabreauto

• imx6solosabresd
• imx6sxsabresd

• imx6sxsabreauto

• imx7dsabresd

 The «populate_sdk» generates an script file that sets up environment without Yocto Project. This SDK should be updated for each release

to pick up the latest headers, toolchain, and tools from the current release.


$ DISTRO=fsl-imx-fb MACHINE=<Target-Machine> source -b build-fb


$ DISTRO=fsl-imx-fb MACHINE=<Target-Machine> bitbake core-image-minimal -c populate_sdk




$ bitbake meta-toolchain



  • From the build directory, the bitbake was run in, copy the sh file in tmp/deploy/sdk to the host machine to build on and execute the

script to install the SDK. The default location is in /opt but can be placed anywhere on the host machine.


  Note. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.


 $ . /opt/fsl-imx-fb/4.1.15-2.0.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi




 $ source /opt/fsl-imx-fb/4.1.15-2.0.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi


From  Yocto Project Mega-Manual 


By default, this toolchain does not build static binaries. If you want to use the toolchain to build these types of libraries, you need to be sure your image has the appropriate static development libraries. Use the IMAGE_INSTALL variable inside your local.conf file to install the appropriate library packages. Following is an example using glibc static development libraries:

     IMAGE_INSTALL_append = " glibc-staticdev"


On the host machine, these are the steps to build U-Boot and Kernel:

 • On the host machine, set the environment with the following command before building.


$ export CROSS_COMPILE=/opt/fsl-imx-fb/4.1.15/environment-setup-cortexa9hf-vfp-neon-pokylinux-gnueabi


$ export ARCH=arm

• To build U-Boot, find the configuration for the target boot. In the following example, 
i.MX 6ULL is the target.


  Download source by cloning with


$ git clone -b imx_v2016.03_4.1.15_2.0.0_ga


$ cd uboot-imx

$ make clean

$ make mx6ull_14x14_evk_defconfig

$ make u-boot.imx


• To build the kernel, execute the following commands:


Download source by cloning with


$ git clone -b imx_4.1.15_2.0.0_ga


$ cd linux-imx

$ make defconfig

$ make


• To build an application (Hello World) as test.c:


$ source /opt/fsl-imx-fb/4.1.15-2.0.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi

$ cd ~/test/

$ arm-poky-linux-gnueabi-gcc --sysroot=/opt/fsl-imx-fb/4.1.15-2.0.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi -mfloat-abi=hard test.c




To check if the the compiled code (a.out) is ARM executable


$ file ./a.out


./a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 2.6.32, BuildID[sha1]=0e5c22dcf021748ead2c0bd51a4553cb7d38f6f2, not stripped


Copy file a.out to target Linux filesystem and before run it check again :


root@imx6ul7d:/unit_tests/1# file a.out


a.out: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 2.6.32, BuildID[sha1]=0e5c22dcf021748ead2c0bd51a4553cb7d38f6f2, not stripped


To define what Linux libs are needed to run our application :


root@imx6ul7d:/unit_tests/1# ldd a.out (0x7ee93000) => /lib/ (0x76e64000)

  /lib/ (0x76f9d000)


If some libs are not located in the filesystem you can observe the following message :


-sh: root@imx6ul7d:/unit_tests/1#./a.out: No such file or directory


Finally - run a.out:


root@imx6ul7d:/unit_tests/1# ./a.out

Hello World