Page 1 of 4 123 ... LastLast
Results 1 to 15 of 53

Thread: gcc 3.3.4 toolchain and 7.2 kernel build scripts

  1. #1
    Join Date
    Aug 2004
    Posts
    4,085

    gcc 3.3.4 toolchain and 7.2 kernel build scripts

    Here's some scripts to build a gcc-3.3.4 mips toolchain and to build the 7.2 tivo kernels from source using that toolchain. Works for me on fedora core 4. YMMV. Please read and understand the scripts and tweak appropriately for your environment.

    The build_mips_x_compiler.sh script is based on the one from http://tivoutils.sourceforge.net.

    The toolchain installs in /usr/local/mips-tivo72. That directory needs to be writable by the user running the build_mips_x_compiler.sh script.

    The build_kernel.sh script builds both a Series2 and Gen04 kernel. These can be used directly on a PROM modded tivo, or as monte target kernels. Do not copy the kernels directly to your kernel partition unless you have a PROM mod. If you don't understand this, read up on the chain of trust.

    You might want to add ADH's mems= patch if the kernel may be used on a box with upgraded memory.

    My kernel configs add EXT3 and turn off NETFILTER and BLK_DEV_INITRD. Adjust to taste. Without NETFILTER, iptables won't work, but it does improve network performance.
    Attached Files Attached Files
    Last edited by Jamie; 01-29-2006 at 09:46 PM. Reason: replace attachment with one that works under cygwin

  2. #2
    Join Date
    Dec 2005
    Posts
    5
    FYI - build_mips_x_compiler.sh script on sourceforge didn't work on my linux box, but this one does. It might have something to do with the base toolchain on my machine (gentoo/current on amd64 - gcc 3.4.4, binutils 2.16 with kernel 2.6.14)

    I'm not using it for rebuilding the tivo kernel, but no problems with busybox or other random things I've tried to compile.

  3. #3
    Join Date
    Aug 2004
    Posts
    4,085
    I replace the attachment in the first post with a new version that also works under the current version of cygwin. This allows you to build a tivo cross-compilation toolchain and custom kernels within cygwin.

  4. #4
    Join Date
    Nov 2004
    Location
    Gurnee, IL
    Posts
    2,385
    Thank you very much, Jamie...built without error, and I successfully compiled a "Hello world" program to make sure it's building the right target, etc.

    Very cool! Now to cause real trouble...compiling my own kernel when I have no f'ing idea what I'm doing.
    --
    Christopher D. Heer
    Quote Originally Posted by Oscar Wilde
    Perhaps, after all, America never has been discovered. I myself would say that it had merely been detected.

  5. #5
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    427
    Thanks Jamie. I had been trying for weeks to build a mips cross-compiler on Cygwin using various incarnations of the tmesis build script, but never made it past the INSIGHT build (looks like cheer figured out the issue there). I gave your gcc-3.3.4 toolchain script a whirl, but it's failing the final gcc build. The problems seem to start with this:
    Code:
    ../../gcc-3.3.4/gcc/unwind-pe.h:78: warning: implicit declaration of function `abort'
    In file included from gthr-default.h:1,
                     from ../../gcc-3.3.4/gcc/gthr.h:98,
                     from ../../gcc-3.3.4/gcc/unwind-dw2.c:31:
    ../../gcc-3.3.4/gcc/gthr-posix.h:37:21: pthread.h: No such file or directory
    ../../gcc-3.3.4/gcc/gthr-posix.h:38:20: unistd.h: No such file or directory
    .

    More output is attached. I'm using a full Cygwin install. Any nudge in the right direction is appreciated.
    Attached Files Attached Files

  6. #6
    Join Date
    Aug 2004
    Posts
    4,085
    Quote Originally Posted by rbautch
    Thanks Jamie. I had been trying for weeks to build a mips cross-compiler on Cygwin using various incarnations of the tmesis build script, but never made it past the INSIGHT build (looks like cheer figured out the issue there). ...[/CODE].

    More output is attached. I'm using a full Cygwin install. Any nudge in the right direction is appreciated.
    You didn't post enough of the log. Post the entire build log. I know it's large, but I'll bet it will be under the attachment size limit if you compress it.

    Your build looks to be in the second stage of building gcc, after building glibc. My guess is that the glibc build failed, but the script keeps going anyway. I've seen that before. The last time, I tracked it down to an assumption in the glibc script that assumed a case sensitive file system (.oS and .os needed to be distinct file extensions). I fixed that problem, but apparently your build is still failing at the glibc stage for some other reason.

    It did work for me under the very latest cygwin last week... You might update all your cygwin packages to the latest version and try again. Here's the information on the cygwin build I'm using:
    Code:
     % uname -srvmp
    CYGWIN_NT-5.1 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 unknown
    
    % gcc -v
    Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
    Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc --enable-nls --without-included-gettext --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstdcxx-debug : (reconfigured) 
    Thread model: posix
    gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
    Last edited by Jamie; 02-06-2006 at 10:22 PM.

  7. #7
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    427
    Full log is attached. Here is my build information:

    Code:
     $ uname -srvmp
    CYGWIN_NT-5.1 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 unknown
    
    $ gcc -v
    Reading specs from /usr/lib/gcc/i686-pc-cygwin/3.4.4/specs
    Configured with: /gcc/gcc-3.4.4/gcc-3.4.4-1/configure --verbose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir
    =/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-languages=c,ada,c++,d,f77,java,objc --enable-nls --without-included-gettext
    --enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-awt --with-system-zlib --enable-interpreter --disable-libgcj-de
    bug --enable-threads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptions --enable-hash-synchronization --enable-libstd
    cxx-debug : (reconfigured)
    Thread model: posix
    gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)
    Attached Files Attached Files

  8. #8
    Join Date
    Aug 2004
    Posts
    4,085
    Quote Originally Posted by rbautch
    Full log is attached. Here is my build information:
    Here's the relevant error:
    Code:
    **** patching devenv ****
    ./chmod build_mips_x_compiler.sh: line 84: devenv-oS.patch: No such file or directory
    This is the code in the script that's failing:
    echo "**** patching devenv ****"
    patch -p0 < devenv-oS.patch
    Not sure where the "./chmod" is coming from -- that's not from the script. Are you sure the devenv-oS.patch file is in the same directory with the build_mips_x_compiler.sh script? Do you have the cygwin "patch-2.5.8-8" package installed? I see:
    Code:
     % patch --version
    patch 2.5.8
    ...
    How are you invoking the script?
    Last edited by Jamie; 02-07-2006 at 01:45 AM.

  9. #9
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    427
    Quote Originally Posted by Jamie
    Here's the relevant error:
    Code:
    **** patching devenv ****
    ./chmod build_mips_x_compiler.sh: line 84: devenv-oS.patch: No such file or directory
    This is the code in the script that's failing:Not sure where the "./chmod" is coming from -- that's not from the script. Are you sure the devenv-oS.patch file is in the same directory with the build_mips_x_compiler.sh script? Do you have the cygwin "patch-2.5.8-8" package installed? I see:
    Code:
     % patch --version
    patch 2.5.8
    ...
    How are you invoking the script?
    I got a few permission denied errors early on, so I added a few chmod commands to the script to fix it. I renamed the script with the chmod prefix to distinguish it from the original. I'm ashamed to say I did not have the patch in the same directory as the script. Put it there, and the script ran with out error. Thanks again for this useful script!

  10. #10
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    427
    I was able to successfully compile the small "Hello world!" program. However, I'm having trouble compiling anything with a configure script. I set the following variables in my /etc/profile:
    Code:
    export PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/mips-tivo72/mips-TiVo-linux/bin
    export LIBRARY_PATH=/usr/local/mips-tivo72/lib
    export CC=mips-TiVo-linux-gcc
    I run configure scripts with the following switches:
    Code:
    ./configure --host=mips-TiVo-linux --build=mips-TiVo-linux --prefix=/usr/local/mips-tivo72
    Here are the errors I get from the config.log:
    Code:
    configure:1791: checking for mips-TiVo-linux-gcc
    configure:1817: result: mips-TiVo-linux-gcc
    configure:2099: checking for C compiler version
    configure:2102: mips-TiVo-linux-gcc --version </dev/null >&5
    ./configure: line 2103: mips-TiVo-linux-gcc: command not found
    configure:2105: $? = 127
    configure:2107: mips-TiVo-linux-gcc -v </dev/null >&5
    ./configure: line 2108: mips-TiVo-linux-gcc: command not found
    configure:2110: $? = 127
    configure:2112: mips-TiVo-linux-gcc -V </dev/null >&5
    ./configure: line 2113: mips-TiVo-linux-gcc: command not found
    configure:2115: $? = 127
    configure:2138: checking for C compiler default output file name
    configure:2141: mips-TiVo-linux-gcc    conftest.c  >&5
    ./configure: line 2142: mips-TiVo-linux-gcc: command not found
    configure:2144: $? = 127
    configure: failed program was:
    | /* confdefs.h.  */
    What am I missing?

  11. #11
    Join Date
    Aug 2004
    Posts
    4,085
    Quote Originally Posted by rbautch
    What am I missing?
    Looks like mips-TiVo-linux-gcc isn't on your path. It should be in /usr/local/mips-tivo72. It seems that you put /usr/local/mips-tivo72/mips-TiVo-linux/bin on your path instead.

    Check out the build_mips_x_compiler.sh script. It uses configure to build glibc and gcc itself, so you should be able to extract the right environment settings from it.

  12. #12
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    427
    Thanks Jamie. I exported the same environmental variables as the build_mips_x_compiler.sh script. Got a little further, but now I'm stuck here:
    Code:
    configure:2216: mips-TiVo-linux-gcc -v </dev/null >&5
    Reading specs from /usr/local/mips-tivo72/lib/gcc-lib/mips-TiVo-linux/3.3.4/specs
    Configured with: ../gcc-3.3.4/configure --target=mips-TiVo-linux --prefix=/usr/local/mips-tivo72 --enable-languages=c,c++
    Thread model: posix
    gcc version 3.3.4
    configure:2219: $? = 0
    configure:2221: mips-TiVo-linux-gcc -V </dev/null >&5
    mips-TiVo-linux-gcc: `-V' option must have argument
    configure:2224: $? = 1
    configure:2247: checking for C compiler default output file name
    configure:2250: mips-TiVo-linux-gcc    conftest.c  >&5
    configure:2253: $? = 0
    configure:2299: result: a.out
    configure:2304: checking whether the C compiler works
    configure:2310: ./a.out
    ./a.out: ./a.out: cannot execute binary file
    configure:2313: $? = 126
    configure:2322: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.

  13. #13
    Join Date
    Aug 2004
    Posts
    4,085
    Quote Originally Posted by rbautch
    Thanks Jamie. I exported the same environmental variables as the build_mips_x_compiler.sh script. Got a little further, but now I'm stuck here:
    It doesn't look like configure was invoked properly for building with a cross compiler. For example, it's trying to run executables created with the cross compiler on the build system.

    It may be that you are invoking configure incorrectly for a canadian cross, or it might be that the package you are configuring isn't setup to be cross-compiled.

    Another reference is the Goat Book, particularly the chapter on cross compilation.
    Last edited by Jamie; 02-19-2006 at 02:34 PM.

  14. #14
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    427
    Works! It was indeed how I was invoking the configure script. I used --build=mips-TiVo-linux, which was incorrect. Using --build=i686-pc-linux-gnu worked, as does does leaving out the --build argument altogether. Thanks for the references, they helped.

  15. #15
    Join Date
    Jul 2006
    Posts
    45

    Missing ansidecl.h

    When I am trying to run the script, I get the following error:

    Code:
    ...
    creating po/Makefile.in
    make[3]: Leaving directory `/var/toolchain/build-binutils/bfd/po'
    make[3]: Entering directory `/var/toolchain/build-binutils/bfd/po'
    make[3]: Nothing to be done for `all'.
    make[3]: Leaving directory `/var/toolchain/build-binutils/bfd/po'
    make[3]: Entering directory `/var/toolchain/build-binutils/bfd'
    rm -f bfd-tmp.h
    make[3]: *** No rule to make target `../../binutils-2.13/bfd/../include/ansidecl.h', needed by `archive.lo'.  Stop.
    make[3]: *** Waiting for unfinished jobs....
    cp bfd-in3.h bfd-tmp.h
    make[3]: *** Waiting for unfinished jobs....
    /bin/sh ../../binutils-2.13/bfd/../move-if-change bfd-tmp.h bfd.h
    make[3]: *** Waiting for unfinished jobs....
    rm -f bfd-tmp.h
    make[3]: *** Waiting for unfinished jobs....
    touch stmp-bfd-h
    make[3]: *** Waiting for unfinished jobs....
    make[3]: Leaving directory `/var/toolchain/build-binutils/bfd'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/var/toolchain/build-binutils/bfd'
    make[1]: *** [all-recursive-am] Error 2
    make[1]: Leaving directory `/var/toolchain/build-binutils/bfd'
    make: *** [all-bfd] Error 2
    **** binutils compile failed
    Am I missing some package or something?

    I ran this under cygwin on WinXP Pro box. Any guidance is very much appreciated.

    iMagic

Posting Permissions

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