-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·63 lines (49 loc) · 1.57 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
#!/bin/bash
export kernel=Samsung
export outdir=/home/hasagi/Desolation/out/target/product/gtexswifi
export makeopts="-j$(nproc)"
export device_defconfig="gtexswifi-dt_defconfig"
export zImagePath="build/arch/arm/boot/zImage"
export KBUILD_BUILD_USER=hasagi
export KBUILD_BUILD_HOST=Master
export CROSS_COMPILE="ccache /home/hasagi/Desolation/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-"
export ARCH=arm
export shouldclean="0"
export device="gtexswifi"
export version=$(cat version)
export RDIR=$(pwd)
function build() {
if [[ $shouldclean =~ "1" ]] ; then
rm -rf build
fi
mkdir -p build
make -C ${RDIR} O=build ${makeopts} ${device_defconfig}
make -C ${RDIR} O=build ${makeopts}
make -C ${RDIR} O=build ${makeopts} modules
make -C ${RDIR} O=build ${makeopts} dtbs
./scripts/mkdtimg.sh -i ${RDIR}/arch/arm/boot/dts/ -o dtb
if [ -a ${zImagePath} ] ; then
cp ${zImagePath} zip/zImage
cp arch/arm/boot/dtb zip/dtb
mkdir -p zip/modules
find -name '*.ko' -exec cp -av {} zip//modules/ \;
cd zip
zip -q -r ${kernel}-${device}-${version}.zip anykernel.sh META-INF tools zImage dtb modules
else
echo -e "\n\e[31m***** Build Failed *****\e[0m\n"
fi
if ! [ -d ${outdir} ] ; then
mkdir ${outdir}
fi
if [ -a ${kernel}-${device}-${version}.zip ] ; then
mv -v ${kernel}-${device}-${version}.zip ${outdir}
fi
cd ${RDIR}
rm -f zip/zImage
rm -rf zip/modules/*
rm -f zip/dtb
}
if [[ $1 =~ "clean" ]] ; then
shouldclean="1"
fi
build