Imx6 DTC, sysroot error

Hello.

I am using Apalis iMX6Q, Ixora board.
I follow the article [Build U-Boot and Linux Kernel from Source Code].
I installed the toolchain and compiled U-Boot.
However, I have 2 problems.

  1. when I set DTC, I get an error message.

    ubuntu16-2:~$ dtc -v
    Version: DTC 1.4.0
    ubuntu16-2:~$ cd dtc/
    ubuntu16-2:~/dtc$ make
    CHK version_gen.h
    LEX convert-dtsv0-lexer.lex.c
    make: flex: Command not found
    BISON dtc-parser.tab.c
    make: bison: Command not found
    LEX dtc-lexer.lex.c
    make: flex: Command not found
    make: *** No rule to make target ‘convert-dtsv0-lexer.lex.c’, needed by ‘convert-dtsv0-lexer.lex.o’. Stop.

  2. when I set sysroot, I get an error message.

  3. List item

And my computer has a oe-core/build/tmp-glibc/sysroots
directory instead of the oe-core/build/out-libc/sysroots
directory.
But the directory is empty.

~/u-boot-toradex$ make CC='arm-angstrom-linux-gnueabi-gcc  --sysroot=${HOME}/oe-core/build/out-glibc/sysroots/colibri-vf'
make: arm-angstrom-linux-gnueabi-gcc: Command not found
./scripts/gcc-version.sh: line 25: arm-angstrom-linux-gnueabi-gcc: command not found
./scripts/gcc-version.sh: line 26: arm-angstrom-linux-gnueabi-gcc: command not found
*** Your GCC does not produce working binaries in THUMB mode.
*** Your board is configured for THUMB mode.
arch/arm/config.mk:49: recipe for target 'checkthumb' failed
make: *** [checkthumb] Error 1

I don’t know what to do to solve this problem.
Help me, please.

Apalis iMX6Q 1GB V1.1B

Ixora V1.1A

LINUX

Toolchain: gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz

And what exact software versions (workstation flavour and version as well as target) of things are you talking about?

How exactly did you go about installing that non-working DTC (e.g. installed by distribution package management or built yourself)?

Why exactly do you configure an angstrom toolchain if what you are using is actually the Linaro one?

And what exact software versions (workstation flavour and version as well as target) of things are you talking about?

My board software version is Apalis-iMX6_LXDE-Image_2.8.2.
I wanted to build U-Boot and the Linux kernel on my computer.
So I downloaded the 2016.11-toradex U-Boot branch.

How exactly did you go about installing that non-working DTC (e.g. installed by distribution package management or built yourself)?

I did the steps below.

  1. sudo apt-get install device-tree-compiler
  2. $ dtc -v
  3. git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git -b v1.4.1
  4. cd dtc/
  5. make

Why exactly do you configure an angstrom toolchain if what you are using is actually the Linaro one?

Previously, I installed the Yocto Project build environment.
However, I encountered some problems and stopped the installation.
At that time, the Angstrom toolchain may have been installed.
After that, I wanted to build a U-Boot kernel on my machine without Yocto Project.
So I followed the article [Build U-Boot and Linux Kernel from Source Code].
This article tells to install the Linaro toolchain 7.3.1 for image version 2.8.
So I installed the Linaro toolchain.

My board software version is Apalis-iMX6_LXDE-Image_2.8.2.

By workstation flavour and version I actually meant the Linux distribution running on your Linux PC/workstation where you are actually trying to build/compile that stuff.

Please note that our BSP 2.8.2 resp. 2.8b2 was a beta version and as such is long since obsolete and no longer supported.

I wanted to build U-Boot and the Linux kernel on my computer.

Yes, what exactly is that “my computer”?

So I downloaded the 2016.11-toradex U-Boot branch.

Makes sense.

I did the steps below.

  1. sudo apt-get install device-tree-compiler
  2. $ dtc -v

Which already gave you a perfectly fine DTC version 1.4, not?

  1. git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git -b v1.4.1
  2. cd dtc/
  3. make

That compiles yet a different version. However, you don’t seem to properly install that one (e.g. doing make install).

Previously, I installed the Yocto Project build environment.
However, I encountered some problems and stopped the installation.

Would be interesting to know what exactly that was.

At that time, the Angstrom toolchain may have been installed.

Most likely not. At least, it does not look like you do have any working toolchain configured as of yet.

After that, I wanted to build a U-Boot kernel on my machine without Yocto Project.
So I followed the article [Build U-Boot and Linux Kernel from Source Code].

Then, please, also install and configure your toolchain as described there.

This article tells to install the Linaro toolchain 7.3.1 for image version 2.8.

Yes, exactly.

So I installed the Linaro toolchain.

Maybe, but at least your configuration still tells a different story. What exactly are your CROSS_COMPILE and PATH environment variables set to?

I installed DTC using this command: sudo apt-get install device-tree-compiler
and I checked my DTC version using this command: dtc -v
The DTC version is 1.4.0.
If so, can I skip to execute below commands?
1) git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git -b v1.4.1
2) cd dtc/
3) make
4) export PATH=$HOME/dtc/:$PATH

Previously, I execute these commands unconditionally.
But I think it can be skipped. Is that correct?

I built uboot successfully using this command: make -j3 2>&1 | tee build.log
If so, can I skip below step?

make CC='arm-angstrom-linux-gnueabi-gcc  --sysroot=${HOME}/oe-core/build/out- 
glibc/sysroots/colibri-vf'  

Previously, I execute this command unconditionally.
But I think this command is required to resolve the following error:

 arm-angstrom-linux-gnueabi-ld.bfd: cannot find -lgcc
 make[2]: *** [examples/standalone/hello_world] Error 1
 make[1]: *** [examples/standalone] Error 2
 make: *** [examples] Error 2

Is it correct?

Most likely you are just missing the regular basic build tooling on whatever Linux workstation you are actually doing all this. E.g. try something like this should you be on Debian or Ubuntu:

sudo apt-get install bc build-essential git libncurses5-dev lzop perl

With that in place you may even build your custom DTC if for whatever reason you do NOT want to use your distribution provided one.

Then, never ever override CC during make like that! Doing this is bad in so many ways really! Just specify that Linaro toolchain if you’re instead and you should be fine.