Linux cross-compilation for ARM architecture
There are two approaches I've used for ARM/Linux tools. The easiest is to download a pre-built tool chain directly.
Pro: It just works and you can get on with the interesting part of your project
Con: You are stuck with whichever version of gcc/binutils/libc they picked
If the later matters to you, check out crosstool-ng. This project is a configuration tool similar to the Linux kernel configuration application. Set which versions of gcc, binutils, libc (GNU or uCLibc), threading, and Linux kernel to build and crosstool-ng does the rest (i.e. downloads the tar balls, configures the tools, and builds them).
Pro: You get exactly what you selected during the configuration
Con: You get exactly what you selected during the configuration
meaning you take on full responsibility for the choice of compiler/binutil/libc and their associated features/shortcomings/bugs. Also, as mentioned in the comments, there is some "pain" involved in selecting the versions of binutils, C library etc. as not all combinations necessarily work together or even build.
One hybrid approach might be to start with the pre-built tools and replace them later with a custom solution via crosstool-ng if necessary.
Update: The answer originally used the CodeSourcery tools as an example of a pre-built tool chain. The CodeSourcery tools for ARM were free to download from Mentor Graphics, but they are now called the Sourcery CodeBench and must be purchased from Mentor Graphics. Other options now include Linaro as well as distribution specific tools from Android, Ubuntu, and others.
Cross compiling kselftest of arm architecture?
I was able to cross compile from top of kernel directory using following command :-
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -C tool/testing/selftest
Thanks
ARM cross compiling
Could you run the readelf command in order to determine which ARM architecture your cross compiler targets? We need to see if this target is supported by Qemu.
arm-linux-gnueabi-readelf --file-header --arch-specific a
Moreover, you can check the output of dmesg
in your emulated system. It should contain a description of the illegal instruction.
Also, you can run your program in a debugger to see which intruction fails.
Related Topics
Difference Between Linux Loadable and Built-In Modules
How to Reinstall the Latest Cmake Version
Vm/Min_Free_Kbytes - Why Keep Minimum Reserved Memory
How to Sort Files Numerically from Linux Command Line
Is Timer Interrupt Independent of Whether System Is in Kernel Mode or User Mode
Add User to Group But Not Reflected When Run "Id"
How to Look Up a Variable by Name with #!/Bin/Sh (Posix Sh)
What Happens When You Run a Program
How to Wait for Server Restart Using Ansible
How to Automatically Start a Node.Js Application in Amazon Linux Ami on Aws
Fuzzy File Search in Linux Console
Call a Kernel Module Function from Program at User Space
Linux Shared Library That Uses a Shared Library Undefined Symbol
Minimal Core Dump (Stack Trace + Current Frame Only)
Using 'Find' to Return Filenames Without Extension
How to Grep '---' in Linux? Grep: Unrecognized Option '---'