建立OPENWRT交叉编译环境
2013-12-04 13:23
363 查看
Cross Compile
If you want to use a program,currently not contained in the OpenWrt repository, you probably won't find a binary compiled for your CPU. Provided that it is released as open source, you can download the code and compile it using the OpenWrt
Buildroot.
Note that not every code is compilable for every CPU architecture. Also performance on embedded systems is limited compared to ordinary computers.
Procedure
Follow the build instructions outlined in OpenWrt Buildroot – UsageLocate the toolchain binaries in the
staging_dir/toolchain-architecture_gcc-compilerver_uClibc-libcver/bin/directory
Add that directory to the
PATHenvironment variable:
PATH=$PATH:(your toolchain/bin directory here)
export PATH
Set the
STAGING_DIRenvironment variable to the above toolchain dir and export it:
STAGING_DIR=(your toolchain directory here)
export STAGING_DIR
Download and unpack the code to be compiled, change into the unpacked directory
Pass the host to the build system of the package to compile
For GNU configure, use
--host=architecture-openwrt-linux-uclibc(for example:
mips-openwrt-linux-uclibc)
For GNU make, override the
CCand
LDenvironment variables (usually
not needed if GNU configure was used)
make CC=architecture-openwrt-linux-uclibc-gcc
LD=architecture-openwrt-linux-uclibc-ld
If compilation aborts due to missing header files or shared objects, you might need to override
CFLAGSand
LDFLAGSto
point to the
staging_dir/target-architecture_uClibc-libcver/usr/includeand
…/usr/libdirectories
Debugging requires gdb in the toolchain. Default config does not include it. Include using
make menuconfig. [Advanced configuration options→Toolchain
Options→Build gdb]
Remote debugging can be done using script
./scripts/remote-gdb
When compilation is finished, copy the resulting binary and realted libraries to the target device to test it. It might be necessary to set
LD_LIBRARY_PATHon the target to point the binary
to libraries in nonstandard locations.
If the program works well enough, you maybe want to build a real package for the opkg package manager and make it easily accessible for everyone out there. See Creating
your own packages and Using Dependencies for further information on that.
转载自:http://wiki.openwrt.org/doc/devel/crosscompile
相关文章推荐
- Ubuntu下建立openwrt-linux交叉编译环境
- ubuntu12.04建立交叉编译环境开发openwrt
- GNU交叉编译环境的建立
- 移植qt-4.8.5至 mini2440建立交叉编译及qt运行环境
- 用crosstool-ng建立Linux 交叉编译环境
- 嵌入式学习——建立交叉编译环境 【1】
- 嵌入式Linux实战篇--交叉编译环境的建立(基于ubuntu 8.10)
- arm-linux交叉编译环境的建立
- Ubuntu 9.10上建立ARM-Linux交叉编译环境
- 在 Fedora 下建立 ARM-Linux 交叉编译环境
- 基于Eclipse的交叉编译环境的建立
- Ubuntu下建立qt4的交叉编译环境
- 建立交叉编译环境和在开发板上实现第一个嵌入式Linux应用程序
- 【转】sourcery g++ lite 建立交叉编译环境
- qtopia-free-src-2.2.0交叉编译环境的建立
- arm-linux-gcc-4.4.3交叉编译环境建立
- 如何为嵌入式开发建立交叉编译环境
- OANET(三):建立arm-linux交叉编译环境
- 建立交叉编译环境arm-linux-gcc-4.3.2
- 如何为嵌入式开发建立交叉编译环境