C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-08-2009, 06:11 AM   #1
Registered User
 
Join Date: Mar 2009
Location: Cape Town
Posts: 6
Question Kernel building error

Hi,
I am working on the Freescale i.MX31 dev board by Phytec. After configuring the kernel, when I try and build it i get the following error message:

noam@linux-9zj8:~/linux-2.6.19.2> make ARCH=arm
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CC arch/arm/kernel/asm-offsets.s
cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mapcs"
cc1: error: unrecognized command line option "-mno-sched-prolog"
cc1: error: unrecognized command line option "-mabi=aapcs-linux"
cc1: error: unrecognized command line option "-mno-thumb-interwork"
arch/arm/kernel/asm-offsets.c:1: error: bad value (armv5t) for -march= switch
arch/arm/kernel/asm-offsets.c:1: error: bad value (strongarm) for -mtune= switch
make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2

The command line options which are not recognised are in a makefile which is specific to the arm processors (it is called by the main makefile). I am using OpenSuse 11.0 as my OS with 2.6.25.5 kernel (in a KDE 3.5 environment) and I am trying to compile a 2.6.19.2 kernel for my target device.
Help would be much appreciated!!!
Cheers, Noam.
nsayag is offline   Reply With Quote
Old 04-08-2009, 06:16 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
It looks like you are using a x86 (or "non-ARM") version of gcc to try to build the kernel.
What does gcc -v say?

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 04-08-2009, 06:35 AM   #3
Registered User
 
Join Date: Mar 2009
Location: Cape Town
Posts: 6
Hi Mats thanks for your response,
I think that you might be right, the gcc -v gives the following:

noam@linux-9zj8:~/linux-2.6.19.2> gcc -v
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.3 --enable-ssp --disable-libssp --with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' --disable-libgcj --with-slibdir=/lib --with-system-zlib --enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch --program-suffix=-4.3 --enable-version-specific-runtime-libs --enable-linux-futex --without-system-libunwind --with-cpu=generic --build=i586-suse-linux
Thread model: posix
gcc version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036] (SUSE Linux)

It looks like it is a i586 version of gcc...
How do I build a kernel then for my arm target?
nsayag is offline   Reply With Quote
Old 04-08-2009, 06:44 AM   #4
Registered User
 
Join Date: Mar 2009
Location: Cape Town
Posts: 6
P.S I have installed the cross compiler toolchain which came with the dev kit CD
nsayag is offline   Reply With Quote
Old 04-08-2009, 06:45 AM   #5
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Well, to build a ARM kernel, you need a version of gcc that cross-compiles to ARM [you could use a non-cross compiler if you have Linux and gcc installed on ARM, but I expect that's exactly what you are trying to achieve, and that you have no wish to run compiles on the ARM system anyways].

This is the first hit for "how to build gcc cross compiler". It doesn't tell you how to do it for ARM but it is the same principle for ANY cross-compilation, just different names for the target system.

Tips for building cross compiler
Here's one that mentions ARM:
Building a GCC ARM cross-compiler for GP32
There are plenty of other links too! Google will help you find them.

Make sure you install your compiler in a different place than the standard, and you will have to then inform "make" for the kernel that you want to use the alternative compiler instead of your normal x86 compiler.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 04-08-2009, 07:14 AM   #6
Registered User
 
Join Date: Mar 2009
Location: Cape Town
Posts: 6
Thanks again Mats,

OK I found part of my problem, as you mentioned above, I had to tell the make that I want to use a cross compiler. I have added that declaration and am getting the following:

noam@linux-9zj8:~/linux-2.6.19.2> make ARCH=arm CROSS_COMPILE=arm-non-linux-gnueabi- uImage
make: arm-non-linux-gnueabi-gcc: Command not found
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
CC arch/arm/kernel/asm-offsets.s
/bin/sh: arm-non-linux-gnueabi-gcc: command not found
make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 127
make: *** [prepare0] Error 2
noam@linux-9zj8:~/linux-2.6.19.2>

It complains about not finding the arm-non-linux-gnueabi-gcc comand which is very wierd because I can run it dirrectly from the shel and I have added its path to /etc/profile...

If you have any idea why this might happen that would be great!! Thanks for all your help thus far, Noam.
nsayag is offline   Reply With Quote
Old 04-08-2009, 07:20 AM   #7
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
It's probably because your shell that is run inside make isn't picking up your .profile settings - I don't know if that is the case or not.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 04-08-2009, 07:49 AM   #8
Registered User
 
Join Date: Mar 2009
Location: Cape Town
Posts: 6
Success!!!

Managed to compile (its still busy running on my other box). the cross compiler picked up a few errors but is now happy!!!
I didnt actualy have to do anything about the command not found... I just closed the shell, opend a new one, typed the make line and it didnt complain again...

Thanks again Mats for all you help!!
Cheers, Noam
nsayag is offline   Reply With Quote
Old 07-15-2009, 06:04 PM   #9
Registered User
 
Join Date: Jul 2009
Posts: 1
Just as a solution for others who stumble on this topic like me:

1. It's arm-none-linux-gnueabi- , not arm-non-linux-gnueabi-
2. Add the path of your cross-compile binaires to PATH ( export PATH=$PATH:/path/to/cross )
Dunge is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Testing some code, lots of errors... Sparrowhawk C Programming 48 12-15-2008 04:09 AM
Another syntax error caldeira C Programming 31 09-05-2008 01:01 AM
Post... maxorator C++ Programming 12 10-11-2005 08:39 AM
Dikumud maxorator C++ Programming 1 10-01-2005 06:39 AM
Couple C questions :) Divx C Programming 5 01-28-2003 01:10 AM


All times are GMT -6. The time now is 06:43 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22