From 05e45cdbccf5cd23b1a2bc671312cbe590ae65f3 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sun, 09 Oct 2022 14:42:16 +0800
Subject: [PATCH] update setup_tools.sh to install crosstool from ARM Developer

---
 README.md |  724 +++++++++++++++---------------------------------------
 1 files changed, 206 insertions(+), 518 deletions(-)

diff --git a/README.md b/README.md
index 0219413..8450dd1 100644
--- a/README.md
+++ b/README.md
@@ -1,79 +1,29 @@
-
-
-# 版权声明
+# 1. IGKBoard 编译系统
 
 
 
->  ***本文档所有内容文字资料由凌云实验室郭工编著,主要用于凌云嵌入式Linux教学内部使用,版权归属作者个人所有。任何媒体、网站、或个人未经本人协议授权不得转载、链接、转帖或以其他方式复制发布/发表。已经授权的媒体、网站,在下载使用时必须注明来源,违者本人将依法追究责任。***
-
-* **Copyright (C) 2021 凌云物网智科实验室·郭工**
-
-* **Author:      GuoWenxue  \<guowenxue@gmail.com>   QQ: 281143292**
-
-
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/微信公众号.png)
-
-
-
-# 1. 开发板硬件介绍
-
-
-
-**IGKBoard** ***(IoT Gateway Kit Board)*** **开发板** 是 **凌云物网智科实验室** 推出的一款ARM Linux物联网网关开发板。此开发板基于 ***NXP i.MX6ULL*** 系列 Cortex-A7 高性能处理器设计,适用于快速开发一系列具有创新性的产品如物联网网关、人机界面工业 4.0 扫描仪、车载终端以及便携式医疗设备。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/imx6ull.png)
-
-
-
-## 1.1 硬件资源介绍
-
-
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/硬件资源列表.png)
-
-
-
-## 1.2 扩展接口说明
-
-
-
-对于CPU未使用完的多余的管脚,通过40P引脚扩展接引出。需要注意的是,扩展 IO 第 21 脚 LCD_DATA23 不可外接上拉电阻,否则会影响系统启动。这40P引脚定义如下:
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/扩展引脚说明.png)
-
-
-
-## 1.3 跳线帽子说明
-
- 
-
-J3跳线帽子用来选择启动方式,下图描述了开发板具体启动模式。注意由于核心板上默认关闭了 WDG 功能,所以 WDG 功能无法使用跳线帽开启。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/跳线帽子说明.png)
-
-
-
-
-
-# 2. 项目源码介绍
+**IGKBoard** ***(IoT Gateway Kit Board)*** 开发板是 **凌云物网智科实验室** 推出的一款ARM Linux物联网网关开发板。此开发板基于 ***NXP i.MX6ULL*** 系列 Cortex-A7 高性能处理器设计,适用于快速开发一系列具有创新性的产品如物联网网关、人机界面工业 4.0 扫描仪、车载终端以及便携式医疗设备。
 
 
 
 凌云实验室针对该开发板从制作交叉编译器开始,从零构建了Buildroot、Yocto、Debian等Linux系统,所有系统相关源码维护在凌云实验室的官方git服务器上,接下来我们将讲解如何使用git仓库上的源码搭建交叉编译环境、编译制作系统镜像文件。
 
- 
 
-## 2.1 项目源码介绍
+
+ 该项目测试开发环境为Ubuntu-20.04。
+
+
+
+## 1.1 项目源码介绍
 
  
 
-该项目测试开发环境为Ubuntu-20.04, 首先在Linux服务器上使用 **git** 命令克隆下载该项目源码,如果没有 ***git*** 命令,则首先安装 **git** 命令并配置 **git** 的账号信息。
+首先在Linux服务器上使用 **git** 命令克隆下载该项目源码,如果没有 ***git*** 命令,则首先安装 **git** 命令并配置 **git** 的账号信息。 
 
 ```
-guowenxue@ubuntu20:~$ sudo apt install git
-guowenxue@ubuntu20:~$ git config --global user.name guowenxue
-guowenxue@ubuntu20:~$ git config --global user.email "guowenxue@gmail.com"
+guowenxue@5355ee897054:~$ sudo apt install git
+guowenxue@5355ee897054:~$ git config --global user.name guowenxue
+guowenxue@5355ee897054:~$ git config --global user.email "guowenxue@gmail.com"
 ```
 
 
@@ -81,16 +31,14 @@
 使用 **git** 命令克隆下载该项目源码:
 
 ```
-guowenxue@ubuntu20:~$ mkdir -p ~/workspace
-guowenxue@ubuntu20:~$ cd ~/workspace
-guowenxue@ubuntu20:~/workspace$ git clone git://weike-iot.com/imx6ull.git
+guowenxue@5355ee897054:~$ git clone http://weike-iot.com:8088/r/imx6ull.git
 Cloning into 'imx6ull'...
-remote: Counting objects: 330, done
-remote: Finding sources: 100% (330/330)
-remote: Getting sizes: 100% (179/179)
-remote: Total 330 (delta 98), reused 330 (delta 98)
-Receiving objects: 100% (330/330), 110.55 KiB | 884.00 KiB/s, done.
-Resolving deltas: 100% (98/98), done.
+remote: Counting objects: 1505, done
+remote: Finding sources: 100% (1505/1505)
+remote: Getting sizes: 100% (680/680)
+remote: Total 1505 (delta 627), reused 1505 (delta 627)
+Receiving objects: 100% (1505/1505), 76.39 MiB | 371.00 KiB/s, done.
+Resolving deltas: 100% (627/627), done.
 ```
 
 
@@ -98,8 +46,8 @@
 下面是该项目当前源码目录结构的介绍:
 
 ```
-guowenxue@ubuntu20:~$ cd ~/workspace/imx6ull/
-guowenxue@ubuntu20:~/workspace/imx6ull$ tree -L 2
+guowenxue@5355ee897054:~$ cd ~/imx6ull/
+guowenxue@5355ee897054:~/imx6ull$ tree -L 2
 .
 ├── README.md            本项目介绍文档
 ├── 3rdparty             第三方开源库的交叉编译脚本
@@ -108,9 +56,11 @@
 ├── bsp                  Linux板级支持包源码目录
 │   ├── build.sh         BSP目录总的编译脚本,依次进入到子目录下编译
 │   ├── bootloader       U-boot编译目录及编译脚本
-│   ├── images           制作系统镜像的脚本
+│   ├── images           制作系统镜像的脚本,编译生成文件的输出文件夹
 │   ├── kernel           Linux内核编译目录及编译脚本
+│   ├── drivers          Linux驱动目录及编译脚本
 │   ├── rootfs           根文件系统制作脚本
+│   ├── scripts          编译系统的一些工具脚本
 │   ├── tarball          Linux内核等源码下载目录及脚本
 │   └── uapi             Linux内核驱动测试脚本
 ├── documents            文档目录
@@ -121,100 +71,65 @@
 ├── program              自己编写的一些应用程序
 │   └── lvgl             另外一个跨平台、轻量级图形库
 └── yocto                Yocto项目支持目录
-│   └── meta-igkboard    Yocto移植的开发板Meta-layer
+    ├── build.sh         Yocto的编译脚本
+│   └── meta-igkboard    Yocto移植的开发板meta-layer
 └── tools                本项目开发工具
     ├── buildroot        buildroot交叉编译器一键制作脚本
     └── setup_tools.sh   开发环境安装脚本
-
-16 directories, 3 files
 ```
 
 
 
-## 2.2 编译环境安装
+## 1.2 编译环境安装
 
  
 
-该项目源码路径 tools下有该项目的开发环境一键安装Shell脚本,以root权限执行该脚本将会自动下载并安装接下来开发过程中所依赖的系统命令工具,并解压缩安装交叉编译器到 ***/opt/buildroot/cortexA7*** 路径下。
+该项目源码路径 tools下有该项目的开发环境一键安装Shell脚本,以root权限执行该脚本将会自动下载并安装接下来开发过程中所依赖的系统命令工具。
 
 ```
-guowenxue@ubuntu20:~$ cd ~/workspace/imx6ull/tools/
-guowenxue@ubuntu20:~/workspace/imx6ull/tools$ ls
-buildroot  setup_tools.sh
-
-guowenxue@ubuntu20:~/workspace/imx6ull/tools$ sudo ./setup_tools.sh 
-
-+-----------------------------------------------------------------------
-|  /apps and /opt not writable, use chmod to give writable permissions 
-+-----------------------------------------------------------------------
-
-
-+-----------------------------------------------------------------------
-|  start apt install system tools(commands) 
-+-----------------------------------------------------------------------
-
-... ...
-
-+-----------------------------------------------------------------------
-|  start apt install devlopment tools(commands) 
-+-----------------------------------------------------------------------
-
-... ...
-
-+-----------------------------------------------------------------------
-|  download buildroot-2021.02.7-cortexA7 now... 
-+-----------------------------------------------------------------------
-
-... ...
-+-----------------------------------------------------------------------
-|  install buildroot-2021.02.7-cortexA7 to /opt/buildroot/cortexA7 now... 
-+-----------------------------------------------------------------------
-
-Using built-in specs.
-COLLECT_GCC=/opt/buildroot/cortexA7/bin/arm-linux-gcc.br_real
-COLLECT_LTO_WRAPPER=/opt/buildroot/cortexA7/libexec/gcc/arm-buildroot-linux-gnueabihf/9.4.0/lto-wrapper
-Target: arm-buildroot-linux-gnueabihf
-Configured with: ./configure --prefix=/opt/buildroot/cortexA7 --sysconfdir=/opt/buildroot/cortexA7/etc --enable-static --target=arm-buildroot-linux-gnueabihf --with-sysroot=/opt/buildroot/cortexA7/arm-buildroot-linux-gnueabihf/sysroot --enable-__cxa_atexit --with-gnu-ld --disable-libssp --disable-multilib --disable-decimal-float --with-gmp=/opt/buildroot/cortexA7 --with-mpc=/opt/buildroot/cortexA7 --with-mpfr=/opt/buildroot/cortexA7 --with-pkgversion='Buildroot 2021.02.7' --with-bugurl=http://bugs.buildroot.net/ --without-zstd --disable-libquadmath --disable-libquadmath-support --enable-tls --enable-threads --without-isl --without-cloog --with-abi=aapcs-linux --with-cpu=cortex-a7 --with-fpu=neon-vfpv4 --with-float=hard --with-mode=arm --enable-languages=c,c++ --with-build-time-tools=/opt/buildroot/cortexA7/arm-buildroot-linux-gnueabihf/bin --enable-shared --disable-libgomp
-Thread model: posix
-gcc version 9.4.0 (Buildroot 2021.02.7) 
-
-+-----------------------------------------------------------------------
-|  Cross compiler: /opt/buildroot/cortexA7/bin/arm-linux- 
-+-----------------------------------------------------------------------
+guowenxue@5355ee897054:~$ cd ~/imx6ull/tools/
+guowenxue@5355ee897054:~/imx6ull/tools$ sudo ./setup_tools.sh 
 ```
 
 
 
-## 2.3 自构建系统编译
+# 2 自构建系统编译
 
 
 
-### 2.3.1 自构建系统介绍
+## 2.1 自构建系统介绍
 
-该项目源码路径 bsp/ 文件夹下存放有U-boot、Linux内核、根文件系统树等编译制作脚本,同时顶层还有一个build.sh 的Shell脚本。该脚本用来一键编译所选择的目标源码,并将编译产生的烧录文件放到新生成的 images路径下。
+
+
+该项目源码路径 ***bsp*** 文件夹下存放有U-boot、Linux内核、根文件系统树等编译制作脚本,同时顶层还有一个build.sh 的Shell脚本。该脚本用来一键编译所选择的目标源码,并将编译产生的烧录文件放到 images 路径下。
 
 ```
-guowenxue@ubuntu20:~$ cd ~/workspace/imx6ull/bsp/
-guowenxue@ubuntu20:~/workspace/imx6ull/bsp$ tree -L 2
+guowenxue@5355ee897054:~$ cd ~/imx6ull/bsp/
+guowenxue@5355ee897054:~/imx6ull/bsp$ tree -L 2
 .
 ├── build.sh                  总的编译脚本
-├── bootloader             
+├── bootloader
 │   ├── build.sh              u-boot编译脚本
+│   ├── igkboard.json         u-boot编译的配置文件
 │   └── patch                 u-boot修改补丁文件
 ├── kernel
 │   ├── build.sh              Linux内核编译脚本
+│   ├── igkboard.json         Linux内核编译的配置文件
 │   └── patch                 Linux内核修改补丁文件
 ├── drivers
 │   ├── build.sh              Linux内核驱动编译脚本,WiFi模块驱动将会自动下载并编译
+│   ├── igkboard.json         Linux内核驱动编译的配置文件
 │   └── users                 用户编写的驱动文件将会放到这里
 ├── images   
+│   ├── boot                  镜像里的boot分区配置文件
 │   ├── build.sh              烧录的系统镜像制作脚本
-│   └── wintools              Windows系统下系统镜像烧录工具和脚本
+│   └── igkboard.json         系统镜像制作脚本的配置文件
 ├── rootfs
 │   ├── build.sh              根文件系统树制作脚本
-│   └── extra_apps.json       debian文件系统额外安装的应用程序配置文件
-├── tarball
-│   └── build.sh              Linux内核、u-boot、根文件系统树等源码包自动下载脚本
+│   ├── rootfs.json           制作根文件系统的配置文件
+│   └── files                 额外需要添加到根文件系统里的文件
+├── scripts
+│   └── setup_env.sh          编译系统的一些工具脚本
 └── uapi
     └── test                  驱动测试程序
 ```
@@ -224,7 +139,7 @@
 下面是总的编译脚本的使用帮助信息:
 
 ```
-guowenxue@ubuntu20:~/workspace/imx6ull/bsp$ ./build.sh 
+guowenxue@5355ee897054:~/imx6ull/bsp$ ./build.sh 
 
 Usage:
  ./build.sh [-b] [-c] [-h] bsp/image
@@ -234,463 +149,236 @@
 
  WARNNING: build/clean image need run as sudo
 
-  Example: ./build.sh -b bsp && sudo ./build.sh -b image
+ Build Example: ./build.sh -b bsp && sudo ./build.sh -b image
+ Clean Example: ./build.sh -c bsp && sudo ./build.sh -c image
 
 ```
 
 
 
-### 2.3.2 系统类型介绍
+## 2.2 自构建系统编译
 
-在总的编译脚本里,变量 **ROOTFS**  用来指定要编译的Linux系统类型,当前支持 ***buildroot、yocto、bullseye (Debian11)*** 系统。
+在总的编译脚本里,变量 ***SYSTEM***  和  ***DISTRO*** 用来指定要编译的Linux系统类型。
 
 ```
-guowenxue@ubuntu20:~/workspace/imx6ull/bsp$ vim build.sh
+guowenxue@5355ee897054:~$ cd ~/imx6ull/bsp/
+guowenxue@5355ee897054:~/imx6ull/bsp$ vim build.sh
 ... ...
-# rootfs should be buildroot/yocto or bullseye for debian system
-ROOTFS=buildroot
+# SYSTEM  should be: buildroot, debian,            yocto
+# DISTRO  should be: v2021.02, bullseye, hardknott/honister/kirkstone
+SYSTEM=yocto
+DISTRO=kirkstone
 ... ...
 ```
 
-* 如果想使用 **buildroot** 制作的文件系统,则将其设置为 ***buildroot*** ,默认为该值;
-* 如果想使用 **yocto** 制作的文件系统,则将其值更改为 **yocto** ;
-* 如果想使用 ***debian*** 文件系统,则将其值设置为 **bullseye** ,即 **Debian 11** ;
+
+
+* 如想使用 **yocto** 文件系统,则 ***SYSTEM*** 设置为 **yocto** ,***DISTRO***  设置为其相应版本,如 **kirkstone**;
+* 如想使用 **debian** 文件系统,则 ***SYSTEM*** 设置为 **debian** ,***DISTRO***  设置为 **bullseye(Debian11)** ;
+* 如想使用 **buildroot** 文件系统,则 ***SYSTEM*** 设置为 **buildroot** ,***DISTRO*** 设置为 **v2021.02** ;
 
 
 
-### 2.3.3 自构建系统编译
-
-使用下面命令,一键下载、编译并制作系统烧录镜像文件,默认将编译 ***buildroot*** 系统镜像:
+接下来可以使用下面命令,一键下载、编译并制作系统烧录镜像文件。
 
 ```
-guowenxue@ubuntu20:~/workspace/imx6ull/bsp$ ./build.sh -b bsp && sudo ./build.sh -b image
-... ...
-+---------------------------------------------+
- Stage 5:  <4> Install u-boot image
-+---------------------------------------------+
+guowenxue@5355ee897054:~$ cd ~/imx6ull/bsp/
+guowenxue@5355ee897054:~/imx6ull/bsp$ ./build.sh -b bsp && sudo ./build.sh -b image
 
-1006+0 records in
-1006+0 records out
-515072 bytes (515 kB, 503 KiB) copied, 0.00320756 s, 161 MB/s
-
-+---------------------------------------------+
- Stage 6:  <5> Install linux kernel image
-+---------------------------------------------+
-
-+ cp /home/guowenxue/workspace/imx6ull/bsp/images/boot/zImage ./mnt
-+ cp /home/guowenxue/workspace/imx6ull/bsp/images/boot/igkboard-emmc.dtb ./mnt
-+ sync
-+ set +x
-
-+---------------------------------------------+
- Stage 7:  <6> Install root filesystem 
-+---------------------------------------------+
-
-
-+---------------------------------------------+
- Stage 8:  bzip2 compress system image 
-+---------------------------------------------+
-
-
- -- generate system image done --
-
-Shell script exit now, do some clean work
-
-guowenxue@ubuntu20:~/workspace/imx6ull/bsp$ cd images/
-guowenxue@ubuntu20:~/workspace/imx6ull/bsp/images$ tree
-.
-├── boot
-│   ├── igkboard-emmc.dtb                  Linux内核DTB文件
-│   └── zImage                             Linux内核Image
-├── build.sh       
-├── linuxsys_igkboard_buildroot.img.bz2    烧录的系统镜像bz2压缩文件,使用的文件系统不一样,系统镜像名也不一样。
-├── u-boot-igkboard-emmc.imx               U-boot EMMC启动镜像文件
-└── wintools
-    ├── uuu.exe                            Windows下UUU烧录工具
-    └── win_flash.bat                      Windows下的烧录批处理脚本
-
-2 directories, 7 files
+ --I-- start fetch /home/guowenxue/imx6ull/bsp/bootloader source code. 
+ --I-- wget http://weike-iot.com:2211/imx/bsp/lf-5.15.32-2.0.0/uboot-imx.tar.xz 
+ --I-- decompress /home/guowenxue/imx6ull/bsp/bootloader/../tarballs//uboot-imx.tar.xz 
+ --W-- Patch for uboot-imx source code 
+ --W-- Copy logo file: logo_uboot_364x128.bmp  
+ --W-- Modify cross compiler in Makefile: arm-linux-gnueabihf- 
+ --W-- Build for uboot-imx source code 
+ ... ...
+ 
+ --W-- Install bootloader u-boot-igkboard.imx 
+ --I-- install u-boot-igkboard.imx => /home/guowenxue/imx6ull/bsp/bootloader/../images/ 
+ --I-- start fetch /home/guowenxue/imx6ull/bsp/kernel source code. 
+ --I-- wget http://weike-iot.com:2211/imx/bsp/lf-5.15.32-2.0.0/linux-imx.tar.xz
+ --I-- decompress /home/guowenxue/imx6ull/bsp/kernel/../tarballs//linux-imx.tar.xz 
+ --W-- Patch for linux-imx source code 
+ --W-- Modify cross compiler in Makefile: arm-linux-gnueabihf- 
+ --W-- Build for linux-imx source code 
+ ... ...
+ 
+ --I-- start fetch /home/guowenxue/imx6ull/bsp/drivers source code. 
+ --I-- wget http://weike-iot.com:2211/imx/igkboard/wifi/rtl8188fu.tar.bz2 
+ --I-- decompress /home/guowenxue/imx6ull/bsp/drivers/../tarballs//rtl8188fu.tar.bz2 
+ --W-- Build for users driver 
+ ... ...
+ 
+ --W-- start fetch rootfs tree for yocto(kirkstone)  
+ --I-- start fetch rootfs_kirkstone source code. 
+ --I-- wget http://weike-iot.com:2211/imx/igkboard/rootfs/rootfs_kirkstone.tar.bz2 
+ --I-- start fetch rootfs_kirkstone source code. 
+ --W-- start configure for yocto(kirkstone) rootfs 
+ --W-- configure for yocto(kirkstone) rootfs done 
+ ... ...
+ 
+ --W-- Generate system image  
+ --W-- Partition system image 
+ --W-- format system image partition 
+ --W-- install u-boot image 
+ --W-- install linux kernel image 
+ --W-- install root filesystem /home/guowenxue/imx6ull/bsp/images/../rootfs/rootfs_kirkstone 
+ --W-- generate system image done 
+Shell script exit now, do some clean work 
 ```
 
 
 
-### 2.3.4 编译输出文件
+编译生成的文件将放到 ***images*** 文件夹下。
 
-这里,我们需要将如下几个文件下载/拷贝到Windows主机下,**并将系统镜像文件解压缩出来**,接下来烧录系统镜像时会用到。
+```
+guowenxue@5355ee897054:~/imx6ull/bsp$ ls images/
+boot  build.sh  drivers  igkboard.json  linuxsys-yocto-igkboard.img  u-boot-igkboard.imx
+```
+
+* **linuxsys-yocto-igkboard.img**             烧录到开发板上的系统镜像文件
+* **u-boot-igkboard.imx**                           编译生成的U-boot二进制镜像文件
 
 
 
-* linuxsys_igkboard_buildroot.img.bz2      烧录的系统镜像bz2压缩文件
-* u-boot-igkboard-emmc.imx                      U-boot EMMC启动镜像文件
-* uuu.exe                                                         Windows下UUU烧录工具
-* win_flash.bat                                                Windows下的烧录批处理脚本
+接下来我们可以将 ***linuxsys-yocto-igkboard.img*** 和 ***u-boot-igkboard.imx*** 两个镜像文件,下载到 Windows系统下,参考烧录文档即可升级该系统镜像文件。
 
 
 
-![](https://gitee.com/iotcraft/imx6ull/raw/master/系统烧录镜像文件.png)
+# 3. Yocto系统编译
 
 
 
-## 2.4 Yocto系统编译
-
-
-
-凌云实验室针对IGKBoard开发板移植了Yocto Hardknott (Yocto 3.3)系统,该源码也托管在上面的 git 服务器上,接下来将讲解如何编译该系统。关于Yocto系统的详细使用,大家可以参考NXP官方的用户手册文档,[点此链接下载](https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf) 。
+凌云实验室针对 IGKBoard 开发板移植了Yocto ***Hardknott*** (Yocto 3.3)、***Honister***(Yocto 3.4) 和 ***Kirkstone***(Yocto 4.0)系统,该源码也托管在上面的 git 服务器上,接下来将讲解如何编译该系统。关于Yocto系统的详细使用,大家可以参考NXP官方的用户手册文档,[点此链接下载](https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf) 。
 
 
 
 如果想源码编译Yocto系统的话,则系统需要满足:
 
-* 推荐使用 Ubuntu 20.04 系统;
-* 推荐使用 4核以上CPU;
-* 硬盘空间至少要求 200GB+;
+- 推荐使用 Ubuntu 20.04 系统(Hardknott不能在Ubuntu-22.04上编译);
+- 推荐使用 4核以上CPU,硬盘空间至少要求 200GB+;
+- Yocto系统编译需要从 github 等站点下载大量的源代码,而github有时在国内不能正常访问;
 
 
 
-### 2.4.1 下载Yocto项目源码
+## 3.1 Yocto编译系统介绍
 
 
 
-使用 **git** 命令克隆凌云实验室 ***IGKBoard*** 项目源码,如果之前已下载则可以跳过该步骤。
+该项目源码路径 ***yocto*** 文件夹下存放有移植到 IGKBoard 开发板上的 Yocto 相关文件及其编译脚本。其目录结构如下:
 
 ```
-guowenxue@ubuntu20:~$ mkdir -p ~/workspace
-guowenxue@ubuntu20:~$ cd ~/workspace
-guowenxue@ubuntu20:~/workspace$ git clone git://weike-iot.com/imx6ull.git
-Cloning into 'imx6ull'...
-remote: Counting objects: 330, done
-remote: Finding sources: 100% (330/330)
-remote: Getting sizes: 100% (179/179)
-remote: Total 330 (delta 98), reused 330 (delta 98)
-Receiving objects: 100% (330/330), 110.55 KiB | 884.00 KiB/s, done.
-Resolving deltas: 100% (98/98), done.
+guowenxue@5355ee897054:~$ cd ~/imx6ull/yocto/
+guowenxue@5355ee897054:~/imx6ull/yocto$ tree -L 2
+.
+├── build.sh           一键编译Yocto脚本
+└── meta-igkboard
+    ├── hardknott      移植到IGKBoard的 Hardknott版本相关meta文件
+    ├── honister       移植到IGKBoard的 Honister 版本相关meta文件
+    └── kirkstone      移植到IGKBoard的 Kirkstone版本相关meta文件
 ```
 
 
 
-下载并安装 google 的 ***repo*** 命令:
+## 3.2 Yocto系统编译
+
+
+
+如果想编译相应的 Yocto 指定版本,只需要修改 ***build.sh*** 文件中的 ***VERSION*** 变量即可。
 
 ```
-guowenxue@ubuntu20:~$ curl https://storage.googleapis.com/git-repo-downloads/repo -o repo
-guowenxue@ubuntu20:~$ chmod a+x repo
-guowenxue@ubuntu20:~$ sudo mv repo /usr/bin/ 
+guowenxue@5355ee897054:~/imx6ull/yocto$ vim build.sh 
+... ...
+# Version should be: hardknott(3.3) honister(3.4) kirkstone(4.0)
+VERSION=kirkstone
+... ...
 ```
 
 
 
-接下来就可以使用 ***repo*** 命令下载 **Yocto Hardknott** 源码:
+接下来直接运行  ***build.sh*** 将会开始 Yocto的漫长编译过程。
 
 ```
-guowenxue@ubuntu20:~$ mkdir -p ~/workspace/imx-yocto-bsp/
-guowenxue@ubuntu20:~$ cd ~/workspace/imx-yocto-bsp/
-guowenxue@ubuntu20:~/workspace/imx-yocto-bsp$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-hardknott -m imx-5.10.52-2.1.0.xml
-guowenxue@ubuntu20:~/workspace/imx-yocto-bsp$ repo sync
-guowenxue@ubuntu20:~/workspace/imx-yocto-bsp$ ls
-imx-setup-release.sh  README  README-IMXBSP  setup-environment  sources
-```
-
-
-
-### 2.4.2 编译Yocto系统
-
-
-
-在前面的开发板项目源码中,有提供凌云实验室 IGKBoard 开发板的Yocto支持源码,这里首先将该源码拷贝到 Yocto 系统中。
-
-```
-guowenxue@ubuntu20:~/workspace/imx-yocto-bsp$ cp -rf ~/workspace/imx6ull/yocto/meta-igkboard/ sources/
-```
-
-
-
-接下来执行下面命令,初始化 IGKBoard 开发板的 Yocto 编译环境:
-
-```
-guowenxue@ubuntu20:~/workspace/imx-yocto-bsp$ MACHINE=igkboard source sources/meta-igkboard/tools/igkboard-setup.sh -b igkboard
-
+guowenxue@5355ee897054:~/imx6ull/yocto$ ./build.sh 
+ --I-- start fetch Yocto kirkstone 
+ --I-- decompress tarballs/imx-yocto-bsp-kirkstone.tar.xz 
+ --I-- start patch Yocto kirkstone 
+ --W-- Build Yocto kirkstone for linuxsys-image. 
+ --I-- Yocto kirkstone source meta.  
+ 
  Build directory is  igkboard
-/home/guowenxue/workspace/imx-yocto-bsp
-    Welcome LingYun IoT Gateway Kit Board Yocto BSP
+/home/guowenxue/imx6ull/yocto/workspace-kirkstone
 
-    The Yocto Project has extensive documentation about OE including a
-    reference manual which can be found at:
-        http://yoctoproject.org/documentation
+    Welcome LingYun IoT Gateway Kit Board Yocto BSP, You can run 'bitbake <target>' now.
 
-    You can now run 'bitbake <target>'
-
-    Common targets are:
+    The targets should be:
         linuxsys-image
         core-image-minimal
-        imx-image-full
+        imx-image-full 
+Loading cache: 100% |                                                                                                                                                                      | ETA:  --:--:--
+Loaded 0 entries from dependency cache.
+Parsing recipes: 100% |#####################################################################################################################################################################| Time: 0:00:17
+Parsing of 2930 .bb files complete (0 cached, 2930 parsed). 4440 targets, 525 skipped, 3 masked, 0 errors.
+NOTE: Resolving any missing task queue dependencies
+
+Build Configuration:
+BB_VERSION           = "2.0.0"
+BUILD_SYS            = "x86_64-linux"
+NATIVELSBSTRING      = "ubuntu-22.04"
+TARGET_SYS           = "arm-poky-linux-gnueabi"
+MACHINE              = "igkboard"
+DISTRO               = "fsl-imx-wayland"
+DISTRO_VERSION       = "5.15-kirkstone"
+TUNE_FEATURES        = "arm vfp cortexa7 neon thumb callconvention-hard"
+TARGET_FPU           = "hard"
+meta                 
+meta-poky            
+meta-oe              
+meta-multimedia      
+meta-python          
+meta-freescale       
+meta-freescale-3rdparty 
+meta-freescale-distro 
+meta-bsp             
+meta-sdk             
+meta-nxp-demo-experience 
+meta-clang           
+meta-networking      
+meta-filesystems     
+meta-qt6             
+meta-igkboard        = "master:4f2e12e2a47981910cdfb85c480a31f3781f97b1"
+
+Initialising tasks: 100% |##################################################################################################################################################################| Time: 0:00:07
+Sstate summary: Wanted 0 Local 0 Mirrors 0 Missed 0 Current 2437 (0% match, 100% complete)
+NOTE: Executing Tasks
+NOTE: Tasks Summary: Attempted 5897 tasks of which 5897 didn't need to be rerun and all succeeded.
+
+Summary: There was 1 WARNING message.
+ --W-- List yocto build output images. 
+... ...
 ```
 
 
 
-接下来使用下面命令,开始Yocto系统的源码编译,这个系统编译时间较长,如果编译的过程中出现错误,再重新开始编译即可。也可以使用 ***-k*** 选项先跳过编译出错的软件包。
+编译生成的系统镜像文件将会存放在 `workspace-kirkstone/igkboard/tmp/deploy/images/igkboard/` 路径下。
 
 ```
-guowenxue@ubuntu20:/workspace/imx-yocto-bsp/igkboard$ bitbake linuxsys-image
+guowenxue@ubuntu22:~/imx6ull/yocto$ ls workspace-kirkstone/igkboard/tmp/deploy/images/igkboard/
+linuxsys-image-igkboard-20221006114233.rootfs.manifest            
+linuxsys-image-igkboard-20221006114233.rootfs.tar.bz2             
+linuxsys-image-igkboard-20221006114233.rootfs.wic.bz2             
+u-boot-igkboard.imx                                             
 ```
 
 
 
-### 2.4.3 Yocto编译输出
+* **linuxsys-image-igkboard-20221006114233.rootfs.manifest**    系统镜像里的各个软件包及其版本信息。
+* **linuxsys-image-igkboard.tar.bz2**        Yocto根文件系统树压缩包,它是一个符号链接,独立编译时需要。
+* **linuxsys-image-igkboard.wic.bz2**        烧录到开发板上的系统镜像压缩包,它是一个符号链接。
+* **u-boot-igkboard.imx**                               编译生成的U-boot镜像文件,它是一个符号链接。
 
+ 
 
-
-编译过程中下载的软件包存放在 ***~/workspace/hardknott_packets/*** 路径下:
-
-```
-guowenxue@ubuntu20:/workspace/imx-yocto-bsp/igkboard$ ls ~/workspace/hardknott_packets/
-```
-
-
-
-编译完成输出的系统镜像及文件系统存放在下面路径下:
-
-```
-guowenxue@ubuntu20:~/workspace/imx-yocto-bsp/igkboard$ ls ls tmp/deploy/images/igkboard/
-linuxsys-image-igkboard-*.rootfs.tar.bz2   --Yocto根文件系统压缩包
-linuxsys-image-igkboard-*.rootfs.wic.bz2   --Yocto烧录系统镜像文件
-```
-
-
-
-
-
-# 3. 系统镜像烧录
-
-
-
-## 3.1 跳线设置
-
-
-
-iMX6ULL支持eMMC、Nandflash、TF卡(SD卡)等多种启动方式,**IGKBoard开发板** 上板载了一颗Samsung公司的8GB eMMC芯片,此外它还带有一个TF卡槽,这样该开发板支持eMMC和SD卡两种启动方式。由下图可知,系统具体采用哪种方式启动由J3跳线帽子决定。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/跳线帽子说明.png)
-
-
-
-* 如果想设置系统从 EMMC启动(mmc1),则将除看门狗跳线(13、14)短接以外,所有其他跳线帽子全部断开;
-* 如果想设置系统从TF卡启动(mmc0),则将 5/6、7/8、9/10、11/12 、13/14(看门狗跳线) 5个跳线全部短接;
-
-
-
-## 3.2 硬件连接
-
-
-
-如下图所示,连接相关的硬件接口设置:
-
-* 使用 ***9V/1A电源***(7~28V电压范围)供电;
-* 使用 ***TypeC USB线*** 连接开发板和PC,Win10系统自带有其驱动,该接口专门用来烧录 ***u-boot***  或  ***系统镜像***  ;
-* 使用 ***USB串口调试线*** 连接开发板和PC,该模块使用CH340 USB转串口芯片,需要安装其驱动。
-
-
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/开发板烧录连接.png)
-
-
-
-
-
-
-
-## 3.3 EMMC系统烧录
-
-
-
-### 3.3.1 跳线设置
-
-
-
-如下图所示,将J3的除WDG以外的跳线帽子全部断开,则进入eMMC启动模式,该模式下开发板上电后将从eMMC读取运行u-boot,进而加载并启动Linux系统。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/emmc启动.png)
-
-### 3.3.2 软件准备
-
-
-
-在硬件设备准备好之后,我们还需要安装或准备好如下软件:
-
-* [**点击此链接下载**](http://weike-iot.com:2211/imx6ull/tools/wintools/ch341.7z) 并安装好  ***USB转串口调试器***  驱动 ;
-* [**点击此链接下载**](http://weike-iot.com:2211/imx6ull/tools/wintools/uuu.exe) NXP官方烧录程序 ***uuu.exe*** ,也可以从前面的项目源码路径 *** imx6ull/bsp/images/wintools/*** 中获取 ;
-* [**点击此链接下载**](http://weike-iot.com:2211/imx6ull/tools/wintools/win_flash.bat) 凌云实验室的 i.MX6ULL开发板烧录批处理脚本 ***win_flash.bat***,也可以从前面的项目源码路径 *** imx6ull/bsp/images/wintools/*** 中获取 。
-
-
-
-串口驱动下载安装好后,将 ***USB转串口调试器*** 接入 使用 ***Win+R*** 快捷键打开 ***运行***  , 然后输入 **devmgmt.msc**  命令打开 **设备管理器** , 接下来我们应该可以看到相应的串口设备文件。如下图所示:
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/串口查看.png)
-
-
-
-接下来使用 **SecureCRT** 或其他串口调试软件,打开相应的USB转串口设备,并监听串口:
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/SecureCRT串口连接.png)
-
-### 3.3.3 烧录文件
-
-
-
-如前面 **自构建系统编译** 相关章节所述,将前面源码编译输出的相关文件 拷贝/下载 到Windows系统下,并将系统镜像文件 解压缩出来。这里以 ***buildroot*** 系统镜像 ***linuxsys_igkboard_buildroot.img***  文件为例,详细讲解 ***emmc 系统*** 的烧录过程,其它的系统镜像同样也可以使用同样的方式来烧录。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/系统烧录镜像文件.png)
-
-
-
- **IGKBoard-iMX6ULL 开发板** 当前支持 ***Buildroot、Yocto、Debian Bullseye*** 等不同的文件系统,编译的时候使用的文件系统不一样,生成的系统镜像也不一样。如果系统镜像不一样,可以修改 ***win_flash.bat*** 批处理脚本中的 ***ROOTFS*** 变量值:
-
-
-
-```
-REM This bat script used to flash u-boot or linux system image to EMMC
-
-REM uuu.exe official address:  https://github.com/NXPmicro/mfgtools
-REM LingYun download address:  http://weike-iot.com:2211/imx6ull/tools
-
-REM Goes into fastboot mode command:  fastboot 0
-REM Erase u-boot command in u-boot :  mmc dev 1 1 && mmc erase 0 40000
-
-@echo off
-
-set BOARD=igkboard
-set ROOTFS=buildroot
-
-set IMAGE_UBOOT=u-boot-%BOARD%-emmc.imx
-set IMAGE_SYS=linuxsys_%BOARD%_%ROOTFS%.img
-
-echo "Image Download Choices:"
-
-echo 1: Download bootloader   [ %IMAGE_UBOOT% ]
-echo 2: Download System Image [ %IMAGE_SYS% ]
-
-set /p choice= Please Input Your Choice:
-
-if %choice% == 1  uuu -b emmc %IMAGE_UBOOT%
-if %choice% == 2  uuu -b emmc_all %IMAGE_UBOOT% %IMAGE_SYS%
-```
-
-
-
-### 3.3.4 烧录模式
-
-
-
-要想重新烧录开发板,则需要让开发板首先进入到烧录模式,然后通过 USB TypeC接口烧录。不同情况下进入烧录模式不一样:
-
-* 硬件开发板刚生产出来时,并没有系统软件,这时将会默认进入到烧录模式;
-* 如果已经烧录了u-boot程序,系统上电后出现 ***"Hit any key to stop autoboot:  3"***  时按任意键进入到u-boot的 **调试模式**.
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/u-boot进入调试模式.png)
-
-
-
-在u-boot调试模式下,输入下面命令将进入到开发板的烧录模式:
-
-* 如果开发板已经烧录了万象奥科的出厂系统,则需要使用 ***mmc dev 1 1 && mmc erase 0 40000***  命令先擦除 u-boot 后再重启进入到烧录模式;
-* 如果开发板已经烧录了凌云实验室的系统,则可以使用 ***fastboot 0*** 命令进入到烧录模式;
-
-
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/进入烧录模式命令.png)
-
-
-
-### 3.3.5 系统烧录
-
-
-
-上述准备工作都准备好之后,直接双击运行***win_flash.bat*** 批处理脚本将会进入系统烧录。接下来会出现一个选项:
-
-* 如果想只烧录/更新 **u-boot** 程序,则选择输入 **1**;
-* 如果想烧录/更新 **整个系统镜像**,  则选择输入 **2**;
-
-
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/系统烧录.png)
-
-
-
-烧录成功之后,批处理将会自动退出,调试串口上也将会提示相关信息。此后可以给开发板重新上电,设备将正常启动。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/烧录成功串口输出.png)
-
-
-
-### 3.3.6 系统启动
-
-系统重新上电后,串口调试终端上将会输出U-boot的启动信息,3秒内按任意键将会进入到 **U-boot** 调试模式,否则将会自动启动系统。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/u-boot启动信息.png)
-
-
-
-Linux系统启动后,我们可以使用用户名 **root**  ,默认密码 **12345** 登录系统。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/Linux系统登录.png)
-
-
-
-
-
-
-
-## 3.4 外置TF卡系统烧录
-
-
-
-### 3.3.1 跳线设置
-
-
-
-如下图所示,将 5/6、7/8、9/10、11/12 、13/14(看门狗跳线) 5个跳线全部短接,则进入外置TF卡启动模式,该模式下开发板上电后将从TF卡读取运行u-boot,进而加载并启动Linux系统。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/TF卡跳线帽子设置.png)
-
-### 3.3.2 软件准备
-
-
-
-在硬件设备准备好之后,我们还需要安装或准备好如下软件:
-
-
-
-* [**点击此链接下载**](http://weike-iot.com:2211/imx6ull/tools/wintools/ch341.7z) 并安装好  ***USB转串口调试器***  驱动 ;
-
-* [**点击此链接下载**](http://weike-iot.com:2211/imx6ull/tools/wintools/win32diskimager-1.0.0-install.exe) 并安装好 ***TF卡系统镜像烧录工具软件 win32diskimager***   ;
-
-
-
-### 3.3.3 烧录文件
-
-如前面 **Yocto系统编译** 相关章节所述,将前面源码编译输出的相关文件 拷贝/下载 到Windows系统下,并将系统镜像文件 解压缩出来。这里我们以 ***Yocto 系统编译出来的镜像*** 为例,详细讲解 ***TF卡的系统烧录过程*** ,其它的镜像也都可以使用同样的方式来烧录。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/yocto系统镜像烧录文件.png)
-
-### 3.3.4 镜像烧录
-
-
-
-在Windows系统下,我们可以使用 ***USB接口的TF读卡器***  配合 ***win32diskimager软件*** 来烧录前面编译制作好的系统镜像。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/TF卡读卡器.png)
-
-
-
-运行 ***Win32DiskImager*** 系统镜像烧录程序,选中相应的系统镜像文件和TF卡对应的分区,然后点击 ***写入*** 开始烧写系统镜像。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/ImageWriter烧录.png)
-
-
-
-### 3.3.5 系统启动
-
-
-
-TF卡上系统烧录成功之后,将TF卡插入到 IGKBoard 开发板上的TF卡槽上,设置好开发板的跳线帽子,设置从TF卡启动。开发板上电后,串口调试终端上将会输出U-boot的启动信息,3秒内按任意键将会进入到 **U-boot** 调试模式,否则将会自动启动Linux系统。Linux系统启动后,我们可以使用用户名 **root**  ,默认密码 **12345** 登录系统。
-
-![](https://gitee.com/iotcraft/imx6ull/raw/master/yocto系统linux启动.png)
+接下来我们可以将 ***linuxsys-image-igkboard.wic.bz2*** 和 ***u-boot-igkboard.imx*** 两个镜像文件,下载到 Windows系统下并解压缩,参考烧录文档即可升级该系统镜像文件。
 

--
Gitblit v1.9.1