-
Notifications
You must be signed in to change notification settings - Fork 1
/
apply_patch.sh
executable file
·74 lines (62 loc) · 1.53 KB
/
apply_patch.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
#!/bin/bash
PRE="/home/user/M2Hypervisor/"
PATCH_STOR="/home/user/pro/patch/[3]Cyber_Sercurity_Update/"
LINUX="$PRE/dom0/kernel_dom0/"
ANDROID="$PRE/domU/android/kernel/android-4.4/"
LINUX_BRANCH="cyber_security_2"
ANDROID_BRANCH="cyber_security_2"
IMG2HOST="/mnt/hgfs/ubuntu_share/"
echo "############### Apply patch to Android kernel ###############"
if [ -z $1 ]
then
echo "No set commit ID..."
echo "Usage:bash $0 commit_id"
exit 1
fi
mkdir -p $PRE/tmp_patch
echo "[1/4]Generate patch in linux kernel's $LINUX_BRANCH branch..."
cd $LINUX
#Generate the patch
git checkout $LINUX_BRANCH
git format-patch $1
mv *.patch $PRE/tmp_patch
if [ $? != 0 ]
then
echo "[Error]Can't Find patch in $LINUX ..."
exit 1
fi
echo "[1/4]done."
echo "[2/4]Apply the patch to Android kernel's $ANDROID_BRANCH branch..."
cd $ANDROID
git checkout $ANDROID_BRANCH
git checkout -- .
ls $PRE/tmp_patch | while read line
do
echo $line
git am $PRE/tmp_patch/$line
done
echo "[2/4]done."
echo "[3/4]Compiling the Android kernel..."
cd $PRE
make target/domU_android/install V=99
if [ $? != 0 ]
then
echo "Fail to compile the Android Kernel..."
exit 1
fi
mv $PRE/tmp_patch/*.patch $PATCH_STOR
echo "[3/4]done."
echo "[4/4] Send Android to windows..."
#cd $ANDROID/../../out/target/product/android_nautilus_defconfig/
#if [ $? != 0 ]
#then
# echo "$ANDROID/../../out/target/product/android_nautilus_defconfig/ doesn't
# exist..."
# exit 1
#fi
#sz DomULinux.img
#sudo cp DomULinux.img $IMG2HOST
#sync
echo "[4/4]done."
echo "############### Finish ###############"
exit 0