0

How can I properly download the linaro toolchain and set it up so that I can use it with the kernel Makefile? When I test my version on the arm-linux-gnueabihf-gcc --version function it works but when compiling a custom kernel it fails.


Context

I am working to compile a custom linux kernel for the Beaglebone Black board. The guide I am following to build the custom kernel is here.

While following the steps for the guide, I need to use arm-linux-gnueabihf-gcc in order to cross compile the kernel for the Beaglebone hardware. So I have installed linaro's toolchain from their website. I just downloaded it and then unpacked it to the /opt/ folder.

$ cd /opt/
$ sudo mv gcc-linaro-7.1.1-2017.08-x86_64_arm-linux-gnueabi.tar.xz/ gcc-arm-linux
$ export PATH=$PATH:/opt/gcc-arm-linux/bin

I test and make sure that things worked in installing.

$ arm-linux-gnueabihf-gcc --version

And my output looks like the following image:

arm-linux-gnueabihf-gcc version

Once I'm finished with that I am compiling the kernel using the standard Makefile.

$ cd ~/linux
$ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bb.org_defconfig
$ sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage dtbs LOADADDR=0x80008000 -j4

At this point I run into errors on the command to actually compile the kernel.

Makefile:686: Cannot use CONFIG_CC_STACKPROTECTOR_STRONG: -fstack-protector-strong not supported by compiler
make: arm-linux-gnueabihf-gcc: Command not found
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CC      scripts/mod/empty.o
/bin/sh: 1: arm-linux-gnueabihf-gcc: not found
scripts/Makefile.build:258: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 127
scripts/Makefile.build:403: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:556: recipe for target 'scripts' failed
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....

What is most confusing is that the errors indicate that arm-linux-gnueabihf-gcc: not found, however I can run the command arm-linux-gnueabihf-gcc --version in the same folder and it will execute properly.

The solution to this problem could be to just install it using apt:

sudo apt-get install gcc-arm*

Which is suggested in this response, but that doesn't resolve my confusion.

Why can I test my version on the arm-linux-gnueabihf-gcc function but it doesn't execute in the Makefile properly? How can I properly download the linaro toolchain and set it up so that I can use it with the kernel Makefile?

stumblebee
  • 3,547
yodama
  • 101

1 Answers1

0

Not sure if this is the same problem as me, but I came accross this post when looking for an answer to my own issue.

I ran into similar issue when using an older linux-arm cross compiler from inside a docker container. The issue was the cross compile gcc binary was 32-bit, and the container running make was 64-bit. The make script was reporting "arm-linux/gcc not found"

You can check if it is 32-bit by doing

file absolute-path-to-gcc

for example

root@b61b0b938b8a:~# file /usr/local/arm-linux/bin/gcc
/usr/local/arm-linux/bin/gcc: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped

To fix this I had to add i386 to the docker container, as in this question

sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386