Ubuntu安裝交叉工具鏈

2021-05-27 13:13:26 字數 1696 閱讀 8659

(1)、通過

samba

目錄下解壓toolchains_for_s3c2410.tar.bz2:

tar  –jxvf   toolchains_for_s3c2410.tar.bz2

於是生成crosstool目錄,一般把它拷貝到根目錄

caoyi@ubuntu:/home$ ls

caoyi  crosstool  kernel  study  toolchains_for_s3c2410.tar.bz2

caoyi@ubuntu:/home$ sudo mv crosstool/ /

(2)、獲得交叉工具的絕對路徑

cd  crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin/

pwd命令獲取交叉工具鏈可執行檔案存放的絕對路徑

/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin

(3)、修改環境變數

path

的值caoyi@ubuntu:/home$

cd  ~  (當前使用者目錄,我的為:/home/caoyi)

caoyi@ubuntu:/home$

vim  .bashrc

在最後一行中新增:

export  path=$path: /crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin

儲存退出

或者 修改/etc/profile 

執行命令:vim /etc/profile

新增:export  path=$path: /opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux-gnu/bin

儲存退出

最後執行:source /etc/profile 

ok執行命令:source  ~/.bashrc

二、使用交叉工具鏈編譯

c**

(1)、 在/opt/filesystem

中新建乙個資料夾,專門用來存放交叉編譯後的可執行**

caoyi@ubuntu:/home$ cd  /rootfs/filesystem

caoyi@ubuntu:/rootfs/filesystem/$ sudo mkdir work

caoyi@ubuntu:/rootfs/filesystem/$  sudo chmod 777 -r work (注意要改變屬性,否則執行編譯會出現許可權問題)

caoyi@ubuntu:/home$ cd /rootfs/filesystem/work/

caoyi@ubuntu:/rootfs/filesystem/work$ sudo vim hello.c

caoyi@ubuntu:/rootfs/filesystem/work$ sudo arm-linux-gnu-gcc   hello.c –o  hello

caoyi@ubuntu:/rootfs/filesystem/work$ ls

hello  hello.c

(2)、

在開發板的終端中,即

putty

(串列埠),進入/work/目錄執行hello

# cd work

# ls

hello    hello.c

# ./hello

hello world!#

Ubuntu 安裝arm交叉工具鏈

筆者使用的是天嵌的eabi 4.3.3 embedsky 20100610.tar.bz2 1 先將其解壓,命令如下 sudo tar xvf eabi 4.3.3 embedsky 20100610.tar.bz2 c 2 然後修改path sudo vim etc bash.bashrc 3 增...

安裝交叉工具鏈

使用國嵌提供的工具包arm tools.tar.gz,首先解壓 tar xvzf arm tools.tar.gz cd arm tools tar xvzf arm linux gcc 4.3.2.tgz c 指定解壓到根目錄去 解壓到 usr local arm 4.3.2 還需修改環境變數 v...

安裝交叉工具鏈

本文以openwrt x86的工具鏈為例 製作openwrt 的工具鏈 參考 tar xvf openwrt toolchain x86 generic gcc 4.8 linaro uclibc 0.9 33.2 linux i686 tar.bz2cd openwrt toolchain x86...