[置顶] 泰晓 RISC-V 实验箱,配套 30+ 讲嵌入式 Linux 系统开发公开课
[置顶] Linux Lab v1.4 升级部分内核到 v6.10,新增泰晓 RISC-V 实验箱支持,新增最小化内核配置支持大幅提升内核编译速度,在单终端内新增多窗口调试功能等Linux Lab 发布 v1.4 正式版,升级部分内核到 v6.10,新增泰晓实验箱支持
[置顶] 泰晓社区近日发布了一款儿童益智版 Linux 系统盘,集成了数十个教育类与益智游戏类开源软件国内首个儿童 Linux 系统来了,既可打字编程学习数理化,还能下棋研究数独提升智力
Install ARM toolchain from Android NDK
by falcon wuzhangjin@gmail.com of TinyLab.org 2013/11/24
Introduction
Android NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++, itincludes a set of cross-toolchains (compilers, linkers, etc..) that can generate native ARM binaries on Linux, OS X, and Windows (with Cygwin) platforms, here shows how to export this toolchain and use it standalonely.
Download Android NDK
At the time of this writing, the latest NDK version is r9b, download it:
$ wget -c http://dl.google.com/android/ndk/android-ndk-r9b-linux-`uname -m`.tar.bz2
Create Standalone Toolchain
Under android-ndk-r9b/toolchains/, all supported toolchains are listed. Here, for example, we install arm-linux-androideabi-4.7 into /opt/android-ndk-toolchain for Android 4.2.1:
$ sudo android-ndk-r9b/build/tools/make-standalone-toolchain.sh --platform=android-17 --system=linux-`uname -m` --toolchain=arm-linux-androideabi-4.7 --install-dir=/opt/android-ndk-toolchain/
$ sudo echo "export PATH=\$PATH:/opt/android-ndk-toolchain/bin" >> ~/.bashrc
$ source ~/.bashrc
Build Busybox with Android ARM Toolchain
Busybox is a very useful toolset, it includes lots of tiny Unix utilities and it’s more powerful than the Android toolbox, let’s compile it for Android.
$ wget -c http://www.busybox.net/downloads/busybox-1.21.1.tar.bz2
$ tar jxf busybox-1.21.1.tar.bz2 && cd busybox-1.21.1
$ make android2_defconfig
$ sed -i -e "s/CONFIG_UDHCPC=y/# CONFIG_UDHCPC is not set/g" .config
$ make -j10
$ file busybox
busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), stripped
The above sed command disable the udhcpc support to workaround the compiling failure. The above Busybox binary is able to be used on Android system directly, to learn more about Busybox using on Android system, the book: Optimizing Embedded Systems using BusyBox is recommended.
猜你喜欢:
- 我要投稿:发表原创技术文章,收获福利、挚友与行业影响力
- 知识星球:独家 Linux 实战经验与技巧,订阅「Linux知识星球」
- 视频频道:泰晓学院,B 站,发布各类 Linux 视频课
- 开源小店:欢迎光临泰晓科技自营店,购物支持泰晓原创
- 技术交流:Linux 用户技术交流微信群,联系微信号:tinylab
支付宝打赏 ¥9.68元 | 微信打赏 ¥9.68元 | |
请作者喝杯咖啡吧 |