forked from riptidewave93/LEDE-APU2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·74 lines (61 loc) · 1.31 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
#!/bin/bash
firstbuild=0
clonedir=./lede
cpu_num=$(grep -c processor /proc/cpuinfo)
# Print messages in cyan blue
Msg() {
echo -e "\e[96m$1\e[39m"
}
# Do we want menuconfig's and an option to save configs?
if [ "$1" = "modify" ]; then
modify=1
else
modify=0
fi
Msg "Starting Build Process!"
if [ ! -d "$clonedir" ]; then
firstbuild=1
Msg "Cloning Repo..."
git clone https://github.com/lede-project/source $clonedir
cd $clonedir
git reset --hard 175b59c59b7cd8f40bdb3a8f3c6fec05e46c5299
cd - > /dev/null
fi
if [ "$firstbuild" -eq "0" ]; then
Msg "Cleaning Builddir..."
cd $clonedir
rm -rf ./bin
cd - > /dev/null
fi
Msg "Applying overlay..."
cp -R ./overlay/* $clonedir/
if [ "$firstbuild" -eq "1" ]; then
Msg "Installing feeds..."
cd $clonedir
./scripts/feeds update -a
./scripts/feeds install -a
if [ -f "../config/diffconfig" ]; then
Msg "Applying and Expanding config..."
cp ../config/diffconfig ./.config
make defconfig
fi
cd - > /dev/null
fi
if [ "$modify" -eq "1" ]; then
cd $clonedir
Msg "Loading Menuconfig"
make menuconfig -j$cpu_num V=s
cd - > /dev/null
fi
Msg "Building Time!!!"
cd $clonedir
make -j$cpu_num V=s
if [ $? -ne 0 ]; then
cd - > /dev/null
Msg "Build Failed!"
exit 1
else
cd - > /dev/null
Msg "Compile Complete!"
fi
Msg "Build.sh Finished!"