zoukankan      html  css  js  c++  java
  • OpenWrt Buildroot – About 编译过程

    OpenWrt Buildroot is a set of Makefiles and patches that allows users to easily generate both a cross-compilation toolchain and a root filesystem for embedded systems. It is a heavily modified Buildroot. The cross-compilation toolchain uses uClibc, a tiny C standard library.

    A compilation toolchain is the set of tools used to compile code for your system. It consists of:

    ◾ a compiler (in our case, gcc / deb: gcc) ◾ binary utils like assembler and linker (in our case, binutils / deb: binutils ) ◾ a C standard library (for example GNU Libc, uClibc or dietlibc).

    Using a PC, the compilation toolchain runs on an x86 processor and generates code for a x86 processor. On most Linux systems, the compilation toolchain uses the GNU libc as C standard library. It is called the "host compilation toolchain", and the machine it is running on is called the "host system". The compilation toolchain is provided by the distribution, and has nothing to do with OpenWrt Buildroot.

    Embedded systems use a different processor and require a cross-compilation toolchain - a compilation toolchain that runs on a host system but that generates code for a target system (and target processor's instruction set architecture (ISA)). For example, if your host system uses x86 and your target system uses MIPS32, the regular compilation toolchain of your host runs on x86 and generates code for x86, while the cross-compilation toolchain runs on x86 and generates code for MIPS32.

    While it is possible to manually configure and compile your own software, OpenWrt Buildroot automates this process to work on the instruction set architecture of most embedded systems.

    While the OpenWrt Buildroot was designed for developers, inexperienced users can also use it to easily build their own custom firmware!

    The OpenWrt Makefile has its own syntax, different from the conventional Makefile of Linux make tool. The OpenWrt Makefile defines the meta information of the package, where to download the package, how to compile, where to install the compiled binaries, etc. See How to Build OpenWrt Application Package for more detail.

    OpenWrt Buildroot – Features ◾ Makes it easy to port software ◾ Uses kconfig (Linux Kernel menuconfig) for configuration of features ◾ Provides integrated cross-compiler toolchain (gcc, ld, …) ◾ Provides abstraction for autotools (automake, autoconf), cmake, scons ◾ Handles standard download, patch, configure, compile and packaging workflow ◾ Provides a number of common fixups for badly behaving packages

    OpenWrt Buildroot – Make Targets ◾ Offers a number of high level make targets for standard package workflows ◾ Targets always in the format "component/name/action", e.g. "toolchain/gdb/compile" or "package/mtd/install" ◾ Prepare a package source tree: package/foo/prepare ◾ Compile a package: package/foo/compile ◾ Clean a package: package/foo/clean

    OpenWrt Buildroot – Build sequence

    1. tools – automake, autoconf, sed, cmake
    2. toolchain/binutils – as, ld, …
    3. toolchain/gcc – gcc, g++, cpp, …
    4. target/linux – kernel modules
    5. package – core and feed packages
    6. target/linux – kernel image
    7. target/linux/image – firmware image file generation

    Patch management ◾ Many packages will not work as-is and need patches to work on the target or to even compile ◾ OpenWrt Buildroot integrates quilt for easy patch management ◾ Turn package patches into quilt series: make package/foo/prepare QUILT=1 ◾ Update patches from modified series: make package/foo/update ◾ Automatically rebase patches after an update: make package/foo/refresh

    Packaging considerations ◾ Main objective is small memory and size footprint ◾ Features that make no sense on embedded systems get disabled through configure or are patched out ◾ Packages must be compilable regardless of the host system, should be self contained ◾ Shipped "configure" scripts are often faulty or unusable in a cross-compile setting, autoreconf or patching needed ◾ Build variants and kconfig includes allow for configurable compile-time settings ◾ There is no standard way for porting software, in many cases it "just works" but often the package build process needs tweaks

    本文章由http://www.wifidog.pro/2015/08/07/openwrt-%E7%BC%96%E8%AF%91%E8%BF%87%E7%A8%8B.html 整理编辑,转载请注明出处

  • 相关阅读:
    MapReduce学习总结之简介
    Hive Cli相关操作
    使用Hive UDF和GeoIP库为Hive加入IP识别功能
    Google Maps-IP地址的可视化查询
    hive多表联合查询(GroupLens->Users,Movies,Ratings表)
    云计算平台管理的三大利器Nagios、Ganglia和Splunk
    机器大数据也离不开Hadoop
    hive与hbase的整合
    hive优化之------控制hive任务中的map数和reduce数
    Hadoop管理员的十个最佳实践(转)
  • 原文地址:https://www.cnblogs.com/wifidog/p/4712185.html
Copyright © 2011-2022 走看看