forked from TeraaBytee/kernel_builder
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.sh
executable file
·54 lines (47 loc) · 1.52 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
#!/bin/bash
#
# idk lmao
export maindir="$(pwd)"
export outside="${maindir}/.."
source "${outside}/env"
pack() {
if [ ! -d ${zipper} ]; then
git clone https://github.com/${zipper_repo} -b ${zipper_branch} "${zipper}"
cd "${zipper}" || exit 1
else
cd "${zipper}" || exit 1
git reset --hard
git checkout ${zipper_branch}
git fetch origin ${zipper_branch}
git reset --hard origin/${zipper_branch}
fi
cp -af "${out_image}" "${zipper}"
cp -af "${out_dtb}" "${zipper}/dtb"
cp -af "${out_dtbo}" "${zipper}/dtbo.img"
if [ -e ${maindir}/banner_append ]; then
cat ${maindir}/banner_append >> ${zipper}/banner
fi
zip -r9 "$1" ./* -x .git README.md ./*placeholder
cd "${maindir}"
}
# build
for toolchain in $1; do
#rm -rf out
bash -x "${outside}/toolchains/${toolchain}.sh" setup
BUILD_START=$(date +"%s")
export CUR_TOOLCHAIN="${toolchain}"
bash -x "${outside}/toolchains/${toolchain}.sh" build ${defconfig}
if [ -e "${out_image}" ]; then
BUILD_END=$(date +"%s")
DIFF=$((BUILD_END - BUILD_START))
pack ${zip_name}
echo "build succeeded in $((DIFF / 60))m, $((DIFF % 60))s" > "${zip_name}.info"
echo "md5: $(md5sum "${zip_name}" | cut -d' ' -f1)" >> "${zip_name}.info"
echo "compiler: $(cat ${toolchain}.info)" >> "${zip_name}.info"
else
BUILD_END=$(date +"%s")
DIFF=$((BUILD_END - BUILD_START))
echo "build failed in $((DIFF / 60))m, $((DIFF % 60))s" > "${toolchain}.log.info"
echo "compiler: $(cat ${toolchain}.info)" >> "${toolchain}.log.info"
fi
done