3

I am using Ubuntu 12.04 LTS 64 bit and trying to create a Linux Image for the SAMA5D36-EK. In doing so I need the mkimage command. According to this website

the mkimage source comes with the U-boot source and is built during U-boot compliation. But I am haivng problems.

Step 1.

I have installed the following: git 1.7.5, tar 1.2.4, python 2.7.3

I have also done:

$ sudo apt-get install gawk wget git-core diffstat unzip textinfo gcc-multilib build-essentail
$ sudo apt-get install chrpath libsdl1.2-dev xterm autoconf automake libtool libglib2.0-dev
$ sudo apt-get install linux-image-generic linux-headers-generic
$ sudo dpkg –add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libxss1:i386 libxft2:i386

Step 2.

I have installed the cross toolchain according to Yocto ADT Manual sections 3.1/ 3.2 as follows:

$ tar -xjf adt_installer.tar.bz2
$ cd adt_installer
$ gedit adt_installer.conf   and set
    YOCTOADT_TARGETS=”arm”
    YOCTOADT_ROOTFS_arm=”minimal sato-sdk”
    YOCTOADT_SYSROOT_IMAGE_arm=”sato-sdk”
    (and other arm based settings then save)
$ cd adt-installer
$ ./adt_installer   (using the default cross-toolchain location)
$ sudo chmod +x /opt/poky/1.6/envrionment-setup-arm5te-poky-linux-gnueabi
$ sudo /opt/poky/1.6/envrionment-setup-arm5te-poky-linux-gnueabi

The cross development toolchain is now located in /opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.8.2/

Step 3.

Create U-boot from source

$ git clone git://github.com/linux4sam/u-boot-at91.git
$ cd u-boot-at91
$ make distclean
$ make sama5d3xek_nandflash_config
$ make CROSS_COMPILE=/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.8.2/

After working for some time it comes with the error: ld: cannot find -lgcc

Step 4.

If I run

$ sudo find /usr/ -name libgcc*

I get the following:

/usr/lib/x86_64-linux-gnu/libgccpp.so.1
/usr/lib/x86_64-linux-gnu/libgccpp.so.1.0.3
/usr/lib/ure/lib/libgcc3_uno.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s_32.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so.1
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_eh.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s_x32.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc_eh.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc_eh.a
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc_s.so
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc.a
/usr/lib32/libgcc_s.so.1
/usr/share/lintian/overrides/libgcc1
/usr/share/doc/libgcc1
/usr/share/doc/libgcc-4.8-dev
/usr/libx32/libgcc_s.so.1

If I run

$ sudo /sbin/ldconfig -p | grep libgcc*

I get:

libgcrypt.so.11 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcrypt.so.11
libgcr-ui-3.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgcr-ui-3.so.1
libgcr-base-3.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgcr-base-3.so.1
libgconf-2.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgconf-2.so.4
libgck-1.so.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgck-1.so.0
libgccpp.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgccpp.so.1
libgcc_s.so.1 (libc6,x32) => /usr/libx32/libgcc_s.so.1
libgcc_s.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (libc6) => /lib/i386-linux-gnu/libgcc_s.so.1
libgcc_s.so.1 (libc6) => /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so.1
libgcc_s.so.1 (libc6) => /usr/lib32/libgcc_s.so.1
libgcc_s.so (libc6,x32) => /usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc_s.so
libgcc_s.so (libc6,x86-64) => /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so
libgcc_s.so (libc6) => /usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc_s.so
libgc.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libgc.so.1

There seems no reference to the two versions of the libgcc.a file that appear in subdirectoris /32/ and /x32/

I then locate the following two files:

/etc/ld.so.conf.d/x86_64-linux-gnu.conf
/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/etc/ld.so.conf

and add the following lines in both files:

/usr/lib/gcc/x86_64-linux-gnu/4.8
/usr/lib/gcc/x86_64-linux-gnu/4.8/32
/usr/lib/gcc/x86_64-linux-gnu/4.8/x32

I now repeat the three 'make' commands from step 3 . It makes about 200 or so files (tools, arch, common, drivers, fs, lib, net, test) but then comes to the same error as follows:

LD      examples/standalone/hello_world
/opt/poky/1.6/sysroots/x86_64-pokysdk-linux/usr/libexec/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/4.8.2/ld: cannot find -lgcc
make[2]: *** [examples/standalone/hello_world] Error 1
make[1]: *** [examples/standalone] Error 2
make: *** [examples] Error 2

Step 5.

In the Makefile there is the following entries

# Add GCC lib
ifdef CONFIG_USE_PRIVATE_LIBGCC
ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
else
PLATFORM_LIBGCC = -L $(CONFIG_USE_PRIVATE_LIBGCC) -lgcc
endif
else
PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
endif

Back in the terminal mode I do the following:

$ CONFIG_USE_PRIVATE_LIBGCC=yes
$ export CONFIG_USE_PRIVATE_LIBGCC

Then rerun the three make commands from Step 3 but get the same error

I then try

$ unset  CONFIG_USE_PRIVATE_LIBGCC

and rerun the three commands but still the error occurs

Then I try

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/gcc/x86_64-linux-gnu/4.8:/usr/lib/gcc/x86_64-linux-gnu/4.8/32:/usr/lib/gcc/x86_64-linux-gnu/4.8/x32
$ echo $LD_LIBRARY_PATH
/usr/lib/gcc/x86_64-linux/4.8:/usr/lib/gcc/x86_64-linux-gnu/4.8/32:/usr/lib/gcc/x86_64-linux-gnu/4.8/x32

and run the three make commands, but still an error

Then I try changing the entry in the makefile from:

PLATFORM_LIBGCC := -L $(shell dirname $(CC) $(c_flags) -print-libgcc-file-name) -lgcc

To:

PLATFORM_LIBGCC := -L /usr/lib/gcc/x86_64-linux-gnu/4.8:/usr/lib/gcc/x86_64-linux-gnu/4.8/32:/usr/lib/gcc/x86_64-linux-gnu/4.8/x32 -lgcc

I save the file. Back in the terminal mode I do the following:

$ CONFIG_USE_PRIVATE_LIBGCC=yes
$ export CONFIG_USE_PRIVATE_LIBGCC

Then rerun the three make commands from Step 3 but get the same error

I then try

$ unset  CONFIG_USE_PRIVATE_LIBGCC

and rerun the three commands but still the error occurs

I then change the Makefile entry to:

PLATFORM_LIBGCC :=/usr/lib/gcc/x86_64-linux-gnu/4.8/32/libgcc.a

which finally gets past the -lgcc error associated with the hello_world example, but then fails a little further on with hundreds of failures starting with:

LD      u-boot
arch/arm/cpu/armv7/at91/built-in.o: In function `at91_pll_rate':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/clock.c:45: undefined reference to `__aeabi_uidiv'
arch/arm/cpu/armv7/at91/built-in.o: In function `at91_clock_init':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/clock.c:100: undefined reference to `__aeabi_uidiv'
arch/arm/cpu/armv7/at91/built-in.o: In function `usec_to_tick':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/timer.c:50: undefined reference to `__aeabi_uidiv'
arch/arm/cpu/armv7/at91/built-in.o: In function `tick_to_time':
/home/lachlan/u-boot-at91/arch/arm/cpu/armv7/at91/timer.c:42: undefined reference to `__aeabi_uidiv'
common/built-in.o: In function `common_diskboot':
/home/lachlan/u-boot-at91/common/cmd_disk.c:100: undefined reference to `__aeabi_uidiv'
common/built-in.o: In function `do_mem_md':
/home/lachlan/u-boot-at91/common/cmd_mem.c:137: undefined reference to `__aeabi_idiv'
common/built-in.o: In function `bytes_per_second':
/home/lachlan/u-boot-at91/common/cmd_sf.c:86: undefined reference to `__aeabi_uidiv'
common/built-in.o: In function `spi_flash_update':
/home/lachlan/u-boot-at91/common/cmd_sf.c:207: undefined reference to `__aeabi_idiv'
/home/lachlan/u-boot-at91/common/cmd_sf.c:216: undefined reference to `__aeabi_uidiv'
/home/lachlan/u-boot-at91/common/cmd_sf.c:237: undefined reference to `__aeabi_uidiv'
/home/lachlan/u-boot-at91/common/cmd_sf.c:237: undefined reference to `__aeabi_uidivmod'

etc

I then change the Makefile entry to:

PLATFORM_LIBGCC :=/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/libgcc.a

and the same result occurs as immeditly described above

Can anyone suggest how to fix this problem?

0

In some Makefiles it tries to find the search path for libgcc by executing:

$(CC) -print-libgcc-file-name

This fails if no sysroot is defined, so add sysroot manually. Have a look at the config.mk where it says:

CC := $(CROSS_COMPILE)gcc

Change it to:

ifdef PKG_CONFIG_SYSROOT_DIR
CC  = $(CROSS_COMPILE)gcc --sysroot=$(PKG_CONFIG_SYSROOT_DIR)
else
CC  = $(CROSS_COMPILE)gcc
endif
0

change cross_compile to another directory, for 4.1.15

source /<dir>/environment-setup-cortexa9hf-neon-poky-linux-gnueabi

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.