-
Notifications
You must be signed in to change notification settings - Fork 1
/
apply_patch_linux.sh
executable file
·48 lines (40 loc) · 1018 Bytes
/
apply_patch_linux.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
#!/bin/bash
PRE="/home/user/M2Hypervisor/"
PATCH_STOR="/home/user/pro/patch/[3]Cyber_Sercurity_Update/"
LINUX="$PRE/dom0/kernel_dom0/"
ANDROID="$PRE/dom0/kernel_dom0/"
#ANDROID="$PRE/domU/android/kernel/android-4.4/"
LINUX_BRANCH="cyber_security"
ANDROID_BRANCH="fbl"
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/2]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/2]done."
echo "[2/2]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/2]done."
echo "############### Finish ###############"
exit 0