From df8b7cb3178dd71312d415b07007d6987e901c25 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sun, 26 Dec 2021 20:20:47 +0800
Subject: [PATCH] update yocto project uboot patch and readme file

---
 yocto/meta-igkboard/README.md                                         |  131 ++++++++++++++++++++++++++++++++
 /dev/null                                                             |   41 ----------
 yocto/meta-igkboard/recipes-bsp/u-boot/files/uboot-imx-igkboard.patch |   46 +++++++---
 3 files changed, 162 insertions(+), 56 deletions(-)

diff --git a/yocto/meta-igkboard/README b/yocto/meta-igkboard/README
deleted file mode 100644
index 62bd791..0000000
--- a/yocto/meta-igkboard/README
+++ /dev/null
@@ -1,41 +0,0 @@
-This README file contains information on the contents of the meta-igkboard layer.
-
-Please see the corresponding sections below for details.
-
-Dependencies
-============
-
-  URI: <first dependency>
-  branch: <branch name>
-
-  URI: <second dependency>
-  branch: <branch name>
-
-  .
-  .
-  .
-
-Patches
-=======
-
-Please submit any patches against the meta-igkboard layer to the xxxx mailing list (xxxx@zzzz.org)
-and cc: the maintainer:
-
-Maintainer: XXX YYYYYY <xxx.yyyyyy@zzzzz.com>
-
-Table of Contents
-=================
-
-  I. Adding the meta-igkboard layer to your build
- II. Misc
-
-
-I. Adding the meta-igkboard layer to your build
-=================================================
-
-Run 'bitbake-layers add-layer meta-igkboard'
-
-II. Misc
-========
-
---- replace with specific information about the meta-igkboard layer ---
diff --git a/yocto/meta-igkboard/README.md b/yocto/meta-igkboard/README.md
new file mode 100644
index 0000000..033ebbe
--- /dev/null
+++ b/yocto/meta-igkboard/README.md
@@ -0,0 +1,131 @@
+本目录为凌云实验室针对IGKBoard开发板移植的Yocto Hardknott (Yocto 3.3) 项目源码,关于Yocto系统的详细使用,大家可以参考NXP官方的用户手册文档,[点此链接下载](https://www.nxp.com/docs/en/user-guide/IMX_YOCTO_PROJECT_USERS_GUIDE.pdf) 。
+
+
+
+如果想源码编译Yocto系统的话,则系统需要满足:
+
+* 推荐使用 Ubuntu 20.04 系统;
+* 推荐使用 4核以上CPU;
+* 硬盘空间至少要求 200GB+;
+
+
+
+### 1. 下载Yocto源码
+
+
+
+如果没有 ***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"
+```
+
+
+
+首先下载并安装 google 的 ***repo*** 命令:
+
+```
+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/ 
+```
+
+
+
+使用 **git** 命令克隆下载该项目源码:
+
+```
+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.
+```
+
+
+
+使用 ***repo*** 命令下载 **Yocto Hardknott** 源码:
+
+```
+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. 编译Yocto系统
+
+
+
+首先将该本文件夹Yocto针对IGKBoard的移植源码拷贝到 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
+
+ Build directory is  igkboard
+/home/guowenxue/workspace/imx-yocto-bsp
+    Welcome LingYun IoT Gateway Kit Board Yocto BSP
+
+    The Yocto Project has extensive documentation about OE including a
+    reference manual which can be found at:
+        http://yoctoproject.org/documentation
+
+    You can now run 'bitbake <target>'
+
+    Common targets are:
+        linuxsys-image
+        core-image-minimal
+        imx-image-full
+```
+
+
+
+接下来使用下面命令,开始Yocto系统的源码编译,这个系统编译时间较长,如果编译的过程中出现错误,再重新开始编译即可。也可以使用 ***-k*** 选项先跳过编译出错的软件包。
+
+```
+guowenxue@ubuntu20:/workspace/imx-yocto-bsp/igkboard$ bitbake linuxsys-image
+```
+
+
+
+### 3. Yocto编译输出
+
+
+
+编译过程中下载的软件包存放在 ***~/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烧录系统镜像文件
+```
+
+
+
diff --git a/yocto/meta-igkboard/recipes-bsp/u-boot/files/uboot-imx-igkboard.patch b/yocto/meta-igkboard/recipes-bsp/u-boot/files/uboot-imx-igkboard.patch
index 451bb3c..3c02384 100644
--- a/yocto/meta-igkboard/recipes-bsp/u-boot/files/uboot-imx-igkboard.patch
+++ b/yocto/meta-igkboard/recipes-bsp/u-boot/files/uboot-imx-igkboard.patch
@@ -1,6 +1,6 @@
 diff -Nuar uboot-imx/arch/arm/dts/imx6ul-14x14-evk.dtsi uboot-imx-igkboard/arch/arm/dts/imx6ul-14x14-evk.dtsi
 --- uboot-imx/arch/arm/dts/imx6ul-14x14-evk.dtsi	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/arch/arm/dts/imx6ul-14x14-evk.dtsi	2021-12-16 17:12:11.714490021 +0800
++++ uboot-imx-igkboard/arch/arm/dts/imx6ul-14x14-evk.dtsi	2021-12-18 19:24:57.848022011 +0800
 @@ -21,7 +21,6 @@
  		regulator-name = "VSD_3V3";
  		regulator-min-microvolt = <3300000>;
@@ -117,7 +117,7 @@
  
 diff -Nuar uboot-imx/configs/igkboard_defconfig uboot-imx-igkboard/configs/igkboard_defconfig
 --- uboot-imx/configs/igkboard_defconfig	1970-01-01 08:00:00.000000000 +0800
-+++ uboot-imx-igkboard/configs/igkboard_defconfig	2021-12-16 17:25:11.551447847 +0800
++++ uboot-imx-igkboard/configs/igkboard_defconfig	2021-12-26 19:59:10.026382816 +0800
 @@ -0,0 +1,96 @@
 +CONFIG_ARM=y
 +CONFIG_ARCH_MX6=y
@@ -215,9 +215,23 @@
 +CONFIG_SYS_WHITE_ON_BLACK=y
 +CONFIG_SPLASH_SCREEN=y
 +CONFIG_SPLASH_SCREEN_ALIGN=y
+diff -Nuar uboot-imx/drivers/fastboot/fb_fsl/fb_fsl_partitions.c uboot-imx-igkboard/drivers/fastboot/fb_fsl/fb_fsl_partitions.c
+--- uboot-imx/drivers/fastboot/fb_fsl/fb_fsl_partitions.c	2021-09-06 16:48:23.000000000 +0800
++++ uboot-imx-igkboard/drivers/fastboot/fb_fsl/fb_fsl_partitions.c	2021-12-26 19:34:18.512291074 +0800
+@@ -185,6 +185,10 @@
+ 			boot_partition = FASTBOOT_MMC_BOOT_PARTITION_ID;
+ 			user_partition = FASTBOOT_MMC_USER_PARTITION_ID;
+ 		}
++
++		/* add by guowenxue to export mmc_no env */
++		env_set_ulong("mmc_no", mmc_no);
++		env_set_ulong("mmcdev", mmc_no);
+ 	} else {
+ 		printf("Can't setup partition table on this device %d\n",
+ 			fastboot_devinfo.type);
 diff -Nuar uboot-imx/drivers/net/phy/phy.c uboot-imx-igkboard/drivers/net/phy/phy.c
 --- uboot-imx/drivers/net/phy/phy.c	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/drivers/net/phy/phy.c	2021-12-16 17:12:11.714490021 +0800
++++ uboot-imx-igkboard/drivers/net/phy/phy.c	2021-12-18 19:24:57.848022011 +0800
 @@ -182,6 +182,9 @@
  {
  	int result;
@@ -230,15 +244,15 @@
  
 diff -Nuar uboot-imx/include/configs/mx6ullevk.h uboot-imx-igkboard/include/configs/mx6ullevk.h
 --- uboot-imx/include/configs/mx6ullevk.h	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/include/configs/mx6ullevk.h	2021-12-16 17:12:11.714490021 +0800
-@@ -100,124 +100,39 @@
++++ uboot-imx-igkboard/include/configs/mx6ullevk.h	2021-12-26 19:43:02.601118471 +0800
+@@ -100,124 +100,38 @@
  
  #else
  #define CONFIG_EXTRA_ENV_SETTINGS \
 -	CONFIG_MFG_ENV_SETTINGS \
 -	TEE_ENV \
-+    "emmc_dev=1\0"\
-+    "emmc_ack=1\0"\
++    "emmc_dev=${mmc_no}\0"\
++    "emmc_ack=${mmc_no}\0"\
  	"script=boot.scr\0" \
  	"image=zImage\0" \
  	"console=ttymxc0\0" \
@@ -252,11 +266,9 @@
 -	"boot_fdt=try\0" \
 -	"ip_dyn=yes\0" \
  	"splashimage=0x8c000000\0" \
-+    "ipaddr=192.168.2.22\0" \
-+    "serverip=192.168.2.2\0" \
- 	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
- 	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
- 	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
+-	"mmcdev="__stringify(CONFIG_SYS_MMC_ENV_DEV)"\0" \
+-	"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
+-	"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
 -	"mmcautodetect=yes\0" \
 -	"mmcargs=setenv bootargs console=${console},${baudrate} " \
 -		BOOTARGS_CMA_SIZE \
@@ -265,7 +277,10 @@
 -		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 -	"bootscript=echo Running bootscript from mmc ...; " \
 -		"source\0" \
-+    "mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}\0" \
++    "ipaddr=192.168.2.22\0" \
++    "serverip=192.168.2.2\0" \
++    "mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
++    "mmcargs=setenv bootargs console=${console},${baudrate} root=/dev/mmcblk${mmc_no}p2 rootwait rw\0" \
 +    "loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
 +    "bootscript=echo Running bootscript from mmc ...; source\0" \
  	"loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \
@@ -373,11 +388,12 @@
 +        "run mmcargs; " \
 +        "bootz ${loadaddr} - ${fdt_addr}\0" \
 +    "bootcmd=run mmcboot\0" \
++    "upmode=fastboot 0\0" \
 +    "bbl=tftp ${loadaddr} u-boot-igkboard-emmc.imx && mmc dev ${mmcdev} 1 && mmc write ${loadaddr} 2 0x500\0"
  #endif
  
  /* Miscellaneous configurable options */
-@@ -238,7 +153,9 @@
+@@ -238,7 +152,9 @@
  	(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
  
  /* environment organization */
@@ -389,7 +405,7 @@
  #define CONFIG_IOMUX_LPSR
 diff -Nuar uboot-imx/Makefile uboot-imx-igkboard/Makefile
 --- uboot-imx/Makefile	2021-09-06 16:48:23.000000000 +0800
-+++ uboot-imx-igkboard/Makefile	2021-12-16 17:23:36.221057260 +0800
++++ uboot-imx-igkboard/Makefile	2021-12-26 19:58:58.142407641 +0800
 @@ -263,6 +263,9 @@
  CROSS_COMPILE ?=
  endif

--
Gitblit v1.9.1