forked from starfive-tech/VisionFive2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·101 lines (78 loc) · 2.21 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
##################################################################
## ##
## SPDX-License-Identifier: GPL-2.0-or-later ##
## ##
## Copyright (C) 2018-2022 Starfive Technology ##
## ##
## Author: jason zhou <[email protected]> ##
## ##
##################################################################
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"
#real cpu number
num=`cat /proc/cpuinfo | grep "processor" | wc -l`
if [ $1 ]
then
#cmdline para input cpu processor number
echo $1
cpu_numb_input=$1
else
printf "please input the cpu number to perform concurrent build, choose 1 ~ $num:\n"
read cpu_numb_input
fi
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
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 | tee build.$tag.log
if (( $? > 0 ))
then
echo "build failed! exit!"
exit 1
fi
echo "./build_soft_3rdpart.sh >> build.$tag.log"
./build_soft_3rdpart.sh | tee -a build.$tag.log
if (( $? > 0 ))
then
echo "build 3rd part software failed! exit!"
exit 1
fi
echo "rm initramfs, than rebuild"
rm -rf work/initramfs.cpio.gz | tee -a build.$tag.log
echo "make -j$cpu_numb_input >> build.$tag.log"
make -j$cpu_numb_input | tee -a build.$tag.log
if (( $? > 0 ))
then
echo "build failed! exit!"
exit 1
else
echo "build images success!!!"
fi
echo ""
echo "Rootfs & Kernel version string:" | tee -a build.$tag.log
strings work/image.fit | grep "JH7110_51" | tee -a build.$tag.log
echo ""
echo "u-boot version string:" | tee -a build.$tag.log
strings work/u-boot/u-boot.bin | grep "JH7110_51" | tee -a build.$tag.log