Raspberry cross-compiling

Posted: agosto 9th, 2014 | Author: | Filed under: English, Guide, Linux, Programmazione | Tags: , , , , , , , , , , , | No Comments »

I want to cross-compile some stuff for my Raspberry, this is a (memo for me) tutorial to do that.

  1. Take crosstool-ng from herehere or here (the last two are mirror, use them only if the official website is not working)
  2. you need some dependencies:
    apt-get install gcc gperf bison flex gawk libtool automake libncurses5-dev
  3. go into the crosstool-ng directory and:
    cpct-ng.comp /etc/bash_completion.d/
  4. after I setup some bash vars in my .bashrc:
    export WORKSPACE=~/workspace
    export RASPBERRY=$WORKSPACE/raspberry
    export CROSS_INST_PATH=$RASPBERRY/crosstool-ng/installer/
    export PATH="$PATH:$CROSS_INST_PATH/bin"
  5. and after to use them:
    source ~/.bashrc
  6. go into path_where_to_put_the_files and:
    ct-ng menuconfig
  7. the important options are:
    • Paths and misc options
      • (Important) Enable “Try features marked as EXPERIMENTAL
      • (Optional) Change “Prefix directory” (for example, you can put “$RASPBERRY/crosstool-ng/x-tools/${CT_TARGET}” there)
    • Target options
      • (Important) Change “Target architecture” to “arm
      • (Important) Leave “Endianness” set to “Little endian
      • (Important) Leave “Bitness” set to “32-bit
    • Toolchain options
      • (Nothing to do here, the defaults are fine)
    • Operating system
      • (Important) Change “Target OS” to “linux
    • Binary utilities
      • (Optional) Change “binutils version” to “2.21.1a” or whichever is the latest that isn’t marked as experimental
    • C compiler
      • (Optional)”Show Linaro versions (EXPERIMENTAL)“. In the “gcc version” field, choose the “linaro-4.6-2012.04 (EXPERIMENTAL) compiler“. You’re free to choose a different one but this one works well. We do recommend the Linaro versions over the vanilla ones for the RPi
      • (Optional) Enable “C++” under the group “*** Additional supported languages: ***” if you need g++ tool also built for your RPi toolchain
  8. build the tool:
    ct-ng build
  9. after I setup some others bash vars (these is the final file):
    export WORKSPACE=~/workspace
    export RASPBERRY=$WORKSPACE/raspberry
    export CROSS_CC_PATH=$RASPBERRY/crosstool-ng/x-tools/arm-unknown-linux-gnueabi/
    export CROSS_INST_PATH=$RASPBERRY/crosstool-ng/installer/
  10. after you are ready to compile, an example:
    ./autogen.sh --with-parameter-expansion-string-replace-capable-shell=/bin/bash --host=arm-unknown-linux-gnueabi --enable-static --prefix=$RASPBERRY/compile





Leave a Reply

  • Articoli Recenti:

  • Tag

  • Categorie

  • Meta

  • Licenza Creative Commons

    Copyright © 2020, | ldlabs.org – Blog is proudly powered by WordPress All rights Reserved | Theme by Ryan McNair modified By Francesco Apollonio

    Smilla Magazine Il Bloggatore iwinuxfeed.altervista.org Feedelissimo - tecnologia WebShake - tecnologia