buildroot是一套能够简化和自动化通过交叉编译,构建出一个完整的可以直接烧写到机器上运行的适用于嵌入式平台的 Linux 系统的工具。使用 buildroot,你可以针对目标平台构建出 交叉编译工具链根文件系统Linux kernel imagebootloader

Buildroot is a tool that simplifies and automates the process of building a complete Linux system for an embedded system, using cross-compilation.

In order to achieve this, Buildroot is able to generate a cross-compilation toolchain, a root filesystem, a Linux kernel image and a bootloader for your target. Buildroot can be used for any combination of these options, independently (you can for example use an existing cross-compilation toolchain, and build only your root filesystem with Buildroot).

Buildroot is useful mainly for people working with embedded systems. Embedded systems often use processors that are not the regular x86 processors everyone is used to having in his PC. They can be PowerPC processors, MIPS processors, ARM processors, etc.

入门

环境搭建

buildroot在源码中给我们提供了提供了一个Vagrantfile,通过下面的命令可以很快的建立起一个隔离的 buildroot 环境。

1
$ curl -O https://buildroot.org/downloads/Vagrantfile; vagrant up

目录介绍

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
.
├── arch: 存放CPU架构相关的配置脚本,如arm/mips/x86,这些CPU相关的配置,在制作工具链时,编译uboot和kernel时很关键.
├── board
├── boot
├── CHANGES
├── Config.in
├── Config.in.legacy
├── configs: 放置开发板的一些配置参数.
├── COPYING
├── DEVELOPERS
├── dl: 存放下载的源代码及应用软件的压缩包.
├── docs: 存放相关的参考文档.
├── fs: 放各种文件系统的源代码.
├── linux: 存放着Linux kernel的自动构建脚本.
├── Makefile
├── Makefile.legacy
├── output: 是编译出来的输出文件夹.
│   ├── build: 存放解压后的各种软件包编译完成后的现场.
│   ├── host: 存放着制作好的编译工具链,如gcc、arm-linux-gcc等工具.
│   ├── images: 存放着编译好的uboot.bin, zImage, rootfs等镜像文件,可烧写到板子里, 让linux系统跑起来.
│   ├── staging
│   └── target: 用来制作rootfs文件系统,里面放着Linux系统基本的目录结构,以及编译好的应用库和bin可执行文件. (buildroot根据用户配置把.ko .so .bin文件安装到对应的目录下去,根据用户的配置安装指定位置)
├── package:下面放着应用软件的配置文件,每个应用软件的配置文件有Config.in和soft_name.mk。
├── README
├── support
├── system
└── toolchain

框架

配置内核

配置文件系统

配置 uboot

编译性能

参考资料