Find the answer to your Linux question:
Results 1 to 7 of 7
Hi, I've never compiled a kernel before in my life, always used linux without doing it.. So i have a MIPS board so i go to mips-linux and download a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    6

    ARRRRGH first compilation


    Hi,
    I've never compiled a kernel before in my life, always used linux without doing it.. So i have a MIPS board so i go to mips-linux and download a couple kernel versions, i run make menuconfig set up the board i'm interested in, then i run make vmlinux.srec (supposedly i need an srec file to load into the flash memory through tftp). But i get the same error wich ever version i try:

    Code:
    root(at)james-VirtualBox:~/Desktop/linux-2.6.38# make vmlinux.srec
    gcc: error: 0: No such file or directory
    gcc: error: unrecognized option ‘-G’
    gcc: error: unrecognized option ‘-EL’
      CHK     include/linux/version.h
      CHK     include/generated/utsrelease.h
      CC      kernel/bounds.s
    gcc: error: 0: No such file or directory
    gcc: error: unrecognized option ‘-G’
    gcc: error: unrecognized option ‘-EL’
    make[1]: *** [kernel/bounds.s] Error 1
    make: *** [prepare0] Error 2
    root(at)james-VirtualBox:~/Desktop/linux-2.6.38#
    Any help would be really appreciated.

    James

  2. #2
    Linux Newbie
    Join Date
    Jun 2004
    Location
    Halesowen, West Midlands, UK
    Posts
    107
    Quote Originally Posted by scarja View Post
    Hi,
    I've never compiled a kernel before in my life, always used linux without doing it.. So i have a MIPS board so i go to mips-linux and download a couple kernel versions, i run make menuconfig set up the board i'm interested in, then i run make vmlinux.srec (supposedly i need an srec file to load into the flash memory through tftp). But i get the same error wich ever version i try:

    Code:
    root(at)james-VirtualBox:~/Desktop/linux-2.6.38# make vmlinux.srec
    gcc: error: 0: No such file or directory
    gcc: error: unrecognized option ‘-G’
    gcc: error: unrecognized option ‘-EL’
      CHK     include/linux/version.h
      CHK     include/generated/utsrelease.h
      CC      kernel/bounds.s
    gcc: error: 0: No such file or directory
    gcc: error: unrecognized option ‘-G’
    gcc: error: unrecognized option ‘-EL’
    make[1]: *** [kernel/bounds.s] Error 1
    make: *** [prepare0] Error 2
    root(at)james-VirtualBox:~/Desktop/linux-2.6.38#
    Any help would be really appreciated.

    James
    I take it you are cross compiling the MIPS kernel.
    Check Kernel Build - LinuxMIPS

  3. #3
    Just Joined!
    Join Date
    Jul 2012
    Posts
    6
    ah ok, so i have to cross_compile (just read about it). But i tried to edit .config file and put CONFIG_CROSS_COMPILE="mipsel-linux" but i still can't get it to compile it says something about missing compiler, do i need to install extra libraries to cross compile?
    Code:
    root@james-VirtualBox:~/Desktop/linux-2.6.39# make vmlinux.srec
    gcc: error: 0: No such file or directory
    gcc: error: unrecognized option ‘-G’
    gcc: error: unrecognized option ‘-EL’
    scripts/kconfig/conf --silentoldconfig Kconfig
    warning: (LOCKDEP && FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && FUNCTION_TRACER && KMEMCHECK) selects FRAME_POINTER which has unmet direct dependencies (DEBUG_KERNEL && (CRIS || M68K || FRV || UML || AVR32 || SUPERH || BLACKFIN || MN10300) || ARCH_WANT_FRAME_POINTERS)
    warning: (LOCKDEP && FAULT_INJECTION_STACKTRACE_FILTER && LATENCYTOP && FUNCTION_TRACER && KMEMCHECK) selects FRAME_POINTER which has unmet direct dependencies (DEBUG_KERNEL && (CRIS || M68K || FRV || UML || AVR32 || SUPERH || BLACKFIN || MN10300) || ARCH_WANT_FRAME_POINTERS)
    /bin/sh: 1: mipsel-linuxgcc: not found
    /bin/sh: 1: mipsel-linuxgcc: not found
    /bin/sh: 1: mipsel-linuxgcc: not found
    /bin/sh: 1: mipsel-linuxgcc: not found
    make: mipsel-linuxgcc: Command not found
      CHK     include/linux/version.h
      CHK     include/generated/utsrelease.h
      CC      kernel/bounds.s
    /bin/sh: 1: mipsel-linuxgcc: not found
    make[1]: *** [kernel/bounds.s] Error 127
    make: *** [prepare0] Error 2
    root@james-VirtualBox:~/Desktop/linux-2.6.39#

    James

  4. #4
    Just Joined!
    Join Date
    Jul 2012
    Posts
    6
    ok i've now downloaded binutils and compiled it successfully, i'm trying to compile gcc but i get this error:

    Code:
    checking for mipsel-linux-strip... /usr/mipsel-linux/bin/strip
    checking for --enable-version-specific-runtime-libs... no
    checking whether to enable maintainer-specific portions of Makefiles... no
    checking for mipsel-linux-gcc... /media/4b4fda61-803d-46ed-a574-c1ab1f7cda6f/gcc-build/./gcc/xgcc -B/media/4b4fda61-803d-46ed-a574-c1ab1f7cda6f/gcc-build/./gcc/ -B/usr/mipsel-linux/bin/ -B/usr/mipsel-linux/lib/ -isystem /usr/mipsel-linux/include -isystem /usr/mipsel-linux/sys-include
    checking for C compiler default output file name... configure: error: in `/media/4b4fda61-803d-46ed-a574-c1ab1f7cda6f/gcc-build/mipsel-linux/libmudflap':
    configure: error: C compiler cannot create executables
    See `config.log' for more details.
    make[1]: *** [configure-target-libmudflap] Error 1
    make[1]: Leaving directory `/media/4b4fda61-803d-46ed-a574-c1ab1f7cda6f/gcc-build'
    make: *** [all] Error 2
    your guide helped me to understand what i needed to do, and now i'm following this guide i found: (type http infront i can't post urls yet)
    imara.inria.fr/users/oliviermehani/2007ie/mipsellinuxtoolchain

  5. #5
    Just Joined!
    Join Date
    Jul 2012
    Posts
    6
    ok, i think i was using a too recent version of gcc, i tried a 3.3.4 and 3.3.6 and got further on but i stumble over the same error in both:

    Code:
    ./gcc-3.3.6/gcc/gcov.c -o gcov.o
    ../../gcc-3.3.6/gcc/gcov.c: In function ‘fnotice’:
    ../../gcc-3.3.6/gcc/gcov.c:308:1: warning: traditional C rejects ISO C style function definitions [-Wtraditional]
    ../../gcc-3.3.6/gcc/gcov.c: In function ‘read_files’:
    ../../gcc-3.3.6/gcc/gcov.c:986:9: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    ../../gcc-3.3.6/gcc/gcov.c: In function ‘create_program_flow_graph’:
    ../../gcc-3.3.6/gcc/gcov.c:732:9: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
    gcc   -g -O2 -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H  gcov.o intl.o version.o   ../libiberty/libiberty.a -o gcov
    gcc   -g -O2 -DIN_GCC -DCROSS_COMPILE  -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long   -DHAVE_CONFIG_H    -I. -I. -I../../gcc-3.3.6/gcc -I../../gcc-3.3.6/gcc/. -I../../gcc-3.3.6/gcc/config -I../../gcc-3.3.6/gcc/../include  \
            -DTARGET_MACHINE=\"mipsel-linux\" \
            -c ../../gcc-3.3.6/gcc/collect2.c -o collect2.o
    ../../gcc-3.3.6/gcc/collect2.c: In function ‘notice’:
    ../../gcc-3.3.6/gcc/collect2.c:362:1: warning: traditional C rejects ISO C style function definitions [-Wtraditional]
    ../../gcc-3.3.6/gcc/collect2.c: In function ‘fatal_perror’:
    ../../gcc-3.3.6/gcc/collect2.c:374:1: warning: traditional C rejects ISO C style function definitions [-Wtraditional]
    ../../gcc-3.3.6/gcc/collect2.c: In function ‘fatal’:
    ../../gcc-3.3.6/gcc/collect2.c:392:1: warning: traditional C rejects ISO C style function definitions [-Wtraditional]
    ../../gcc-3.3.6/gcc/collect2.c: In function ‘error’:
    ../../gcc-3.3.6/gcc/collect2.c:408:1: warning: traditional C rejects ISO C style function definitions [-Wtraditional]
    In file included from /usr/include/fcntl.h:252:0,
                     from ../../gcc-3.3.6/gcc/system.h:208,
                     from ../../gcc-3.3.6/gcc/collect2.c:30:
    In function ‘open’,
        inlined from ‘collect_execute’ at ../../gcc-3.3.6/gcc/collect2.c:1575:20:
    /usr/include/i386-linux-gnu/bits/fcntl2.h:51:24: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
    make[1]: *** [collect2.o] Error 1
    make[1]: Leaving directory `/media/4b4fda61-803d-46ed-a574-c1ab1f7cda6f/gcc-build/gcc'
    make: *** [all-gcc] Error 2
    root@james-VirtualBox:/media/4b4fda61-803d-46ed-a574-c1ab1f7cda6f/gcc-build#

  6. #6
    Just Joined!
    Join Date
    Jul 2012
    Posts
    6
    I now know that i need to "Relocate ld script $FILE to use $targetfs" so i used this script i found:

    Code:
    for FILE in $targetfs/lib/* $targetfs/usr/lib/*; do
            if test -f $FILE && file $FILE | grep -q ASCII; then
                    if grep -q $targetfs $FILE; then
                            continue
                    else
                            echo "Relocating ld script $FILE to use $targetfs..."
                            sed -i "s# \(/lib/\)# $targetfs\1#g;s# \(/usr/lib/\)# $targetfs\1#g" $FILE
                    fi
            fi
    done
    but it always got stuck i put an echo $targetfs and noticed that it's always empty, would somebody know why?

    james

  7. #7
    Just Joined!
    Join Date
    Jul 2012
    Posts
    6
    Ok so i'm gettin further and further... I've now managed to get binutils running (i've tried different versions and it always seems to work)... Now i'm getting really mad at gcc, i've tried million of versions now i had an error about a open function wich i edited from this:
    Code:
     redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);
    to this:
    Code:
     redir_handle = open (redir, O_WRONLY , O_TRUNC | O_CREAT);
    All went on but now i get a memory overflow error can anyone help?

    Code:
    ./auto-host.h:188:1: warning: "HAVE_DECL_GETOPT" redefined
    In file included from ../../gcc-3.4.6/gcc/libgcov.c:37:
    ../../gcc-3.4.6/gcc/tsystem.h:40:1: warning: this is the location of the previous definition
    *** buffer overflow detected ***: mipsel-unknown-linux-gnu-ar terminated
    rm -rf ./libgcov.a
    mipsel-unknown-linux-gnu-ar  rc ./libgcov.a libgcc/./_gcov.o libgcc/./_gcov_merge_add.o libgcc/./_gcov_merge_single.o libgcc/./_gcov_merge_delta.o
    ======= Backtrace: =========
    /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x45)[0x40134dd5]
    /lib/i386-linux-gnu/libc.so.6(+0xfebaa)[0x40133baa]
    /lib/i386-linux-gnu/libc.so.6(+0xfe208)[0x40133208]
    /lib/i386-linux-gnu/libc.so.6(_IO_default_xsputn+0x91)[0x400a6461]
    /lib/i386-linux-gnu/libc.so.6(_IO_padn+0xc9)[0x40099f79]
    /lib/i386-linux-gnu/libc.so.6(_IO_vfprintf+0x3282)[0x40078a72]
    /lib/i386-linux-gnu/libc.so.6(__vsprintf_chk+0xc9)[0x401332d9]
    /lib/i386-linux-gnu/libc.so.6(__sprintf_chk+0x2f)[0x401331ef]
    mipsel-unknown-linux-gnu-ar[0x804ee88]
    mipsel-unknown-linux-gnu-ar[0x80511f4]
    mipsel-unknown-linux-gnu-ar[0x8059562]
    mipsel-unknown-linux-gnu-ar[0x804c7da]
    mipsel-unknown-linux-gnu-ar[0x804a631]
    /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x4004e4d3]
    mipsel-unknown-linux-gnu-ar[0x804ac5d]
    ======= Memory map: ========
    08048000-080e6000 r-xp 00000000 08:01 1588620    /opt/cross/bin/mipsel-unknown-linux-gnu-ar
    080e6000-080e7000 r--p 0009d000 08:01 1588620    /opt/cross/bin/mipsel-unknown-linux-gnu-ar
    080e7000-080e8000 rw-p 0009e000 08:01 1588620    /opt/cross/bin/mipsel-unknown-linux-gnu-ar
    080e8000-080ed000 rw-p 00000000 00:00 0 
    09fe6000-0a0cd000 rw-p 00000000 00:00 0          [heap]
    40000000-40020000 r-xp 00000000 08:01 526219     /lib/i386-linux-gnu/ld-2.15.so
    40020000-40021000 r--p 0001f000 08:01 526219     /lib/i386-linux-gnu/ld-2.15.so
    40021000-40022000 rw-p 00020000 08:01 526219     /lib/i386-linux-gnu/ld-2.15.so
    40022000-40023000 r-xp 00000000 00:00 0          [vdso]
    40023000-40025000 rw-p 00000000 00:00 0 
    40025000-40026000 r--p 005e0000 08:01 1453059    /usr/lib/locale/locale-archive
    40026000-4002d000 r--s 00000000 08:01 1450254    /usr/lib/i386-linux-gnu/gconv/gconv-modules.cache
    4002d000-4002e000 rw-p 00000000 00:00 0 
    40035000-401d4000 r-xp 00000000 08:01 526239     /lib/i386-linux-gnu/libc-2.15.so
    401d4000-401d6000 r--p 0019f000 08:01 526239     /lib/i386-linux-gnu/libc-2.15.so
    401d6000-401d7000 rw-p 001a1000 08:01 526239     /lib/i386-linux-gnu/libc-2.15.so
    401d7000-401db000 rw-p 00000000 00:00 0 
    401db000-403db000 r--p 00000000 08:01 1453059    /usr/lib/locale/locale-archive
    403eb000-40407000 r-xp 00000000 08:01 526260     /lib/i386-linux-gnu/libgcc_s.so.1
    40407000-40408000 r--p 0001b000 08:01 526260     /lib/i386-linux-gnu/libgcc_s.so.1
    40408000-40409000 rw-p 0001c000 08:01 526260     /lib/i386-linux-gnu/libgcc_s.so.1
    bf999000-bf9bc000 rw-p 00000000 00:00 0          [stack]
    *** buffer overflow detected ***: mipsel-unknown-linux-gnu-ar terminated
    ======= Backtrace: =========
    /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x45)[0x40134dd5]
    /lib/i386-linux-gnu/libc.so.6(+0xfebaa)[0x40133baa]
    /lib/i386-linux-gnu/libc.so.6(+0xfe208)[0x40133208]
    /lib/i386-linux-gnu/libc.so.6(_IO_default_xsputn+0x91)[0x400a6461]
    /lib/i386-linux-gnu/libc.so.6(_IO_padn+0xc9)[0x40099f79]
    /lib/i386-linux-gnu/libc.so.6(_IO_vfprintf+0x3282)[0x40078a72]
    /lib/i386-linux-gnu/libc.so.6(__vsprintf_chk+0xc9)[0x401332d9]
    /lib/i386-linux-gnu/libc.so.6(__sprintf_chk+0x2f)[0x401331ef]
    mipsel-unknown-linux-gnu-ar[0x804ee88]
    mipsel-unknown-linux-gnu-ar[0x80511f4]
    mipsel-unknown-linux-gnu-ar[0x8059562]
    mipsel-unknown-linux-gnu-ar[0x804c7da]
    mipsel-unknown-linux-gnu-ar[0x804a631]
    /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x4004e4d3]
    mipsel-unknown-linux-gnu-ar[0x804ac5d]
    ======= Memory map: ========
    08048000-080e6000 r-xp 00000000 08:01 1588620    /opt/cross/bin/mipsel-unknown-linux-gnu-ar
    080e6000-080e7000 r--p 0009d000 08:01 1588620    /opt/cross/bin/mipsel-unknown-linux-gnu-ar
    080e7000-080e8000 rw-p 0009e000 08:01 1588620    /opt/cross/bin/mipsel-unknown-linux-gnu-ar
    080e8000-080ed000 rw-p 00000000 00:00 0 
    09f2a000-09f4b000 rw-p 00000000 00:00 0          [heap]
    40000000-40020000 r-xp 00000000 08:01 526219     /lib/i386-linux-gnu/ld-2.15.so
    40020000-40021000 r--p 0001f000 08:01 526219     /lib/i386-linux-gnu/ld-2.15.so
    40021000-40022000 rw-p 00020000 08:01 526219     /lib/i386-linux-gnu/ld-2.15.so
    40022000-40023000 r-xp 00000000 00:00 0          [vdso]
    40023000-40025000 rw-p 00000000 00:00 0 
    40025000-40026000 r--p 005e0000 08:01 1453059    /usr/lib/locale/locale-archive
    40026000-4002d000 r--s 00000000 08:01 1450254    /usr/lib/i386-linux-gnu/gconv/gconv-modules.cache
    4002d000-4002f000 rw-p 00000000 00:00 0 
    40035000-401d4000 r-xp 00000000 08:01 526239     /lib/i386-linux-gnu/libc-2.15.so
    401d4000-401d6000 r--p 0019f000 08:01 526239     /lib/i386-linux-gnu/libc-2.15.so
    401d6000-401d7000 rw-p 001a1000 08:01 526239     /lib/i386-linux-gnu/libc-2.15.so
    401d7000-401db000 rw-p 00000000 00:00 0 
    401db000-403db000 r--p 00000000 08:01 1453059    /usr/lib/locale/locale-archive
    403eb000-40407000 r-xp 00000000 08:01 526260     /lib/i386-linux-gnu/libgcc_s.so.1
    40407000-40408000 r--p 0001b000 08:01 526260     /lib/i386-linux-gnu/libgcc_s.so.1
    40408000-40409000 rw-p 0001c000 08:01 526260     /lib/i386-linux-gnu/libgcc_s.so.1
    bf95d000-bf97f000 rw-p 00000000 00:00 0          [stack]
    make[2]: *** [libgcov.a] Aborted (core dumped)
    make[2]: *** Deleting file `libgcov.a'
    make[2]: *** Waiting for unfinished jobs....
    make[2]: *** [libgcc.a] Aborted (core dumped)
    make[2]: *** Deleting file `libgcc.a'
    make[2]: Leaving directory `/tmp/mipsel-unknown-linux-gnu-toolchain/build-gcc-bootstrap/gcc'
    make[1]: *** [libgcc.a] Error 2
    make[1]: Leaving directory `/tmp/mipsel-unknown-linux-gnu-toolchain/build-gcc-bootstrap/gcc'
    make: *** [all-gcc] Error 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •