瀏覽代碼

create build script

http://192.168.110.82/redmine/issues/1605

create build script to simplify the build procedures for CI automation,

Signed-off-by: Jason Zhou  <jason.zhou@starfivetech.com>
Jason Zhou 1 年之前
父節點
當前提交
66000fbafd
共有 1 個文件被更改,包括 79 次插入0 次删除
  1. 79 0
      build.sh

+ 79 - 0
build.sh

@@ -0,0 +1,79 @@
+#!/bin/bash
+##################################################################
+##                                                              ##
+##      SPDX-License-Identifier: GPL-2.0-or-later               ##
+##                                                              ##
+##	Copyright (C) 2018-2022   Starfive Technology           ##  
+##                                                              ##
+##	Author:	jason zhou  <jason.zhou@starfivetech.com>       ##
+##                                                              ##
+##################################################################
+
+COLOR_NORMAL="\033[0m"
+COLOR_GREEN="\033[1;32m"
+COLOR_YELLOW="\033[1;33m"
+COLOR_RED="\033[1;31m"
+COLOR_GREY="\033[1;30m"
+
+printf ${COLOR_GREEN}
+printf "JH7110 Build Script"
+echo $0 $1
+
+#default
+cpu_numb_input="1"
+
+if [ $1 ]
+then
+	#cmdline para input cpu processor number
+	echo $1
+	cpu_numb_input=$1
+else
+	#interactive input cpu number
+	num=`cat /proc/cpuinfo | grep "processor" | wc -l`
+	printf "please input the cpu number to perform concurrent build, choose 1 ~ $num:\n"
+
+	read cpu_numb_input
+	if (( $cpu_numb_input > $num ))
+	then
+		echo "input > $num  error, exit"
+		exit 1
+	fi
+
+	if (( $cpu_numb_input  <  1 ))
+	then
+		echo "input < 1 error, exit"
+		exit 1
+	fi
+
+	echo ""
+	echo "make -j$cpu_numb_input"
+fi
+
+printf ${COLOR_NORMAL}
+
+# clean all including rootfs
+#rm -rf work/
+
+# clean kernel built
+make clean
+
+tag=`git describe`
+echo "make -j$cpu_numb_input > build.$tag.log"
+make -j$cpu_numb_input > build.$tag.log
+
+echo "./build_soft_3rdpart.sh >>  build.$tag.log"
+./build_soft_3rdpart.sh >>  build.$tag.log
+
+echo "rm initramfs, than rebuild"
+rm -rf work/initramfs.cpio.gz
+
+echo "make -j$cpu_numb_input >> build.$tag.log"
+make -j$cpu_numb_input >> build.$tag.log
+
+
+echo ""
+echo "Rootfs & Kernel version string:"
+strings work/image.fit | grep "JH7110_51"
+echo ""
+echo "u-boot version string:"
+strings work/u-boot/u-boot.bin | grep "JH7110_51"