linux下mips裸机编译,在ubuntu下动手编译arm-elf工具

这是一个用于构建ARM-Elf工具链的bash脚本,包括binutils、gcc、gdb和newlib的源文件路径及配置参数。脚本首先设定工作目录,然后进行解压、配置、编译和安装步骤,最终将交叉编译工具添加到PATH环境变量中。
摘要由CSDN通过智能技术生成

#!/bin/bash

# Brif: This is the scrip for build arm-elf tools.

# Source file: binutils-2.17.tar.bz2,gcc-4.1.1.tar.bz2,gdb-6.6.tar.bz2,newlib-1.14.0.tar.gz

#

# Notes: Please run this script with the root account or you can run "sudo bash"

#           Express all the compressed file to WORK_PWD below

#

# Author: Volans Wang

#         volansw@gmail.com

#

#source directory and target director

WORK_PWD=$(pwd)

echo $WORK_PWD

TARGET_PWD="/usr/local/arm/gnuarm4.1.1"

GCC_SOURCE="/home/volans/gcc4/gcc-4.1.1"

BINUTILS_SOURCE="/home/volans/gcc4/binutils-2.17"

LIB_SOURCE="/home/volans/gcc4/newlib-1.14.0"

GDB_SOURCE="/home/volans/gcc4/gdb-6.6"

#make configure

BINUTILS_CONFIG="--target=arm-elf --prefix=$TARGET_PWD --enable-interwork --enable-multilib --with-float=soft"

GCC_CONFIG="--target=arm-elf --prefix=$TARGET_PWD --enable-interwork --enable-multilib --enable-languages=c,c++ --with-newlib --with-headers=$LIB_SOURCE/newlib/libc/include --with-float=soft"

LIB_CONFIG=$BINUTILS_CONFIG

GDB_CONFIG=$BINUTILS_CONFIG

#export the cross compiler to the PATH

export PATH="$PATH:$TARGET_PWD/bin"

#make target dir for install if possible

if [ -d $TARGET_PWD ]; then

rm -rf $TARGET_PWD

mkdir $TARGET_PWD

else

mkdir $TARGET_PWD

fi

######## make binutils #########################

cd $BINUTILS_SOURCE

#configure

./configure $BINUTILS_CONFIG

#make

make all install

#################################################

######### make gcc for build new lib ############

cd $GCC_SOURCE

#configure

./configure $GCC_CONFIG

#make

make all-gcc install-gcc

#################################################

########## make new lib #########################

cd $LIB_SOURCE

#configure

./configure $LIB_CONFIG

#make

make all install

#################################################

######## make all gcc ###########################

cd $GCC_SOURCE

make all install

#################################################

######### make gdb ##############################

cd $GDB_SOURCE

#configure

./configure $GDB_CONFIG

make all install

#################################################

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值