在Ubuntu中建立ARM開發環境

此頁由 Linux Wiki用戶Chenxing 於 2010年5月16日 (星期日) 05:09 的最後更改。

出自Linux Wiki

提示:此文已超过 13 年(5094 天)未更新,如发现内容过时或有误,欢迎改进:)

Ubuntu在小型移動設備中的應用越來越多。由於這些設備(如 智器)常使用與PC機不同的ARM架構,為他們開發軟件要建立專門的環境。

為了簡化開發和測試過程,Ubuntu從9.10開始提供靜態的ARM虛擬功能,可以直接在PC機上建立ARM機器的chroot環境[1],既可以編譯,也可以測試程序。相比於交叉編譯而言,這種方法雖然編譯速度較慢,但配置方便,還具備直接調試的功能。

先安裝Ubuntu提供的ARM虛擬程序:

sudo apt-get install qemu-arm-static debootstrap

接着,使用build-arm-chroot命令建立chroot系統:

build-arm-chroot karmic eabi-chroot

國內用戶可以考慮使用srt.cn的鏡像以加快速度:

build-arm-chroot karmic eabi-chroot http://ubuntu.srt.cn/ubuntu-ports/

建立chroot環境的腳本:

#!/bin/bash
DROOT= eabi-chroot的完整路径
mount --bind /dev $DROOT/dev
mount --bind /proc $DROOT/proc
mount --bind /sys $DROOT/sys
mount --bind /dev/pts $DROOT/dev/pts
cp /etc/resolv.conf $DROOT/etc/resolv.conf
chroot $DROOT

chroot成功後,使用

uname -a

可以觀察到架構的變化。此後,修改/etc/apt/sources.list,就可以按需裝軟件、開發程序了。

參考資料

  1. https://wiki.edubuntu.org/ARM/BuildEABIChroot

本文对您有帮助?分享给更多朋友!

反馈与讨论

发现文档不全面、有错误却没时间编辑文档?想分享自己的经验或见解?欢迎在此留言、讨论。
简体繁体转换