yindra
Posts: 3
Joined: Tue Jan 02, 2018 11:03 pm

Cross-compile PI 3 kernel

Tue Jan 02, 2018 11:15 pm

I would like to cross-compile for the Pi 3 based on these instructions: https://www.raspberrypi.org/documentati ... uilding.md
my host is a 64-bit Ubuntu 17.04
when I execute: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
i get the error: ./scripts/gcc-version.sh: line 25: /home/me/tools/arm-gcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc: cannot execute binary file: Exec format error

I don't get this error when I execute: make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- zImage modules dtbs

why wont https://github.com/raspberrypi/tools/ar ... eabihf-gcc execute on a 64-bit Ubuntu?

LdB
Posts: 876
Joined: Wed Dec 07, 2016 2:29 pm

Re: Cross-compile PI 3 kernel

Wed Jan 03, 2018 12:27 am

Because it isn't a valid executable file for your O/S system ... it tells you that, you can't ask for a more accurate description than what it is saying.

>>> cannot execute binary file: Exec format error <<<

Try manually trying to the run the file on the command line and I am sure it will confirm it :-)

At a guess you will need to get a new version of the executable appropriate to your O/S .. probably just apt-get the package.

yindra
Posts: 3
Joined: Tue Jan 02, 2018 11:03 pm

Re: Cross-compile PI 3 kernel

Fri Jan 05, 2018 9:13 pm

Thank you,
yes it was an issue with the OS image. I had installed a 32-bit image by mistake. I only thought i had the 64-bit image installed

mleiva
Posts: 3
Joined: Sun Apr 09, 2017 11:18 pm

Re: Cross-compile PI 3 kernel

Sun Feb 25, 2018 5:10 am

You can simplify the kernel cross compilation using this tool:

https://bitbucket.org/manuelleiva/rpisys

Also, it could be used to cross-compile libraries and the tool is able to create a Bootable image with complete filesystem plus the kernel and libraries cross-compiled.

Return to “Bare metal, Assembly language”