Didj crosstool-NG Build Environment

From eLinux.org
Revision as of 04:10, 18 July 2010 by Nirvous (Talk | contribs)

Jump to: navigation, search

Background

I have used these instuctions in the past to successfully build toolchains for Didj. They are based on instructions I originally found at http://blog.leshak.ru/english/pages/how-to-build-cross-toolchain-arm-uclibc-eabi-using-crosstool-ng/

(That site was not responding as of this writing).

Download and unpack crosstool-NG (latest version 1.7.1 as of 17 July 2010)

 cd ~
 wget http://ymorin.is-a-geek.org/download/crosstool-ng/crosstool-ng-1.7.1.tar.bz2
 tar -xjvf crosstool-ng-1.7.1.tar.bz2
 cd crosstool-ng-1.7.1

Configure and install

 ./configure --prefix=$HOME/ctng
 make
 make install

Add the path to the ct-ng

 export PATH=$PATH:$HOME/ctng/bin

Create a temporary folder for the assembly of the package

 cd ~
 mkdir toolchain-build
 cd toolchain-build

Copy preconfigure config files

 cp ../ctng/lib/ct-ng-1.7.1/samples/arm-unknown-linux-uclibcgnueabi/* .
 mv crosstool.config .config

If necessary, you can change the configuration

ct-ng menuconfig

You can usually just change the path to the cross-toolchain

nano .config


Configure CT_PREFIX_DIR

CT_PREFIX_DIR="/opt/ctng"

Run the compilation, get a coffee - have lunch, etc. (after “.” You can specify the number of concurrently running tasks, I set = number of cores in my system)

ct-ng build.4

An example log of a successful compilation: (There is one more step after this finishes)

 $ ct-ng build.4
 [INFO ]  Build started 20090406.091909
 [INFO ]  Checking environment sanity
 [INFO ]  Building environment variables
 [WARN ]  Directory '/home/dev/src' does not exist. Will not save downloaded tarballs to local storage.
 [EXTRA]  Preparing working directories
 [WARN ]  You did not specify the build system. That's OK, I can guess...
 [EXTRA]  Installing user-supplied crosstool-NG configuration
 [EXTRA]  =================================================================
 [EXTRA]  Dumping internal crosstool-NG configuration
 [EXTRA]    Building a toolchain for:
 [EXTRA]      build  = i486-linux-gnu
 [EXTRA]      host   = i486-linux-gnu
 [EXTRA]      target = arm-unknown-linux-uclibcgnueabi
 [EXTRA]  Dumping internal crosstool-NG configuration: done in 0.06s (at 00:01)
 [INFO ]  =================================================================
 [INFO ]  Retrieving needed toolchain components' tarballs
 [EXTRA]    Retrieving 'linux-2.6.26.8'
 [EXTRA]    Retrieving 'gmp-4.2.4'
 [EXTRA]    Retrieving 'mpfr-2.3.2'
 [EXTRA]    Retrieving 'binutils-2.19'
 [EXTRA]    Retrieving 'gcc-4.3.2'
 [EXTRA]    Retrieving 'uClibc-0.9.30'
 [EXTRA]    Retrieving 'libelf-0.8.10'
 [EXTRA]    Retrieving 'sstrip'
 [EXTRA]    Retrieving 'dmalloc-5.5.2'
 [EXTRA]    Retrieving 'duma_2_5_14'
 [EXTRA]    Retrieving 'gdb-6.8'
 [EXTRA]    Retrieving 'ncurses-5.6'
 [EXTRA]    Retrieving 'ltrace_0.5.orig'
 [EXTRA]    Retrieving 'strace-4.5.17'
 [INFO ]  Retrieving needed toolchain components' tarballs: done in 762.14s (at 12:43)
 [INFO ]  =================================================================
 [INFO ]  Extracting and patching toolchain components
 [EXTRA]    Extracting and patching 'linux-2.6.26.8'
 [EXTRA]    Extracting and patching 'gmp-4.2.4'
 [EXTRA]    Extracting and patching 'mpfr-2.3.2'
 [EXTRA]    Extracting and patching 'binutils-2.19'
 [EXTRA]    Extracting and patching 'gcc-4.3.2'
 [EXTRA]    Extracting and patching 'uClibc-0.9.30'
 [EXTRA]    Extracting and patching 'libelf-0.8.10'
 [EXTRA]    Extracting and patching 'dmalloc-5.5.2'
 [EXTRA]    Extracting and patching 'duma-2_5_14'
 [EXTRA]    Extracting and patching 'gdb-6.8'
 [EXTRA]    Extracting and patching 'ncurses-5.6'
 [EXTRA]    Extracting and patching 'ltrace-0.5'
 [EXTRA]    Extracting and patching 'strace-4.5.17'
 [INFO ]  Extracting and patching toolchain components: done in 98.05s (at 14:21)
 [INFO ]  =================================================================
 [INFO ]  Checking C library configuration
 [EXTRA]    Munging uClibc configuration
 [INFO ]  Checking C library configuration: done in 0.14s (at 14:21)
 [INFO ]  =================================================================
 [INFO ]  Installing kernel headers
 [EXTRA]    Installing kernel headers
 [EXTRA]    Checking installed headers
 [INFO ]  Installing kernel headers: done in 20.49s (at 14:42)
 [INFO ]  =================================================================
 [INFO ]  Installing GMP
 [EXTRA]    Configuring GMP
 [EXTRA]    Building GMP
 [EXTRA]    Checking GMP
 [EXTRA]    Installing GMP
 [INFO ]  Installing GMP: done in 39.33s (at 15:21)
 [INFO ]  =================================================================
 [INFO ]  Installing MPFR
 [EXTRA]    Configuring MPFR
 [EXTRA]    Building MPFR
 [EXTRA]    Checking MPFR
 [EXTRA]    Installing MPFR
 [INFO ]  Installing MPFR: done in 35.88s (at 15:57)
 [INFO ]  =================================================================
 [INFO ]  Installing binutils
 [EXTRA]    Configuring binutils
 [EXTRA]    Building binutils
 [EXTRA]    Installing binutils
 [INFO ]  Installing binutils: done in 34.51s (at 16:31)
 [INFO ]  =================================================================
 [INFO ]  Installing C library headers
 [EXTRA]    Copying sources to build dir
 [EXTRA]    Applying configuration
 [EXTRA]    Building headers
 [EXTRA]    Installing headers
 [INFO ]  Installing C library headers: done in 6.29s (at 16:38)
 [INFO ]  =================================================================
 [INFO ]  Installing static core C compiler
 [EXTRA]    Configuring static core C compiler
 [EXTRA]    Building static core C compiler
 [EXTRA]    Installing static core C compiler
 [INFO ]  Installing static core C compiler: done in 92.64s (at 18:10)
 [INFO ]  =================================================================
 [INFO ]  Installing C library
 [EXTRA]    Copying sources to build dir
 [EXTRA]    Applying configuration
 [EXTRA]    Building C library
 [EXTRA]    Installing C library
 [INFO ]  Installing C library: done in 76.73s (at 19:27)
 [INFO ]  =================================================================
 [INFO ]  Installing final compiler
 [EXTRA]    Configuring final compiler
 [EXTRA]    Building final compiler
 [EXTRA]    Installing final compiler
 [INFO ]  Installing final compiler: done in 1408.53s (at 42:56)
 [INFO ]  =================================================================
 [INFO ]  Finishing C library
 [EXTRA]    Copying sources to build dir
 [EXTRA]    Applying configuration
 [EXTRA]    Installing C library host utils
 [INFO ]  Finishing C library: done in 7.85s (at 43:04)
 [INFO ]  =================================================================
 [INFO ]  Installing GMP for the target
 [EXTRA]    Configuring GMP
 [EXTRA]    Building GMP
 [EXTRA]    Installing GMP
 [INFO ]  Installing GMP for the target: done in 27.50s (at 43:31)
 [INFO ]  =================================================================
 [INFO ]  Installing MPFR for the target
 [EXTRA]    Configuring MPFR
 [EXTRA]    Building MPFR
 [EXTRA]    Installing MPFR
 [INFO ]  Installing MPFR for the target: done in 12.29s (at 43:44)
 [INFO ]  =================================================================
 [INFO ]  Installing binutils for target
 [EXTRA]    Configuring binutils for target
 [EXTRA]    Building binutils' libraries (libiberty bfd) for target
 [EXTRA]    Installing binutils' libraries (libiberty bfd) for target
 [INFO ]  Installing binutils for target: done in 46.33s (at 44:30)
 [INFO ]  =================================================================
 [INFO ]  Installing libelf
 [EXTRA]    Configuring libelf
 [EXTRA]    Building libelf
 [EXTRA]    Installing libelf
 [INFO ]  Installing libelf: done in 10.04s (at 44:40)
 [INFO ]  =================================================================
 [INFO ]  Installing sstrip
 [EXTRA]    Building sstrip
 [EXTRA]    Installing sstrip
 [INFO ]  Installing sstrip: done in 0.17s (at 44:40)
 [INFO ]  =================================================================
 [INFO ]  Installing dmalloc
 [EXTRA]    Configuring dmalloc
 [EXTRA]    Building dmalloc
 [EXTRA]    Installing dmalloc
 [INFO ]  Installing dmalloc: done in 6.88s (at 44:47)
 [INFO ]  =================================================================
 [INFO ]  Installing D.U.M.A.
 [EXTRA]    Copying sources
 [EXTRA]    Building libraries 'libduma.a libduma.so.0.0.0'
 [EXTRA]    Installing libraries 'libduma.a libduma.so.0.0.0'
 [EXTRA]    Installing shared library link
 [EXTRA]    Installing wrapper script
 [INFO ]  Installing D.U.M.A.: done in 1.72s (at 44:49)
 [INFO ]  =================================================================
 [INFO ]  Installing cross-gdb
 [EXTRA]    Configuring cross-gdb
 [EXTRA]    Building cross-gdb
 [EXTRA]    Installing cross-gdb
 [INFO ]  Installing cross-gdb: done in 90.94s (at 46:20)
 [INFO ]  =================================================================
 [INFO ]  Installing native gdb
 [INFO ]    =================================================================
 [INFO ]    Installing ncurses library
 [EXTRA]      Configuring ncurses
 [EXTRA]      Building ncurses
 [EXTRA]      Installing ncurses
 [INFO ]    Installing ncurses library: done in 61.44s (at 47:21)
 [EXTRA]    Configuring native gdb
 [EXTRA]    Building native gdb
 [EXTRA]    Installing native gdb
 [INFO ]  Installing native gdb: done in 170.15s (at 49:10)
 [INFO ]  =================================================================
 [INFO ]  Installing gdbserver
 [EXTRA]    Configuring gdbserver
 [EXTRA]    Building gdbserver
 [EXTRA]    Installing gdbserver
 [INFO ]  Installing gdbserver: done in 5.70s (at 49:16)
 [INFO ]  =================================================================
 [INFO ]  Installing ltrace
 [EXTRA]    Copying sources to build dir
 [EXTRA]    Configuring ltrace
 [EXTRA]    Building ltrace
 [EXTRA]    Installing ltrace
 [INFO ]  Installing ltrace: done in 5.10s (at 49:21)
 [INFO ]  =================================================================
 [INFO ]  Installing strace
 [EXTRA]    Configuring strace
 [EXTRA]    Building strace
 [EXTRA]    Installing strace
 [INFO ]  Installing strace: done in 15.81s (at 49:37)
 [INFO ]  =================================================================
 [EXTRA]  Installing the populate helper
 [EXTRA]  Creating toolchain aliases
 [INFO ]  Removing installed documentation
 [INFO ]  Build completed at 20090406.100846
 [INFO ]  (elapsed: 49:36.55)
 [INFO ]  Finishing installation (may take a few seconds)...
 [49:37] $

Last step: Create a file named 'crosscompile' with the contents below. Whenever you want to compile anything for the device, enter 'source crosscompile' first to set the environment variables.

 export ARCH=arm
 export CC=arm-linux-uclibcgnueabi-gcc
 export CXX=arm-linux-uclibcgnueabi-gcc
 export CROSS_COMPILE=arm-linux-uclibcgnueabi-
 export PATH=/opt/ctng/bin:$PATH
 export PROJECT_PATH=[YOUR PATH TO THE SOURCE TREE]/Didj-Linux-4222-20090422-1236
 export TARGET_MACH=LF_LF1000
 export ROOTFS_PATH=[YOUR PATH TO THE SOURCE TREE]/Didj-Linux-4222-20090422-1236/target/didj-rootfs
 export RELEASE_PATH=[YOUR PATH TO THE SOURCE TREE]/Didj-Linux-4222-20090422-1236/target/release
 export TFTP_PATH=[YOUR PATH TO THE SOURCE TREE]/Didj-Linux-4222-20090422-1236/target/tftp
 export EROOTFS_PATH=[YOUR PATH TO THE SOURCE TREE]]/Didj-Linux-4222-20090422-1236/target/erootfs.stage