forked from Re4son/android_kernel_oneplus_msm8996
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_recovery.sh
executable file
·69 lines (57 loc) · 1.8 KB
/
build_recovery.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
#!/bin/bash
export KERNELDIR=`readlink -f .`
export RAMFS_SOURCE=`readlink -f $KERNELDIR/recovery`
export PARTITION_SIZE=67108864
export OS="9.0.0"
export SPL="2019-08"
echo "kerneldir = $KERNELDIR"
echo "ramfs_source = $RAMFS_SOURCE"
RAMFS_TMP="/tmp/arter97-op3-recovery"
echo "ramfs_tmp = $RAMFS_TMP"
cd $KERNELDIR
if [ "${1}" = "skip" ] ; then
echo "Skipping Compilation"
else
echo "Compiling kernel"
cp defconfig .config
make "$@" || exit 1
fi
echo "Building new ramdisk"
#remove previous ramfs files
rm -rf '$RAMFS_TMP'*
rm -rf $RAMFS_TMP
rm -rf $RAMFS_TMP.cpio
#copy ramfs files to tmp directory
cp -axpP $RAMFS_SOURCE $RAMFS_TMP
cd $RAMFS_TMP
#clear git repositories in ramfs
find . -name .git -exec rm -rf {} \;
find . -name EMPTY_DIRECTORY -exec rm -rf {} \;
$KERNELDIR/ramdisk_fix_permissions.sh 2>/dev/null
cd $RAMFS_TMP
find . | fakeroot cpio -H newc -o | gzip -9 > $RAMFS_TMP.cpio.gz
ls -lh $RAMFS_TMP.cpio.gz
cd $KERNELDIR
echo "Making new boot image"
mkbootimg \
--kernel $KERNELDIR/arch/arm64/boot/Image.gz-dtb \
--ramdisk $RAMFS_TMP.cpio.gz \
--cmdline 'androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 cma=32M@0-0xffffffff firmware_class.path=/vendor/firmware_mnt/image loop.max_part=7 buildvariant=user printk.devkmsg=on' \
--base 0x80000000 \
--pagesize 4096 \
--kernel_offset 0x00008000 \
--ramdisk_offset 0x01000000 \
--second_offset 0x00f00000 \
--tags_offset 0x00000100 \
--os_version $OS \
--os_patch_level $SPL \
--header_version 1 \
-o $KERNELDIR/recovery.img
GENERATED_SIZE=$(stat -c %s recovery.img)
if [[ $GENERATED_SIZE -gt $PARTITION_SIZE ]]; then
echo "recovery.img size larger than partition size!" 1>&2
exit 1
fi
echo "done"
ls -al recovery.img
echo ""