forked from AOSP-JF-MM/platform_kernel_xiaomi_msm8996
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclean-all.sh
executable file
·64 lines (53 loc) · 1.49 KB
/
clean-all.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
#!/bin/bash
LANG=C
# location
KERNELDIR=$(readlink -f .);
PYTHON_CHECK=$(ls -la /usr/bin/python | grep python3 | wc -l);
PYTHON_WAS_3=0;
if [ "$PYTHON_CHECK" -eq "1" ] && [ -e /usr/bin/python2 ]; then
if [ -e /usr/bin/python2 ]; then
rm /usr/bin/python
ln -s /usr/bin/python2 /usr/bin/python
echo "Switched to Python2 for cleaning kernel will switch back when done";
PYTHON_WAS_3=1;
else
echo "You need Python2 to clean this kernel. install and come back."
exit 1;
fi;
else
echo "Python2 is used! all good, cleaning!";
fi;
rm .config .config.bkp .config.old;
make ARCH=arm64 mrproper;
make clean;
rm -rf "$KERNELDIR"/B--B/boot
rm -f "$KERNELDIR"/B--B/system/lib/modules/*;
rm -f "$KERNELDIR"/B--B/*.zip
rm -f "$KERNELDIR"/B--B/*.img
rm -f "$KERNELDIR"/B--B/view_only_config
rm -f "$KERNELDIR"/B--B/.config
if [ -d ../Ramdisk-Gemini-tmp ]; then
rm -rf ../Ramdisk-Gemini-tmp/*
else
mkdir ../Ramdisk-Gemini-tmp
chown root:root ../Ramdisk-Gemini-tmp
chmod 777 ../Ramdisk-Gemini-tmp
fi;
# force regeneration of .dtb and Image files for every compile
rm -f arch/arm64/boot/*.dtb
rm -f arch/arm64/boot/dts/*.dtb
rm -f arch/arm64/boot/*.cmd
rm -f arch/arm64/boot/zImage
rm -f arch/arm64/boot/Image
rm -f arch/arm64/boot/Image.gz
rm -f arch/arm64/boot/Image.gz-dtb
if [ "$PYTHON_WAS_3" -eq "1" ]; then
rm /usr/bin/python
ln -s /usr/bin/python3 /usr/bin/python
fi;
git checkout firmware/
# clean ccache
read -t 5 -p "clean ccache, 5sec timeout (y/n)?";
if [ "$REPLY" == "y" ]; then
ccache -C;
fi;