Thread: Kernel building error

  1. #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.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

  3. #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?

  4. #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

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

  6. #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.

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

  8. #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

  9. #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 )

Popular pages Recent additions subscribe to a feed

Similar Threads

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