Compiling latest U-Boot for i.MX6

This is probably old-hat to most readers of this blog, but here are the steps to get and compile the latest U-Boot for i.MX6.

Don’t let the nitrogen6x reference below fool you. These work for both SABRE Lite and Nitrogen6X, since our U-Boot code base auto-detects them.

Note that these instructions don’t currently work for Solo or Dual-Lite devices. If you have one of those, you should have received separate instructions from us.

~$ git clone git://github.com/boundarydevices/u-boot-imx6.git
Cloning into 'u-boot-imx6'...
remote: Counting objects: 98621
remote: Counting objects: 194430, done.
remote: Compressing objects: 100% (37277/37277), done.
remote: Total 194430 (delta 156593), reused 192232 (delta 154419)
Receiving objects: 100% (194430/194430), 49.84 MiB | 1.87 MiB/s, done.
Resolving deltas: 100% (156593/156593), done.
~$ cd u-boot-imx6
~/u-boot-imx6$ git checkout origin/production -b production
~/u-boot-imx6$ export ARCH=arm
~/u-boot-imx6$ export CROSS_COMPILE=arm-none-linux-gnueabi-
~/u-boot-imx6$ make nitrogen6x_config
Configuring for nitrogen6x - Board: nitrogen6x, Options: IMX_CONFIG=board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
~/u-boot-imx6$ make all
Generating include/autoconf.mk
make -C examples/api all
make[1]: Entering directory `/home/ericn/u-boot-imx6/examples/api'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/ericn/u-boot-imx6/examples/api'
~/u-boot-imx6$ ls -l u-boot.imx
-rw-rw-r-- 1 user group 312572 Nov 26 11:48 u-boot.imx

In English, these steps are:
  • Clone the U-Boot sources from git://github.com/boundarydevices/u-boot-imx6.git, and
  • Check out the production branch, and
  • Set your PATH and CROSS_COMPILE environment variables to point at your cross compiler, and the ARCH variable to arm, and
  • Choose the nitrogen6x_config configuration, and
  • Compile
The output is the file u-boot.imx as discussed in this post.

Note that the PATH and CROSS_COMPILE variables above refer to the latest LTIB package. You’ll need to change them if you’re using a different cross-compiler.

adminCompiling latest U-Boot for i.MX6

Comments 15

  1. Tony

    I am using a snapshot of the BD u-boot-imx6 git tree. I am booting my Nitrogen6x from an SDCard using the Linaro pre-loader in SPI-NOR.

    After adding some of my own code, I was seeing what I thought was a memory corruption issue (missing u-boot commands, data aborts, etc.) , After some investigation I found that the boot ROM was not copying the entire image from the SDCard to RAM. It seems to stop at the last complete 512B sector.

    As a temporary fix, I bumped the size field in the boot data header to the next sector boundary.

    The reference manual is short on details. Is this a known issue/feature?

  2. Troy

    I submitted a patch for this for i.mx53, but did not think that i.mx6 had the same bug.
    I will double check before resubmitting the patch.


    1. Larry Milesky

      Hi Troy,
      I noticed you mention that you created a patch for a iMX53 bug.
      I am running into a memory corruption issue on the iMX53 and would
      like to know what you found. Any information would be appreciated.
      I am running Win CE7.

      Thanks !

  3. sanjeev

    i am compiling the u-boot , and followed the same steps as given above
    but i am getting error as below,
    gcc: error trying to exec ‘cc1′: execvp: No such file or directory

    so what is the mistake? where it is going wrong?

    please help

    1. Post
      1. jyoti

        How can I determine which toolchain I am using?I used following commands to perform the compilation

        export ARCH=arm

        export CROSS_COMPILE=/home/jyoti/Downloads/arm-2009q1/arm-none-linux-gnueabi-

        make nitrogen6q_config

        make all
        The above steps gave me error
        gcc: error trying to exec ‘cc1′: execvp: No such file or directory
        make: *** [lib/asm-offsets.s] Error 1
        How to resolved the error?

        1. Post

          Hello Jyoti,

          It seems that the arm-2009q1 compiler isn’t installed properly. I’m not sure, but suspect that you’ll need your PATH set to include the binary directory in that tree.

          BTW, there’s an easier way if you’re running a recent Ubuntu. See this comment for details. In short, you may be able to run “sudo apt-get install gcc-arm-linux-gnueabihf” and get a very nice ARM cross-compiler that’s suitable for use when building U-Boot or the kernel.

  4. sp3ktral

    Do you think I could use your U-boot on the Ampe/Sanei//Haipad A10 quad core Imx6 tablet?

    There is almost no dev community for these tablet devices and I am trying to start one. The spec of these tablets is very similar to the Sabre Lite specs

    1. Post

      Ummm… No.

      There are few pieces of code that are as hardware-specific as a boot loader. In order to even touch this kind of code, you’ll want to have schematics in hand, and probably a tool like this one.

  5. mach


    I have configured this u-boot source with sabrelite like this.
    $ make mx6qsabrelite_config

    I want to modify this u-boot to use only 512MB (2 x 16bit d-bus) on my new board.
    So, I am going to modify these file.
    1. board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
    line number 117;
    from DATA 4 0x021b0000 0x831A0000
    to DATA 4 0x021b0000 0x83190000
    2. include/configs/mx6qsabrelite.h
    line number 242
    from #define PHYS_SDRAM_SIZE (1u * 1024 * 1024 * 1024)
    to #define PHYS_SDRAM_SIZE (512u * 1024 * 1024)

    Am I right…?
    Could you confirm me…?


  6. Post

    I suggest that you check out this post that describes how we’re handling multiple memory configurations.

    Stefano just applied most of the pre-requisites and this is a much cleaner approach.

    With a new design, you’ll also want to spend some serious time on calibration, varying voltages, clock rates, et cetera to make sure your board behaves properly in all of the corner cases.

  7. bcook

    I have built the u-boot.imx for a Nitrogen6x-SOM and programmed its spi flash. With the new image I get the following Linux (Ubuntu) error at boot time:

    [ 4.909715] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
    [ 4.911545] Bus freq driver module loaded
    [ 4.911553] Bus freq driver Enabled
    [ 4.913487] mxc_dvfs_core_probe
    [ 4.913686] DVFS driver module loaded
    [ 4.914770] regulator_init_complete: vddpu: incomplete constraints, leaving on
    [ 4.924520] snvs_rtc snvs_rtc.0: setting system clock to 1970-01-01 00:00:00 UTC (0)
    [ 4.958309] Freeing init memory: 204K
    Loading, please wait…
    [ 5.024618] udevd[852]: starting version 175
    Begin: Loading essential drivers … done.
    Begin: Running /scripts/init-premount … done.
    Begin: Mounting root file system … Begin: Running /scripts/local-top … done.
    Begin: Running /scripts/local-premount … done.
    mount: can’t read ‘/etc/fstab': No such file or directory
    Begin: Running /scripts/local-bottom … done.
    Begin: Running /scripts/init-bottom … mount: mounting /dev on /root/dev failed: No such file or directory
    mount: mounting /sys on /root/sys failed: No such file or directory
    mount: mounting /proc on /root/proc failed: No such file or directory
    Target filesystem doesn’t have requested /sbin/init.
    No init found. Try passing init= bootarg.

    BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash)
    Enter ‘help’ for a list of built-in commands.


    I do not have the Linux microSD mounting problems with the original u-boot, which seemed to be built for the MX6Q Sabrelite. The problem appears to be u-boot related. I modified nitrogen6x.h to initialize the various enviroment variables as listed below:

    bootargs_base=setenv bootargs console=ttymxc1,115200
    bootargs_mmc=setenv bootargs ${bootargs} root=/dev/mmcblk0p1 rootwait rw video=mxcfb0:dev=ldb,LDB-XGA,if=RGB666 video=mxcfb0:dev=hdmi,1920x1080M@60,if=RGB24
    bootargs=console=ttymxc1,115200 video=mxcfb0:dev=hdmi,1280x720M@60c,if=RGB24 video=mxcrb1:off
    bootargs_base=setenv bootargs console=ttymxc1,115200
    bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp video=mxcfb0:dev=ldb,LDB-XGA,if=RGB666 enable_wait_mode=off
    bootcmd=run bootcmd_mmc
    bootcmd_mmc=for disk in 0 1 ; do mmc dev ${disk} ;for fs in fat ext2 ; do ${fs}load mmc ${disk}:1 10008000 /6q_bootscript && source 10008000 ; done ; done
    bootcmd_net=dhcp && run bootargs_base bootargs_nfs && bootm
    bootsd0=mw.l 0x020d8040 0x3040 && mw.l 0x020d8044 0x10000000 && reset
    bootsd1=mw.l 0x020d8040 0x3840 && mw.l 0x020d8044 0x10000000 && reset
    clearenv=if sf probe || sf probe || sf probe 1 ; then sf erase 0xc0000 0x2000 && echo restored environment to factory default ; fi
    upgradeu=for dtype in sata mmc ; do for disk in 0 1 ; do ${dtype} dev ${disk} ;for fs in fat ext2 ; do ${fs}load ${dtype} ${disk}:1 10008000 /6x_upgrade && source 10008000 ; done ; done ; done

    I’m looking for direction to correct this problem.

  8. Benji

    Hello, I need help, i have a customed ubuntu installation that i am using on a laptop, i would like to use this very installation to boot using uboot on a utilite standard board, i need steps to make this happen, i am new to uboot.
    thanx alot

    1. Post
  9. phuoc

    Dear Boundary device

    as I understand, uboot is stored in internal flash of imx6 CPU. so when we run update uboot, it will update the internal flash memory. Am I right?

    if that, what is the file 6x_bootscript used for? As I understand, at boot time, uboot will call that file, and configurations in that file will set for system. am I right?

    my problem is I wan to use BD-SL-IMX6 board to display on LVDS 1024×768. Even when I set bootargs = mxcfb0:dev=ldb,1024x600M@60,if=RGB666 in uboot and disconnect hdmi connector, theare are no display on LVDS screen.
    the LVDS screen a line about uboot version at the start up time. then nothing display more.

    Thanks for your help

Leave a Reply

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