/
extract.sh
executable file
·49 lines (49 loc) · 1.16 KB
/
extract.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
# Script to unpack Xperia Kernel
# Rachit Rawat
# @XDA
tput setaf 6
setterm -bold
echo "******************************"
echo "**** Kernel Unpack Script ****"
echo "**** For Xperia **************"
echo "**** By Rachit Rawat *********"
echo "******************************"
tput sgr0
setterm -bold
tput setaf 1
echo "**** Delete existing files ****"
if test -d ramdisk
then rm -rf ramdisk
fi
if test -d kernel
then rm -rf kernel
fi
if test -d out
then rm -rf out
fi
tput setaf 6
echo "* Place boot.img in working directory and press enter"
echo "* Ignore if already placed"
read ANS
if test -e boot.img
then
mkdir kernel
mkdir ramdisk
mkdir -p unpack
echo "Extracting zImage + Ramdisk"
./tools/unpackbootimg -i boot.img -o unpack
cp unpack/boot.img-zImage kernel/zImage
rm unpack/boot.img-zImage
echo "Extracting Ramdisk"
cd ramdisk
gzip -dc ../unpack/boot.img-ramdisk.gz | cpio -i
cd ..
rm -rf unpack
tput setaf 2
echo "Extracted zImage is in kernel/zImage"
echo "Extracted Ramdisk is in ramdisk folder"
tput sgr0
else echo "boot.img not found! (TIP:Try renaming xyz.img to boot.img)"
fi
echo "All Done, press enter to exit"
read ANS