Make U-boot for ccimx6sbc seperately from Yocto

Hi

I am trying to make the u-boot for ccimx6sbc from source code in Yocto folder here:
tmp/work/ccimx6sbc-dey-linux-gnueabi/u-boot-dey/2013.04-r0/git/

The problem is: After dd the u-boot.imx to the sdcard, the uboot can start but stops at MMC like bellow:
U-Boot 2013.04 - dub-2.3.3.2-gf954d01 (Aug 26 2015 - 14:19:48)

CPU: Freescale i.MX6Q rev1.5 at 792 MHz
CPU: Temperature 39 C, calibration data: 0x5a550a69
Reset cause: POR
I2C: ready
DRAM: 1 GiB
MMC:
THE CONCOLE FREEZE HERE…

My steps are:

  1. copy the ccimx6sbc uboot source to a folder
  2. go in the folder and do: make distclean and make clean
  3. configure to ccimx6sbc_config
  4. make with x-tools

Could somebody help me? Thanks a lot in advance.

Jason

Rather than copying from Yocto, it may make sense to just clone from https://github.com/digidotcom/yocto-uboot and follow these instructions from a similar question: How does one compile u-boot using the yocto toolchain/sdk?.
This uses the toolchain generated by Yocto, but it should be possible to use another toolchain if the right flags are set.

How does one compile u-boot using the yocto toolchain/sdk?
On a project (a few in fact), I will be required to make changes to u-boot. I can make these within Yocto, but that is less than ideal. I would like to be able to make and test changes outside of Yocto as I can do with the kernel.
What I have working currently is to the do the following:

  1. Build an sdk from Yocto using 'bitbake -c populate_sdk`
  2. Install that SDK on my development machine
  3. Checkout U-Boot (I am working off the tag dey-1.6.2.2-2009.08 currently.
  4. Source the environment setup script for my SDK
  5. As with the kernel. unset LDFLAGS
  6. Apply the patch below.
  7. make ccimx53js_config && make all
    The patch (step 6) is the only part I am not happy with having to perform. Without this, U-Boot cannot link against libs (the first one I hit is libgcc.a) that are in the sysroot. The environment setup script sets up LD as the following (LD=arm-dey-linux-gnueabi-ld --sysroot=/home/posborne/Projects/WDNU-II/sdk/sysroots/armv7a-vfp-neon-dey-linux-gnueabi).
    Patch (will use environment defined CC/LD/etc.):
    diff --git a/config.mk b/config.mk
    index 02d204a…a8682c5 100644
    — a/config.mk
    +++ b/config.mk
    @@ -65,17 +65,17 @@ cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \

Include the make variables (CC, etc…)

-AS = $(CROSS_COMPILE)as
-LD = $(CROSS_COMPILE)ld
-CC = $(CROSS_COMPILE)gcc
-CPP = $(CC) -E
-AR = $(CROSS_COMPILE)ar
-NM = $(CROSS_COMPILE)nm
-LDR = $(CROSS_COMPILE)ldr
-STRIP = $(CROSS_COMPILE)strip
-OBJCOPY = $(CROSS_COMPILE)objcopy
-OBJDUMP = $(CROSS_COMPILE)objdump
-RANLIB = $(CROSS_COMPILE)RANLIB
+AS ?= $(CROSS_COMPILE)as
+LD ?= $(CROSS_COMPILE)ld
+CC ?= $(CROSS_COMPILE)gcc
+CPP ?= $(CC) -E
+AR ?= $(CROSS_COMPILE)ar
+NM ?= $(CROSS_COMPILE)nm
+LDR ?= $(CROSS_COMPILE)ldr
+STRIP ?= $(CROSS_COMPILE)strip
+OBJCOPY ?= $(CROSS_COMPILE)objcopy
+OBJDUMP ?= $(CROSS_COMPILE)objdump
+RANLIB ?= $(CROSS_COMPILE)RANLIB

#########################################################################

So, has anyone gotten this to work without patching U-Boot?
• Comment
The Yocto SDK is designed to build applications, and u-boot and Linux need special treatment. For example, the SDK environment preparation script sets up CFLAGS and LDFLAGS which do not work with neither u-boot or Linux.
To compile externally I have been using my own script for u-boot which does something like:
CROSS_COMPILE=arm-dey-linux-gnueabi-
TOOLCHAIN_PATH=${SDK_INSTALL_PATH}/sysroots/x86_64-pokysdk-linux/usr/bin/arm-dey-linux-gnueabi
export PATH=${TOOLCHAIN_PATH}:${PATH}
make ${PRODUCT}_config
make -j4 CROSS_COMPILE=${CROSS_COMPILE} u-boot.imx
This is similar to what I did to use the DEL toolchain.
With the current Yocto SDK however, it breaks with:
arm-dey-linux-gnueabi-ld.bfd: cannot find -lgcc
This is an SDK problem which was fixed in u-boot by the following commit:
commit 52b1bf2c5cd2f8af880dab503d0039b35570665b
Author: Wolfgang Denk
Date: Thu Jul 23 13:15:59 2009 +0200
Make linking against libgcc configurable

Many (especially ARM) tool chains seem to come with broken or
otherwise unusable (for the purposes of builing U-Boot) run-time
support libraries `libgcc.a'. By using the "USE_PRIVATE_LIBGCC"
setting we allow to use alternative libraries instead.
 
"USE_PRIVATE_LIBGCC" can either be set as an environment variable in
the shell, or as a command line argument when running "make", i. e.
    $ make USE_PRIVATE_LIBGCC=yes
or
    $ USE_PRIVATE_LIBGCC=yes
    $ export USE_PRIVATE_LIBGCC
    $ make
 
The value of "USE_PRIVATE_LIBGCC" is the name of the directory which
contains the alternative run-time support library `libgcc.a'. The
special value "yes" selects the directory $(OBJTREE)/lib_$(ARCH) .
 
Note that not all architectures provide an alternative `libgcc.a' in
their lib_$(ARCH) directories - so far, only ARM does.
 
Signed-off-by: Wolfgang Denk 
Cc: Jean-Christophe PLAGNIOL-VILLARD 
Cc: Prafulla Wadaskar 
cc: Stefan Roese 

So, the final way tobuild u-boot externally with the current Yocto SDK is:
CROSS_COMPILE=arm-dey-linux-gnueabi-
TOOLCHAIN_PATH=${SDK_INSTALL_PATH}/sysroots/x86_64-pokysdk-linux/usr/bin/arm-dey-linux-gnueabi
export PATH=${TOOLCHAIN_PATH}:${PATH}
make ${PRODUCT}_config
USE_PRIVATE_LIBGCC=“yes” make -j4 CROSS_COMPILE=${CROSS_COMPILE} u-boot.imx