-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·100 lines (85 loc) · 2.02 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
#!/bin/bash
#
# Color UI
#
grn=$(tput setaf 2) # green
yellow=$(tput setaf 3) # yellow
bldgrn=${txtbld}$(tput setaf 2) # bold green
red=$(tput setaf 1) # red
txtbld=$(tput bold) # bold
bldblu=${txtbld}$(tput setaf 4) # bold blue
blu=$(tput setaf 4) # blue
txtrst=$(tput sgr0) # reset
blink=$(tput blink) # blink
#
# Clean stuff
#
if [ -d "out/arch/arm64/boot/" ]; then
rm -rf "out/arch/arm64/boot/"
fi
#
# build from
#
export KBUILD_BUILD_USER="Peppe289"
export KBUILD_BUILD_HOST="RaveRules"
#
# start build date
#
DATE=$(date +"%Y%m%d-%H%M")
START=$(date +"%s")
#
# Compiler type
#
TOOLCHAIN_DIRECTORY="../toolchain"
TOOLCHAIN_ARM32="gcc-arm"
TOOLCHAIN_ARM64="gcc-arm64"
#
# Build defconfig
#
DEFCONFIG="begonia_user_defconfig"
#
# Check for compiler
#
if [ ! -d "$TOOLCHAIN_DIRECTORY" ]; then
mkdir $TOOLCHAIN_DIRECTORY
fi
if [ -d "$TOOLCHAIN_DIRECTORY/$TOOLCHAIN_ARM32" ]; then
echo -e "${bldgrn}"
echo "Toolchain arm32 ready"
echo -e "${txtrst}"
else
echo -e "${red}"
echo "Need to download toolchain arm32"
echo -e "${txtrst}"
git clone --depth=1 https://github.com/mvaisakh/gcc-arm.git $TOOLCHAIN_DIRECTORY/$TOOLCHAIN_ARM32
fi
if [ -d "$TOOLCHAIN_DIRECTORY/$TOOLCHAIN_ARM64" ]; then
echo -e "${bldgrn}"
echo "Toolchain arm64 ready"
echo -e "${txtrst}"
else
echo -e "${red}"
echo "Need to download toolchain arm64"
echo -e "${txtrst}"
git clone --depth=1 https://github.com/mvaisakh/gcc-arm64.git $TOOLCHAIN_DIRECTORY/$TOOLCHAIN_ARM64
fi
#
# Build start
#
export CROSS_COMPILE=$(pwd)/$TOOLCHAIN_DIRECTORY/$TOOLCHAIN_ARM64/bin/aarch64-elf-
export CROSS_COMPILE_ARM32=$(pwd)/$TOOLCHAIN_DIRECTORY/$TOOLCHAIN_ARM32/bin/arm-eabi-
export ARCH=arm64
export SUBARCH=arm64
make O=out $DEFCONFIG
make O=out -j$(nproc --all)
#
# End build time
#
END=$(date +"%s")
DIFF=$(( END - START ))
if [ ! -f "out/arch/arm64/boot/Image.gz-dtb" ]; then
echo -e "${red}"
echo "Error"
echo -e "${txtrst}"
exit
fi