-
Notifications
You must be signed in to change notification settings - Fork 0
/
for-devs.sh
executable file
·53 lines (40 loc) · 1013 Bytes
/
for-devs.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
#!/bin/bash
CUR_DIR=$(pwd)
TOOLS_PATH=./tools
mkdir -p output/boot/
mkdir -p output/vendor_boot/
echo "* Extracting boot image and vendor_boot image..."
$TOOLS_PATH/unpackbootimg -i ../boot.img -o output/boot/
$TOOLS_PATH/unpackbootimg -i ../vendor_boot.img -o output/vendor_boot/
mkdir -p output/boot/ramdisk/
mkdir -p output/vendor_boot/ramdisk/
echo "* Extracting both ramdisk..."
cd output/boot/ramdisk/
TARGET=boot.img-ramdisk
unlz4 -f ../$TARGET ../tmp
if [ $? -eq 0 ] ; then
TARGET=tmp
fi
gunzip -c ../$TARGET | cpio -i
if [ $? -ne 0 ] ; then
cat ../$TARGET | cpio -i
fi
rm -rf ../tmp
cd ../../vendor_boot/ramdisk/
TARGET=vendor_boot.img-vendor_ramdisk
unlz4 -f ../$TARGET ../tmp
if [ $? -eq 0 ] ; then
TARGET=tmp
fi
gunzip -c ../$TARGET | cpio -i
if [ $? -ne 0 ] ; then
cat ../$TARGET | cpio -i
fi
rm -rf ../tmp
cd $CUR_DIR
echo "* Running twrpdtgen script..."
mkdir -p output/twrp/
cd output/twrp/
pip3 install twrpdtgen
python3 -m twrpdtgen ../../../boot.img
echo "* Done!"