How to install gcc-arm-linux-gnueabihf on Ubuntu 12.04

Toolchain
Jump to: navigation, search

The toolchain is a set of binaries, system libraries and tools which allow you to build (in our case, cross-compile) u-boot and the kernel for a target platform. This will, to some limited extent, need to match the target rootfs. A large and incompatible change has taken place recently, through the Hard Float ABI. Now, two different debian and ubuntu ports are binary incompatible with each other.
Contents

    1 Part of distributions
        1.1 Ubuntu
            1.1.1 Recent (from 12.04 on)
            1.1.2 Older
        1.2 Debian
    2 Standalone
        2.1 Linaro toolchain
        2.2 Code Sourcery
    3 External links

Part of distributions
Ubuntu
Recent (from 12.04 on)

A complete cross toolchain is available as a package, just run:

apt-get install gcc-arm-linux-gnueabihf

Older

For older versions, you need to use an external repository.

add-apt-repository ppa:linaro-maintainers/toolchain
apt-get update
apt-get install gcc-arm-linux-gnueabihf

Debian

To install Cross-development Toolchains for Debian follow the instructions on emdebian.org.
Note: Emdebian's armhf-toolchain is only available for Debian/unstable at the moment.

Edit your /etc/apt/sources.list as approriate and advised above:

deb http://www.emdebian.org/debian/ unstable main

Install Cross Compiler and build utilities:

apt-get install emdebian-archive-keyring
apt-get update
apt-get install gcc-4.7-arm-linux-gnueabihf

You might want additional tools for building a sunxi kernel that are not related to the cross-compiler:

apt-get install build-essential git debootstrap u-boot-tools

Create a ~/bin to store symlinks to specific version of the cross-compiler-tools so they are found by the kernel build system:

mkdir ~/bin
cd ~/bin
for i in /usr/bin/arm-linux-gnueabihf*-4.7 ; do j=${i##/usr/bin/}; ln -s $i ${j%%-4.7} ; done

Usually ~/bin is already included in $PATH, otherwise you will need to add these lines in your .profile:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Standalone

These standalone toolchains are big tarballs which come with everything you need.
Linaro toolchain

One option is to get a linaro released toolchain. Ignore most of the files there. Take the gcc-linaro-arm-linux-gnueabihf-4.7-{milestone}_linux.tar.xz file and untar it. You will find a bin directory in there. Temporarily add it to the environment you are building from:

export PATH="$PATH":/home/user/folder/gcc-linaro-arm-linux-gnueabihf-*_linux/bin/

Recent linaro toolchains are Hard Float (hf), which only runs us into one issue with u-boot. This will be used throughout the document. Wherever you see something like

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

Replace arm-linux-gnueabihf- with arm-linux-gnueabi- if your are not using a hardfloat toolchain.

WARNING: Do not use the 4.8 gcc versions of the linaro toolchain to build legacy kernels (sunxi-3.4 etc.), those seem to have issues building the kernel. Use an earlier version instead.
Code Sourcery

Another option is to install the Sourcery toolchain from Code Sourcery (now in Mentor Graphics). Download Code Sourcery G++ 2010 9-50 https://sourcery.mentor.com/sgpp/lite/arm/portal/release1600 (official link, email registration required)

Direct link: https://netst.org/pub/linux/ARM/CodeSourcery/arm-2010.09-50-arm-none-linux-gnueabi.bin (unofficial link)


chmod +x arm-2010.09-50-arm-none-linux-gnueabi.bin
./arm-2010.09-50-arm-none-linux-gnueabi.bin


If you are using Ubuntu, you may need to switch to use bash shell (instead of dash shell)

sudo dpkg-reconfigure -plow dash      ( then choose [No], this changes from using dash shell to using bash shell )


It will now install CodeSourcery with a GUI installer

Follow default settings and do Next , Next, Next, etc…

It should install in: ~/CodeSourcery/ ( for example: /home/penguin/CodeSourcery/ )

Make sure the CodeSourcery binaries are added to your path (if your username is penguin, then this should be correct):

echo "export PATH=~/CodeSourcery/Sourcery_G++_Lite/bin:\${PATH}" >> ~/.bashrc
export PATH=~/CodeSourcery/Sourcery_G++_Lite/bin:$PATH   (or you can just spawn a new terminal window to update the path)
echo $PATH  (make sure your path is updated)

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值