OpenWrt's build system

https://wiki.openwrt.org/about/toolchain

Table of Contents

  • OpenWrt build system – Features
  • OpenWrt build system – Make Targets
  • OpenWrt build system – Build sequence
  • Patch management
  • Packaging considerations
  • Documentation
  • History

OpenWrt‘s build system – About

The OpenWrt build system is a set of Makefiles and patchesthat allows users to easily generate both a cross-compilation toolchain and a root filesystem for embedded systems. The cross-compilation toolchain uses musl, a tiny C standard library.

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

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 the OpenWrt build system.

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‘s build system automates this process to work on the instruction set architecture of most embedded systems.

While the OpenWrt‘s build system 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 build system – 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 build system – 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 build system – 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

Underlined TextItalic Text

Patch management

  • Many packages will not work as-is and need patches to work on the target or to even compile
  • OpenWrt build system 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

Documentation

  1. OpenWrt build system – About
  2. OpenWrt build system – Installation
  3. OpenWrt build system – Usage
  4. OpenWrt build system – Patches

History

OpenWrt's build system

时间: 2024-08-01 14:52:13

OpenWrt's build system的相关文章

在Sublime Text3中配置Python3的Build System

Sublime Text是风靡世界的文本编辑器,支持多种编程语言.由于它的安装包短小精悍方便携带,笔者考虑把它作为Python开发环境.下面的设置可以让Sublime Text 3同时支持Python2和Python3开发环境. 工具/原料 Sublime Text 3 build3103 配置代码(见文末) 方法/步骤 1 打开Sublime Text 3,依次进入new build system菜单(如图~) 2 点击菜单后,会生成一个空配置文件.我们需要在这个配置文件内覆盖配置信息.配置部

RPMForge——Quick Start build system

How to setup multimedia on CentOS-5 CentOS ships with basic sound support for audio content encoded with codecs for a variety of sound formats, including .wav and .ogg files. The alsa-utils and sox audio players are included for a TUI (CLI) environme

【转】Android ROM研究---Android build system增加模块

原文网址:http://hualang.iteye.com/blog/1141315 Android build system就是编译系统的意思 在我们需要向自己编译的源代码中增加模块的时候,需要一些规则,当然这个规则都是类似的. Android.mk文件解析 让我们来看一个 Android.mk 文件的样子 Java代码 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE :=Hello LOCAL_SRC_FILES

sublime C++ build system配置体验

近期准备实习,于是终于步入了sublime的阵营,sublime确实性感. 在配置win7下C++编译运行集成环境的时候遇到点问题,于是接触了一下JSON格式,最后终于自己搞定了.. 参考文档:http://sublime-text.readthedocs.org/en/latest/reference/build_systems.html 其实最终是在C++.sublime-build里写以下东西就好了(tools->build system->new build system) { &qu

Gradle: The New Android Build System

Gradle: The New Android Build System Google selected Gradle as the foundation of the Android SDK build system because it provides flexibility along with the ability to define common standards for Android builds. With Gradle, Android developers can us

The Contiki build system 编译系统

The Contiki build system======================== The Contiki build system is designed to make it easy to compile Contikiapplications for different hardware platforms or into a simulation platform bysimply supplying different parameters to the make co

Android Build System Ultimate Guide

Android Build System Ultimate Guide April 8,2013 Lately, Android Open Source Project has gone through various changes. For instance, Since JB Google decided to replace bluez bluetooth stack with an open source stack implemented by Broadcom claiming t

Android Build System

Android Build System 原文地址:  http://elinux.org/Android_Build_System 另外一篇也比较好的文章: http://www.ibm.com/developerworks/cn/opensource/os-cn-android-build/#author 之前都是片断性的了解, 读完这个文章,编译 android 系统的过程就梳理清晰了. Basics of the Android Build system were described a

构建系统(Build System)

构建系统(build system)是用来从源代码生成用户可以使用的目标(targets)的自动化工具. 目标可以包括库.可执行文件.或者生成的脚本等等. 常用的构建系统包括GNU Make.GNU autotools.CMake.Apache Ant(主要用于JAVA). 此外,所有的集成开发环境(IDE)比如Qt Creator.Microsoft Visual Studio和Eclipse都对他们支持的语言添加了自己的构建系统配置工具. 通常IDE中的构建系统只是基于控制台的构建系统(比如