From 1cf11837deb7459de5c0df84075c250c5d7fe25a Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Fri, 22 Dec 2023 10:15:43 +0800
Subject: [PATCH] Update yocto build shell script

---
 yocto/build.sh |   47 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 37 insertions(+), 10 deletions(-)

diff --git a/yocto/build.sh b/yocto/build.sh
index 7bea625..aec649e 100755
--- a/yocto/build.sh
+++ b/yocto/build.sh
@@ -9,8 +9,14 @@
 # top project absolute path
 TOP_PATH=$(realpath $PRJ_PATH/..)
 
-# binaries install path
-INST_PATH=$PRJ_PATH/install
+# prefix install path
+PRFX_PATH=$PRJ_PATH/install
+
+# final install path
+#INST_PATH=/srv/ftp/
+
+# compress system image or not
+#COMPRESS=yes
 
 # download taballs path
 TARBALL_PATH=$PRJ_PATH/tarballs
@@ -127,7 +133,9 @@
     fi
 
     pr_warn "start update BSP patches for $YCT_META"
+    BSP_VER=`echo $BSP_VER | sed 's/imx/lf/'`
     cp $TOP_PATH/bootloader/patches/${BOARD}/uboot-imx-${BSP_VER}.patch $PRJ_PATH/$YCT_META/recipes-bsp/u-boot/files/
+    cp $TOP_PATH/bootloader/patches/${BOARD}/imx-atf-${BSP_VER}.patch $PRJ_PATH/$YCT_META/recipes-bsp/imx-atf/files/
     cp $TOP_PATH/kernel/patches/${BOARD}/linux-imx-${BSP_VER}.patch $PRJ_PATH/$YCT_META/recipes-kernel/linux/files/
 
     if [ ! -e $YCT_PATH/sources/$YCT_META ] ; then
@@ -160,22 +168,41 @@
     cd $YCT_PATH
 
     echo ""
-    pr_info "Yocto($YCT_VER) installed to '$INST_PATH'"
+    pr_info "Yocto($YCT_VER) installed to '$PRFX_PATH'"
 
-    mkdir -p ${INST_PATH}
-    cp $YCT_PATH/$BUILD_DIR/tmp/deploy/images/$BOARD/$BB_TARGET-$BOARD.wic.zst ${INST_PATH}/yocto-image-${YCT_VER}.wic.zst
-    cp $YCT_PATH/$BUILD_DIR/tmp/deploy/images/$BOARD/$BB_TARGET-$BOARD.tar.zst ${INST_PATH}/rootfs-yocto-${YCT_VER}.tar.zst
-    cp $YCT_PATH/$BUILD_DIR/tmp/deploy/images/$BOARD/imx-boot ${INST_PATH}/u-boot-${BOARD}.imx
-    chmod a+x ${INST_PATH}/u-boot-${BOARD}.imx
+    mkdir -p ${PRFX_PATH}
+    cp $YCT_PATH/$BUILD_DIR/tmp/deploy/images/$BOARD/$BB_TARGET-$BOARD.wic ${PRFX_PATH}/
+    cp $YCT_PATH/$BUILD_DIR/tmp/deploy/images/$BOARD/$BB_TARGET-$BOARD.tar.zst ${PRFX_PATH}/
+    cp $YCT_PATH/$BUILD_DIR/tmp/deploy/images/$BOARD/imx-boot ${PRFX_PATH}/u-boot-${BOARD}.imx
+    chmod a+x ${PRFX_PATH}/u-boot-${BOARD}.imx
+    ls ${PRFX_PATH} && echo ""
 
-    ls ${INST_PATH} && echo ""
+    if [ -n "$INST_PATH" -a -w $INST_PATH ] ; then
+
+        cd ${PRFX_PATH}/
+
+        rm -f $BB_TARGET-$BOARD.wic.bz2
+
+        if [[ `echo $COMPRESS | tr 'A-Z' 'a-z'` == "yes" ]] ; then
+            pr_info "Start bzip2 compress $BB_TARGET-$BOARD.wic"
+            bzip2 $BB_TARGET-$BOARD.wic
+        fi
+
+        pr_info "Start copy Yocto system images to $INST_PATH"
+        cp u-boot-${BOARD}.imx       $INST_PATH
+        cp $BB_TARGET-$BOARD.wic*    $INST_PATH
+        cp $BB_TARGET-$BOARD.tar.zst $INST_PATH
+
+        ls ${INST_PATH} && echo ""
+    fi
+
 }
 
 function do_clean()
 {
     cd $PRJ_PATH
 
-    rm -rf $INST_PATH
+    rm -rf $PRFX_PATH
 }
 
 #+-------------------------+

--
Gitblit v1.9.1