From 34d436c8c0fe36d468f8c11ef97a9cfb91486ce9 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Wed, 26 Jul 2023 14:44:51 +0800
Subject: [PATCH] Update u-boot and add uenv support

---
 recipes-bsp/u-boot/files/uboot-logo-igkboard-6ull.bmp |    0 
 recipes-bsp/u-boot/files/config-igkboard-6ull.txt     |   29 ++++++++++++++
 recipes-bsp/u-boot/uenv_1.0.bb                        |   29 ++++++++++++++
 conf/machine/igkboard-6ull.conf                       |    7 +++
 recipes-bsp/u-boot/u-boot-imx_2022.04.bbappend        |    6 +-
 5 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/conf/machine/igkboard-6ull.conf b/conf/machine/igkboard-6ull.conf
index 56aadf3..5b5afd2 100644
--- a/conf/machine/igkboard-6ull.conf
+++ b/conf/machine/igkboard-6ull.conf
@@ -35,11 +35,16 @@
 UBOOT_CONFIG ??= "sd"
 UBOOT_CONFIG[sd] = "${MACHINE}_defconfig,sdcard"
 
+# Add wic image in deploy folder
+SOC_DEFAULT_IMAGE_FSTYPES:append = " wic"
+
 # Define the kernel boot file
+WKS_FILE_DEPENDS:append = " uenv"
 IMAGE_BOOT_FILES = " \
     ${KERNEL_IMAGETYPE} \
     ${KERNEL_DEVICETREE} \
     overlays/*;overlays/ \
+    config.txt \
 "
 # Remove unused optee bcm4339 bcm43455
 MACHINE_FEATURES += "wifi bluetooth"
@@ -48,4 +53,4 @@
 SERIAL_CONSOLES = "115200;ttymxc0"
 
 # /etc/hostname (uname -a)
-hostname_pn-base-files = "igkboard"
+hostname:pn-base-files = "igkboard"
diff --git a/recipes-bsp/u-boot/files/config-igkboard-6ull.txt b/recipes-bsp/u-boot/files/config-igkboard-6ull.txt
new file mode 100644
index 0000000..d23b6fd
--- /dev/null
+++ b/recipes-bsp/u-boot/files/config-igkboard-6ull.txt
@@ -0,0 +1,29 @@
+# Enable LCD overlay
+#dtoverlay_lcd=yes
+
+# Enable Camera overlay
+#dtoverlay_cam=yes
+
+# Eanble 1-Wire overlay
+#dtoverlay_w1=yes
+
+# Enable ADC overlay
+#dtoverlay_adc=yes
+
+# Enable I2C overlay
+#dtoverlay_i2c=1
+
+# Enable SPI overlay, SPI1 conflict with UART8(NB-IoT/4G module)
+#dtoverlay_spi=1
+
+# Enable UART overlays
+#dtoverlay_uart=2 3 4 7
+
+# Enable CAN overlays
+#dtoverlay_can=1 2
+
+# Enable PWM overlays, PWM8 conflict with UART8(NB-IoT/4G module)
+#dtoverlay_pwm=7
+
+# Enable extra overlays
+#dtoverlay_extra=nbiot-4g
diff --git a/recipes-bsp/u-boot/files/lingyun.bmp b/recipes-bsp/u-boot/files/uboot-logo-igkboard-6ull.bmp
similarity index 100%
rename from recipes-bsp/u-boot/files/lingyun.bmp
rename to recipes-bsp/u-boot/files/uboot-logo-igkboard-6ull.bmp
Binary files differ
diff --git a/recipes-bsp/u-boot/u-boot-imx_2022.04.bbappend b/recipes-bsp/u-boot/u-boot-imx_2022.04.bbappend
index 7410a4b..0365adb 100644
--- a/recipes-bsp/u-boot/u-boot-imx_2022.04.bbappend
+++ b/recipes-bsp/u-boot/u-boot-imx_2022.04.bbappend
@@ -1,7 +1,7 @@
 FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
 SRC_URI:append = " file://uboot-imx-lf-5.15.71-2.2.0.patch "
 
-addtask copy_bmp after do_unpack before do_configure
-do_copy_bmp(){
-    cp ${BSPDIR}/sources/meta-igkboard/recipes-bsp/u-boot/files/lingyun.bmp ${S}/tools/logos/
+addtask copy_logo after do_unpack before do_configure
+do_copy_logo(){
+    cp ${BSPDIR}/sources/meta-igkboard/recipes-bsp/u-boot/files/uboot-logo-${MACHINE}.bmp ${S}/tools/logos/lingyun.bmp
 }
diff --git a/recipes-bsp/u-boot/uenv_1.0.bb b/recipes-bsp/u-boot/uenv_1.0.bb
new file mode 100644
index 0000000..b632d6c
--- /dev/null
+++ b/recipes-bsp/u-boot/uenv_1.0.bb
@@ -0,0 +1,29 @@
+DESCRIPTION = "U-boot Env from config.txt"
+SECTION = "app"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
+
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+FILES:${PN} = "/boot"
+
+S = "${WORKDIR}"
+
+SRC_URI = " " 
+SRC_URI = " \ 
+    file://config-${MACHINE}.txt \
+"
+
+do_install() {
+    install -d ${D}/boot
+    install -m 0644 ${S}/config-${MACHINE}.txt ${D}/boot/config.txt
+}
+
+inherit deploy
+addtask deploy after do_install
+
+do_deploy () {
+    install -m 0644 ${D}/boot/config.txt ${DEPLOYDIR}
+}
+
+COMPATIBLE_MACHINE = "(igkboardbase)"
+PACKAGE_ARCH = "${MACHINE_ARCH}"

--
Gitblit v1.9.1