This repository has been archived by the owner. It is now read-only.
forked from whiperhack/android_kernel_allview_p5_quad
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild
More file actions
executable file
·117 lines (97 loc) · 2.63 KB
/
Copy pathbuild
File metadata and controls
executable file
·117 lines (97 loc) · 2.63 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/sh
#by andr7e
toolchain="$HOME/kernel_build/android-toolchain-eabi-4.9/bin/arm-linux-androideabi-"
source_path="$HOME/kernel_build/android_kernel_allview_p5_quad"
#toolchain="$HOME/android-toolchain-eabi-4.9/bin/arm-linux-androideabi-"
#source_path="$HOME/android/kernel_test/"
export CROSS_COMPILE=$toolchain
export TARGET_PRODUCT=simcom89_wet_jb2 MTK_ROOT_CUSTOM=../mediatek/custom
export TARGET_BUILD_VARIANT=user
build_kernel()
{
cd kernel
echo "cleaning..."
make clean
make mrproper
echo "build kernel..."
make -j6
}
kernel_source_path="$source_path/kernel"
zImage_path="$kernel_source_path/arch/arm/boot/zImage"
mtktools_path="$source_path/mtktools"
dest_path="$mtktools_path/doha"
#add 512kb header
pack_kernel()
{
echo "create packed image..."
cd ../mediatek/build/tools
./mkimage $zImage_path KERNEL > "$mtktools_path/boot.img-kernel.img"
}
repack_boot()
{
echo "repacking boot..."
cd $mtktools_path
./repack.pl -boot boot.img-kernel.img boot.img-ramdisk "$dest_path/boot.img"
}
dest_cwm_path="$mtktools_path/cwm_recovery"
dest_twrp_path="$mtktools_path/twrp_recovery"
repack_recovery()
{
echo "repacking cwm..."
rm "$dest_cwm_path/recovery.img"
cd $mtktools_path
./repack.pl -recovery boot.img-kernel.img recovery.img-ramdisk-cwm "$dest_cwm_path/recovery.img"
cd $dest_cwm_path
zip -r recovery .
dest_twrp_path="$mtktools_path/twrp_recovery"
echo "repacking twrp..."
rm "$dest_twrp_path/recovery.img"
cd $mtktools_path
./repack.pl -recovery boot.img-kernel.img recovery.img-ramdisk-twrp "$dest_twrp_path/recovery.img"
cd $dest_twrp_path
zip -r recovery .
}
#modules
update_modules()
{
echo "install modules..."
cd $kernel_source_path
make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=./out/$TARGET_PRODUCT/system INSTALL_MOD_DIR=./out/$TARGET_PRODUCT/system android_modules_install
echo "copy modules..."
cp -r "$kernel_source_path/out/$TARGET_PRODUCT/system/lib/modules" "$dest_path/system/lib"
}
create_boot_patch()
{
echo "create flashable zip..."
cd $dest_path
zip -r out .
mv "$dest_path/out.zip" "$source_path/kernelP5Quad.zip"
}
#################################
echo $1
kernel_param="kernel"
recovery_param="recovery"
boot_param="boot"
if [ "$1" = "$kernel_param" ];
then
build_kernel
pack_kernel
else
if [ "$1" = "$recovery_param" ];
then
repack_recovery
else
if [ "$1" = "$boot_param" ];
then
repack_boot
update_modules
create_boot_patch
else
build_kernel
pack_kernel
repack_boot
update_modules
create_boot_patch
fi
fi
fi