From e766fcfbb4453d33abc4c2af1edd93fcdbfcb293 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 02 Sep 2024 09:35:59 +0800
Subject: [PATCH] update kernel build shell script for mkimage

---
 images/build.sh |   40 ++++++++++++++++++++++++++--------------
 1 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/images/build.sh b/images/build.sh
index 66ac829..66787ef 100755
--- a/images/build.sh
+++ b/images/build.sh
@@ -93,8 +93,8 @@
     export JOBS=`cat /proc/cpuinfo | grep processor | wc -l`
     export ARCH=arm
 
-	ROOTFS_SRC=rootfs
-	ROOTFS_IMG=rootfs-${BOARD}.ubi
+    ROOTFS_SRC=rootfs
+    ROOTFS_IMG=rootfs-${BOARD}.ubi
 
     export SRCS="rootfs"
 }
@@ -110,16 +110,16 @@
             continue
         fi
 
-		pr_info "start fetch $src source code"
-		mkdir -p $TARBALL_PATH
+        pr_info "start fetch $src source code"
+        mkdir -p $TARBALL_PATH
 
-		# Download source code packet
-		if [ ! -s $TARBALL_PATH/$src.tar.xz ] ; then
-			wget $BSP_URL/at91/bsp/$BSP_VER/$src.tar.xz -P $TARBALL_PATH
-		fi
+        # Download source code packet
+        if [ ! -s $TARBALL_PATH/$src.tar.xz ] ; then
+            wget $BSP_URL/at91/bsp/$BSP_VER/$src.tar.xz -P $TARBALL_PATH
+        fi
 
-		# decompress source code packet
-		do_unpack $TARBALL_PATH/$src.tar.xz $ROOTFS_SRC
+        # decompress source code packet
+        do_unpack $TARBALL_PATH/$src.tar.xz $ROOTFS_SRC
     done
 }
 
@@ -154,7 +154,7 @@
 
     #echo "Parition size ${partition_size}MiB and LEB=$LEB_CNT"
     set -x
-    sudo mkfs.ubifs -F -d ${ROOTFS_SRC} -m ${PAGE_SIZE} -e ${LEB_SIZE} -c $LEB_CNT -o ${ubimg_tmp}
+    fakeroot mkfs.ubifs -F -d ${ROOTFS_SRC} -m ${PAGE_SIZE} -e ${LEB_SIZE} -c $LEB_CNT -o ${ubimg_tmp}
     set +x
 
     # vol_size smaller than the actual size of the partition to leave room for Ubifs internal data.
@@ -174,6 +174,16 @@
 }
 
 
+function do_modify()
+{
+    cd $PRJ_PATH
+
+    pr_info "start modify rootfs ..."
+
+    cp patches/profile $ROOTFS_SRC/etc/profile
+    cp patches/S50sshd $ROOTFS_SRC/etc/init.d/S50sshd
+}
+
 function do_build()
 {
     cd $PRJ_PATH
@@ -182,7 +192,7 @@
     pr_info "start build rootfs image..."
     build_ubifs
 
-	mv $ROOTFS_IMG $PRFX_PATH
+    mv $ROOTFS_IMG $PRFX_PATH
 }
 
 function do_install()
@@ -191,8 +201,8 @@
 
     echo ""
     pr_info "install all images to '$PRFX_PATH'"
-	cp $TOP_PATH/bootloader/install/* $PRFX_PATH
-	cp $TOP_PATH/kernel/install/* $PRFX_PATH
+    cp $TOP_PATH/bootloader/install/* $PRFX_PATH
+    cp $TOP_PATH/kernel/install/* $PRFX_PATH
 
     ls $PRFX_PATH && echo ""
 
@@ -231,6 +241,8 @@
 
 do_fetch
 
+do_modify
+
 do_build
 
 do_install

--
Gitblit v1.9.1