建立OPENWRT交叉编译环境

转载 2013年12月04日 13:23:15

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 – Usage
  • Locate the toolchain binaries in the staging_dir/toolchain-architecture_gcc-compilerver_uClibc-libcver/bin/ directory
  • Add that directory to the PATH environment variable:
    • PATH=$PATH:(your toolchain/bin directory here)
    • export PATH
  • Set the STAGING_DIR environment 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 CC and LD environment 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 CFLAGS and LDFLAGS to point to thestaging_dir/target-architecture_uClibc-libcver/usr/include and …/usr/lib directories
  • 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_PATH on 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 

Openwrt交叉编译环境使用总结.pdf

  • 2014年07月29日 12:01
  • 534KB
  • 下载

OpenWrt搭建编译环境编译交叉编译工具

搭建编译环境编译OpenWrt需要Linux环境或mac环境

Linux交叉编译环境的建立

  • 2015年07月29日 19:12
  • 87KB
  • 下载

在Debian里建立交叉编译环境(cross-compiler)

嵌入式开发很重要的一步就是建立自己的交叉编译环境,也就是在宿主机器上编译生成目标机器上的执行代码。比如在i386机器上装有 Linux操作系统,在ARM板子上装着嵌入式系统,比如Linux;要在板子...

交叉编译环境的建立与测试

  • 2011年07月14日 13:03
  • 55KB
  • 下载

建立arm-linux-gcc交叉编译环境

  • 2011年08月04日 11:01
  • 148KB
  • 下载

Zedboard CrossCompile Linux 交叉编译环境建立

楼主也是刚涉及这部分,所以写错的地方欢迎大家指正。 交叉编译环境简单的说不过就是想在一个系统下编译另一个系统要使用的可执行文件。因此在通过PC机(虚拟机)开发ARM系统时是必要的。 下面开始讲...

uclinux交叉编译环境的建立

  • 2008年03月01日 21:56
  • 2.59MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:建立OPENWRT交叉编译环境
举报原因:
原因补充:

(最多只允许输入30个字)