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.

Tags:

16 Responses to “Compiling latest U-Boot for i.MX6”

  1. Tony December 12, 2012 12:23 pm #

    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 December 12, 2012 12:38 pm #

    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.

    Thanks
    Troy

    • Larry Milesky August 20, 2013 1:24 pm #

      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 !
      Larry

  3. sanjeev December 18, 2012 1:47 am #

    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

    • ericn December 18, 2012 6:35 am #

      Hi Sanjeev,

      This appears to be a toolchain issue. Which toolchain are you using?

      • jyoti January 29, 2014 11:38 pm #

        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?

        • ericn January 30, 2014 7:11 am #

          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 January 3, 2013 3:47 pm #

    Hello,
    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

    • ericn January 3, 2013 6:06 pm #

      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 February 22, 2013 7:32 am #

    Hello,

    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…?

    Thanks.

  6. ericn February 23, 2013 9:41 am #

    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 March 5, 2013 3:52 pm #

    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.
    done.
    Begin: Running /scripts/init-bottom … mount: mounting /dev on /root/dev failed: No such file or directory
    done.
    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.

    (initramfs)

    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
    baudrate=115200
    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
    bootdelay=3
    bootfile=uImage
    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
    console=ttymxc1
    enable_wait_mode=off
    ethact=FEC
    ethaddr=00:19:b8:00:f7:f9
    ethprime=FEC0
    filesize=274
    ipaddr=192.168.1.103
    kernel=uImage
    loadaddr=0x10800000
    netdev=eth0
    netmask=255.255.255.0
    nfsroot=/your/nfs/dir
    rd_loadaddr=0x11000000
    serverip=192.168.1.101
    stderr=serial
    stdin=serial
    stdout=serial
    uboot=u-boot.bin
    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 October 22, 2013 2:22 pm #

    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

    • ericn October 22, 2013 3:17 pm #

      I don’t know anything about utilite. You should talk to the manufacturer.

  9. viking.sun@live.com June 30, 2014 9:21 pm #

    Hi all,

    Is it possible to compile u-boot from my sabrelite directly?

    I tried this by make distclean, and it told me
    rm: cannot remove ‘SPL’: Is a directory
    make: *** [clobber] Error 1

    Maybe it doesn’t matter if it is clean. So I did make nitrogen6q_config
    Then:
    Configuring for nitrogen6q – Board: nitrogen6x, Options: IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q.cfg,MX6Q,DDR_MB=1024
    ln: failed to create symbolic link ‘asm/arch’: Operation not permitted
    make: *** [nitrogen6q_config] Error 1

    I have change that folder (/mnt/32GSDcard/) by
    chmod uoga+rwxXst

    So, basically, is that possible?

    Many thanks!

    Wei

    • viking.sun@live.com July 6, 2014 11:00 pm #

      It seems to be solved by
      yum install arm-linux-gnu
      Then use CROSS-COMPILE=arm-linux-gnu-

      I will follow up about the result.

Leave a Reply