Crosstool-ng

From Bashlinux
Revision as of 08:01, 28 May 2016 by Manpaz (talk | contribs) (Created page with "=== Install the toolchain === * Install dependencies # FEDORA yum -y install bison flex gperf libtool texinfo gcc gcc-c++ gmp-devel ncurses-devel # DEBIAN apt-get -y inst...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Install the toolchain

  • Install dependencies
# FEDORA
yum -y install bison flex gperf libtool texinfo gcc gcc-c++ gmp-devel ncurses-devel
# DEBIAN
apt-get -y install gcc gperf bison flex gawk  libtool automake libncurses5-dev texinfo
cd /usr/src
wget http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-x.y.z.tar.bz2
tar jxvf crosstool-ng-1.20.0.tar.bz2
cd crosstool-ng-1.20.0
  • Build the tool
mkdir -p /opt/crosstool-ng
chown -r nobody:nobody /opt/crosstool-ng
chmod g+w,g+s /opt/crosstool-ng
./configure --prefix=/opt/crosstool-ng
make && make install
  • Setup autocompletion
cp ct-ng.comp /etc/bash_completion.d/
  • Add crosstool's bin directory to the user's path
PATH=$PATH:/opt/crosstool-ng-1.20.0/bin

Configure the toolchain

  • Re-login as regular user, or source ~/.bash_profile
  • Setup the config directory
mkdir -p /opt/crosstool-ng/config
cd /opt/crosstool-ng/config
  • Run the configuration tool
ct-ng menuconfig
  • Setup the following Items
    • Paths and misc options
      • Enable Try features marked as EXPERIMENTAL"
      • Set the "Prefix directory" from "${HOME}/x-tools/${CT_TARGET}" to "/opt/crosstool-ng/tools/${CT_TARGET}", please note that the /opt/crosstool-ng/config directory will contain the configuration, downloaded tools, temporary build files and the /opt/crosstool-ng/tools will contain your actual toolchain.
    • Toolchain options
      • Change tuple's version string from the default "unknown" to "bashlinux"
    • Target options
      • Be sure that the "Target Architecture" is set to "arm"
      • Be sure that "Little Endian" and "32bit" are selected
      • Be sure that "Floating point" is set to "hardware (FPU)"
      • Be sure that "Use EABI" is selected
      • Be sure that "Append 'hf' to the tupe' is selected
    • Operating system
      • Set "Target OS" to Linux
    • C compiler
      • Enable "Show Linaro versions"
        • The "gcc version" should automatically change to latest linaro version, if not then set it manually. Currently the latest is "linaro-4.8-2014.01"
      • Enable "C++" in order to have C++ compiler
      • Disable "Link libstdc++ statically into gcc binary" otherwise you will get the the following error "[ERROR] Static linking impossible on the host system 'x86_64-build_unknown-linux-gnu'"
      • Disable "Enable GRAPHITE loop optimisations" otherwise you will get the the following error "Installing PPL for host [ERROR] configure: error: Cannot find GMP version 4.1.3 or higher."
  • Build the tool
ct-ng build
  • Append the PATH with the new tools
PATH=$PATH:/opt/crosstool-ng/tools/arm-bashlinux-linux-gnueabi/bin


REF: http://akanto.wordpress.com/2012/10/02/cross-compiling-kernel-for-raspberry-pi-on-fedora-17-part-2/