Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Cross Compiling Linux Kernel On Eclipse(Cross Compiling Linux Kernel On Eclipse)
icon1.gif  Cross Compiling Linux Kernel On Eclipse [message #1713182] Mon, 02 November 2015 06:50 Go to next message
anishkhannayellapu yellapu is currently offline anishkhannayellapu yellapuFriend
Messages: 1
Registered: November 2015
Junior Member
I am trying to cross compile Linux kernel on Eclipse.
case 1:
compile Linux kernel on Eclipse (Native)
I tried to compile Linux kernel to native machine using eclipse by creating
File->New->MakefileProjectwithExistingCode
Selected the project path, selected tool chain to LinuxGCC
disable indexer and build the project. Linux Compiled
Output : Success

Case 2:
Cross Compiling Applications on Eclipse
I tried to compile an application with different x86 tool chain.
File->New->C Project
Selected Empty project
Toolchain: LinuxGCC
created a "c" file and saved.
right click on the project
c/c++build->settings->tool settings
here I gave path to my toolchain gcc path in GCC C Compiler, GCC C Linker and GCC Assembler
build the project
Output : Success

Case 3:
Cross compiling Linux kernel on Eclipse
I tried to compile Linux kernel to different x86 machine using eclipse by creating
File->New->MakefileProjectwithExistingCode
Selected the project path, selected tool chain to crossGCC
right click on the project
c/c++build
gave make with below make command
make ARCH=x86 CC=/home/poky/build/tmp/sysroots/i686-linux/usr/bin/corei7-64-poky-linux/x86_64-poky-linux-


follow above procedure gave me below error
make ARCH=x86 CC=/home/poky/build/tmp/sysroots/i686-linux/usr
/bin/corei7-64-poky-linux/x86_64-poky-linux- all
Building file: ../virt/kvm/arm/arch_timer.c
Invoking: GCC C Compiler
/home/poky/build/tmp/sysroots/i686-linux/usr/bin/corei7-64-
poky-linux/x86_64-poky-linux-gcc -I/home/poky/build/tmp/sysroots
/i686-linux/usr/include -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"virt/kvm/arm/arch_timer.d" -MT"virt/kvm/arm/arch_timer.d" -o "virt/kvm/arm/arch_timer.o" "../virt/kvm/arm/arch_timer.c"
../virt/kvm/arm/arch_timer.c:19:23: fatal error: linux/cpu.h: No such file or directory
#include <linux/cpu.h>
^
compilation terminated.
make: *** [virt/kvm/arm/arch_timer.o] Error 1


I am not exactly sure with the procedure to cross compile Linux kernel on Eclipse.
Please help me with the necessary steps. If i am doing wrong.

Thanks in advance


Re: Cross Compiling Linux Kernel On Eclipse [message #1713277 is a reply to message #1713182] Mon, 02 November 2015 23:44 Go to previous message
David VavraFriend
Messages: 1426
Registered: October 2012
Senior Member
Does your build log really have all of those line breaks? In any case it looks like your only included path is
/home/poky/build/tmp/sysroots/i686-linux/usr/include assuming the line breaks are not real.
Does this directory contain linux/cpu.h?

A similar question was asked and answered here:
http://stackoverflow.com/questions/33431688/unable-to-cross-compiling-linux-kernel-on-eclipse

As mentioned there, you can add include paths in the Project ==> Properties ==> C/C++ General==> Paths and Symbols dialog.
Or you could use the dialog at Project ==> Properties ==> C/C++ General ==> Preprocessor Inlcude Paths, Macros, etc.
Which is up to you, the latter is more for informing the indexer.

The compiler itself includes some default paths. At least regular old gcc does and will tell you what they are with :
echo | gcc -v -x c -E -
on the command line. It also will tell you what is included by default.

x86_64-poky-linux-gcc may do similar as it appears to be a GCC derivative.

In an case, the compiler is complaining that it can't find the include file.
If you hunt around, you may find an Eclipse plugin for this that may simplify things for you.


Previous Topic:Cross-development project
Next Topic:Impossible to build a project clones from Git
Goto Forum:
  


Current Time: Fri Apr 26 15:10:01 GMT 2024

Powered by FUDForum. Page generated in 0.03453 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top