From 7d3ba59670c2d966df7a1e9cdefd49f7aa8cc067 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Sun, 05 Jun 2022 22:16:28 +0800
Subject: [PATCH] Add IGKBoard meta for Yocto 3.4 Honister

---
 bsp/build.sh |   53 +++++++++++++++++++++++------------------------------
 1 files changed, 23 insertions(+), 30 deletions(-)

diff --git a/bsp/build.sh b/bsp/build.sh
index 8682796..3b0b538 100755
--- a/bsp/build.sh
+++ b/bsp/build.sh
@@ -3,43 +3,32 @@
 PRJ_PATH=`pwd`
 
 BOARD=igkboard
-
-#CROSS_TOOL=arm-linux-gnueabihf-
 CROSS_TOOL=/opt/buildroot/cortexA7/bin/arm-linux-
 
-# bootloader, linux kernel tarball path and branch
-TAR_PATH=${PRJ_PATH}/tarball
-BSP_BRANCH="lf-5.10.52-2.1.0"
+# SYSTEM  should be: buildroot, yocto or debian
+# DISTRO  should be: 2021.02, hardknott/honister, bullseye
+# SYSNAME should be: buildroot, yocto, bullseye
+SYSTEM=buildroot
+DISTRO=2021.02
 
-# rootfs should be buildroot/yocto or bullseye for debian system
-ROOTFS=buildroot
+SYSTEM=`echo $SYSTEM | tr 'A-Z' 'a-z'`
+DISTRO=`echo $DISTRO | tr 'A-Z' 'a-z'`
 
 set -u
 set -e
 
-function do_modify_build()
-{
-    DIR=$1
-
-    cd $PRJ_PATH
-
-    sed -i "s|^BOARD.*|BOARD=${BOARD}|g" ${DIR}/build.sh
-
-    if [ $DIR = bootloader -o $DIR == kernel ] ; then
-        sed -i "s|^CROSS_TOOL.*|CROSS_TOOL=${CROSS_TOOL}|g" ${DIR}/build.sh
-        sed -i "s|^BSP_BRANCH.*|BSP_BRANCH=${BSP_BRANCH}|g" ${DIR}/build.sh
-    elif [ $DIR = rootfs -o $DIR == images -o $DIR = tarball ] ; then
-        sed -i "s|^ROOTFS=.*|ROOTFS=${ROOTFS}|g" ${DIR}/build.sh
-    fi
-}
 
 function do_modify()
 {
-    do_modify_build tarball
-    do_modify_build bootloader
-    do_modify_build kernel
-    do_modify_build rootfs
-    do_modify_build images
+    cd $PRJ_PATH
+
+    FILE=scripts/setup_env.sh
+
+    sed -i "s|^BOARD.*|BOARD=${BOARD}|g" $FILE
+    sed -i "s|^CROSS_TOOL.*|CROSS_TOOL=${CROSS_TOOL}|g" $FILE
+
+    sed -i "s|^SYSTEM=.*|SYSTEM=${SYSTEM}|g" $FILE
+    sed -i "s|^DISTRO=.*|DISTRO=${DISTRO}|g" $FILE
 }
 
 function do_root()
@@ -61,6 +50,10 @@
     folder=$1
     action=$2
 
+    if [ ! -f $PRJ_PATH/$folder/build.sh ] ;then
+        return ;
+    fi
+
     cd $PRJ_PATH/$folder
 
     if [ $action == "build" ] ; then
@@ -71,7 +64,6 @@
 
     cd $PRJ_PATH
 }
-
 
 function do_usage()
 {
@@ -84,7 +76,8 @@
     echo ""
     echo " WARNNING: build/clean image need run as sudo"
     echo ""
-    echo "  Example: $0 -b bsp && sudo $0 -b image"
+    echo " Build Example: $0 -b bsp && sudo $0 -b image"
+    echo " Clean Example: $0 -c bsp && sudo $0 -c image"
     echo ""
     exit;
 }
@@ -117,7 +110,6 @@
 
 if [ $action == "build" ] ; then
     do_modify
-    cd tarball && ./build.sh && cd -
 fi
 
 if [ $1 == "bsp" ] ; then
@@ -126,6 +118,7 @@
     fi
     do_action bootloader $action
     do_action kernel $action
+    do_action drivers $action
 elif [ $1 == "image" ] ; then
     do_root "yes"
     do_action rootfs $action

--
Gitblit v1.9.1