New file |
| | |
| | |
|
| | |
|
| | | # 1. 编译系统介绍
|
| | |
|
| | |
|
| | |
|
| | | 嵌入式Linux系统BSP(Board Support Package)的整个编译过程非常繁琐且漫长,而我们在BSP开发过程中却经常需要编译这些源码,如果每次都是逐条命令输入执行,这个过程非常麻烦且容易出错。一个完整的 Linux 系统镜像制作,需要经过以下几个步骤:
|
| | |
|
| | | 1. Bootloader 源码编译;
|
| | | 2. Linux内核 源码编译;
|
| | | 3. 根文件系统制作;
|
| | | 4. Linux系统烧录镜像制作;
|
| | |
|
| | |
|
| | |
|
| | | 为此,凌云实验室郭工为 Atmel AT91系列处理器开发板编写了一套编译脚本,这样方便各个开发板的一键编译。当前该编译系统支持的开发板有:
|
| | |
|
| | | * 凌云实验室 LoRaWAN Gateway 开发板
|
| | |
|
| | |
|
| | |
|
| | | ## 1.1 编译系统下载
|
| | |
|
| | |
|
| | |
|
| | | 凌云实验室 IMX 系列开发板一键编译脚本托管在 [凌云实验室的 git 服务器上](http://main.iot-yun.club:8088/summary/build-imxboard.git), 我们可以从该站点上下载最新的编译系统。这里以 IGKBoard-IMX6ULL 开发板为例,使用 git 命令下载该项目源码并重命名为 igkboard-imx6ull(也可以命名为其它开发板的名字)。
|
| | |
|
| | | ```bash
|
| | | guowenxue@9d57f9229b66:~$ git clone http://main.iot-yun.club:8088/r/build-at91.git
|
| | |
|
| | | guowenxue@9d57f9229b66:~$ cd ~/build-at91
|
| | |
|
| | | guowenxue@9d57f9229b66:~/build-at91$ ls
|
| | | bootloader build.sh config.json images kernel tools
|
| | | ```
|
| | |
|
| | |
|
| | |
|
| | | 下面是编译系统各文件的简单介绍。
|
| | |
|
| | | | 文件/文件夹 | 描述 |
|
| | | | --------------- | ------------------------------------------ |
|
| | | | **build.sh** | 顶层一键编译Shell脚本 |
|
| | | | **config.json** | 编译系统的JSON格式配置文件 |
|
| | | | **tools** | 编译系统所依赖系统命令和交叉编译器安装脚本 |
|
| | | | **bootloader** | Bootloader的编译脚本及补丁文件 |
|
| | | | **kernel** | Linux内核的编译脚本及补丁文件 |
|
| | | | **images** | Linux文件系统镜像一键制作脚本 |
|
| | |
|
| | |
|
| | |
|
| | | ## 1.2 编译系统配置
|
| | |
|
| | |
|
| | |
|
| | | 在开始编译之前,我们首先确定当前编译系统支持哪些BSP版本,这点可以通过查看相应开发板的补丁文件来获取。如下所示,当前 IGKBoard-IMX6ULL 只支持 lf-6.1.36-2.1.0 这个版本。
|
| | |
|
| | | ```bash
|
| | | guowenxue@9d57f9229b66:~/build-at91$ ls kernel/patches/loragw/
|
| | | linux-at91-linux4sam-6.1.patch
|
| | | ```
|
| | |
|
| | |
|
| | |
|
| | | 接下来我们需要修改顶层的配置文件 ***config.json*** 如下:
|
| | |
|
| | | ```json
|
| | | {
|
| | | "bsp":
|
| | | {
|
| | | "board":"LoRaGW",
|
| | | "version":"linux4sam-6.1",
|
| | | "giturl":"http://master.iot-yun.club:2211",
|
| | | "crosstool":"/opt/buildroot/gcc-armel-5.5-v2019.02/bin/arm-linux-"
|
| | | }
|
| | | }
|
| | | ```
|
| | |
|
| | |
|
| | |
|
| | | * 修改目标开发板 **board** 为 ***LoRaGW*** ;
|
| | | * 如果想编译其它版本BSP,可以修改 **version** 为支持的目标 BSP 版本;
|
| | | * **giturl** 默认从凌云实验室的文件服务器下载
|
| | | * 修改交叉编译器 **crosstool** 为相应BSP版本交叉编译器;
|
| | |
|
| | |
|
| | |
|
| | | ## 1.3 编译系统安装
|
| | |
|
| | |
|
| | |
|
| | | 在嵌入式BSP系统开发过程中,依赖很多的Linux系统命令及交叉编译器。在该编译系统的 ***tools*** 文件夹下,有一个 ***setup_tools.sh*** 脚本可以用来一键安装它们。
|
| | |
|
| | | ```bash
|
| | | guowenxue@9d57f9229b66:~/build-at91$ ls tools/
|
| | | setup_tools.sh
|
| | | ```
|
| | |
|
| | |
|
| | |
|
| | | 接下来以 root 权限执行 ***tools/setup_tools.sh*** 脚本,来安装BSP源码编译所依赖的系统工具和交叉编译器,如果之前已经安装过则会自动跳过。
|
| | |
|
| | | ```bash
|
| | | guowenxue@9d57f9229b66:~/build-at91$ cd tools/
|
| | |
|
| | | guowenxue@9d57f9229b66:~/build-at91/tools$ sudo ./setup_tools.sh
|
| | | All system tools already installed, skip it |
| | | ... ...
|
| | | decompress gcc-armel-5.5-v2019.02.tar.xz => /opt/buildroot/ |
| | | ... ...
|
| | | gcc version 5.5.0 (Buildroot 2019.02.11) |
| | | ```
|
| | |
|
| | |
|
| | |
|
| | | 至此,整个编译系统的配置和开发环境搭建已经完成。
|
| | |
|
| | |
|
| | |
|
| | | ## 1.4 系统镜像编译
|
| | |
|
| | |
|
| | |
|
| | | 我们可以直接执行顶层的 ***build.sh*** Shell 脚本完成整个 BSP 的源码编译,它将会从凌云实验室的文件服务器上自动下载 ***bootloader、linux kernel、rootfs*** 的源码压缩包,并自动解压缩、编译、安装到 ***images/install/*** 文件夹下。
|
| | |
|
| | | ```bash
|
| | | guowenxue@9d57f9229b66:~/build-at91/tools$ cd ~/build-at91/
|
| | |
|
| | | guowenxue@9d57f9229b66:~/build-at91$ ./build.sh |
| | | ... ...
|
| | | install all images to '/home/guowenxue/build-at91/images/install' |
| | | bootstrap-loragw.bin linuxrom-loragw.itb rootfs-loragw.ubi-p2k u-boot-loragw.bin
|
| | | ```
|
| | |
|
| | |
|
| | |
|