Buildroot--介绍

一. Buildroot 简介

  buildroot是Linux平台上一个构建嵌入式Linux系统的框架。
  整个Buildroot是由Makefile脚本和Kconfig配置文件构成的。
  可以和编译Linux内核一样,通过buildroot配置,menuconfig修改,编译出一个完整的可以直接烧写到机器上运行的Linux系统软件(包含boot、kernel、rootfs以及rootfs中的各种库和应用程序)。
  buildboot也可以单独通过配置和使用交叉编译链工具来实现制作一个Linux文件系统。

下载

下载地址: https://buildroot.org/downloads/

  1. 选择好相应的目录,将下载的压缩包放置在其下

  2. 解压:

    tar -xzvf buildroot-2021.05.3.tar.gz

buildroot目录介绍

  解压之后,我们可以看到以下的目录情况:

├── 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,其中soft_name.mk(这种其实就Makefile脚本的自动构建脚本)文件可以去下载应用软件的包。
├── README
├── support
├── system
└── toolchain

buildroot配置

然后通过make menuconfig进行配置:

Target options  --->选择目标板架构特性。
Build options  --->配置编译选项。
Toolchain  ---> 配置交叉工具链,使用buildroot工具链还是外部提供。
System configuration  --->  系统配置
Kernel  ---> 配置内核
Target packages  ---> 
Filesystem images  --->配置文件系统
Bootloaders  --->硬件启动程序
Host utilities  --->
Legacy config options  --->

① 主页

② Target options

② Build options

 ③ Toolchain

 ③ System configuration

  ④ Kernel

 

⑤ Filesystem images

make命令解析

  通过make help可以看到buildroot下make的使用细节,包括对package、uclibc、busybox、linux以及文档生成等配置:

Cleaning:
  clean                  - delete all files created by build----------------------------------------清理
  distclean              - delete all non-source files (including .config)

Build:
  all                         - make world----------------------------------------------编译整个系统
  toolchain              - build toolchain------------------------------------------编译工具链

Configuration:
  menuconfig             - interactive curses-based configurator--------------------------------对整个buildroot进行配置
  savedefconfig          - Save current config to BR2_DEFCONFIG (minimal config)----------------保存menuconfig的配置

Package-specific:-------------------------------------------------------------------------------对package配置
  <pkg>                  - Build and install <pkg> and all its dependencies---------------------单独编译对应APP
  <pkg>-source           - Only download the source files for <pkg>
  <pkg>-extract          - Extract <pkg> sources
  <pkg>-patch            - Apply patches to <pkg>
  <pkg>-depends          - Build <pkg>'s dependencies
  <pkg>-configure        - Build <pkg> up to the configure step
  <pkg>-build            - Build <pkg> up to the build step
  <pkg>-show-depends     - List packages on which <pkg> depends
  <pkg>-show-rdepends    - List packages which have <pkg> as a dependency
  <pkg>-graph-depends    - Generate a graph of <pkg>'s dependencies
  <pkg>-graph-rdepends   - Generate a graph of <pkg>'s reverse dependencies
  <pkg>-dirclean         - Remove <pkg> build directory-----------------------------------------清除对应APP的编译目录
  <pkg>-reconfigure      - Restart the build from the configure step
  <pkg>-rebuild          - Restart the build from the build step--------------------------------单独重新编译对应APP

busybox:
  busybox-menuconfig     - Run BusyBox menuconfig

uclibc:
  uclibc-menuconfig      - Run uClibc menuconfig

linux:
  linux-menuconfig       - Run Linux kernel menuconfig-----------------------------------------配置Linux并保存设置
  linux-savedefconfig    - Run Linux kernel savedefconfig
  linux-update-defconfig - Save the Linux configuration to the path specified
                             by BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE

Documentation:
  manual                 - build manual in all formats
  manual-pdf             - build manual in PDF
  graph-build            - generate graphs of the build times----------------------------------对编译时间、编译依赖、文件系统大小生成图标
  graph-depends          - generate graph of the dependency tree
  graph-size             - generate stats of the filesystem size

查看Qt 的默认版本

cd ./package/qt5/qt5.mk

二. ·编译

Buildroot--如何配置安装Qt5_海歌也疯狂的博客-CSDN博客

最后执行make指令,会将uboot、linux、文件系统及Qt全部编译完成。

  • images/ — 存放编译后产生的所有镜像文件( 内核镜像 , 加载引导镜像 和 根文件系统镜像)
  • build/ — 存放所有的组件除了构建交叉编译工具链的组件 , 在这个目录里面每一个功能对应一个子目录存放他们各自的组件.
  • staging/ — 包含一个类似于根文件系统等级层次的层级 . 这个目录包含了 安装的交叉编译工具链 和 所有被选择用于目标板的所有用户空间包.
  • target/ — 包含了根文件系统
  • host/ — 包含了我们需要的交叉编译工具集


另外,./dl 包含了所有下载的软件包。有时候在线下载太慢的话,需要手动添加,再重新开始编译,就可以跨过去。

三. 安装一些必要库

解决 Solution for “make menuconfig” Error in Linux PC

# 无效
#$ sudo apt-get install build-essentials
$ sudo apt-get install libncurses5  libncurses5-dev
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值