Repository navigation
Expand file tree
/
Copy pathensure_boot_extracted
More file actions
executable file
·111 lines (90 loc) · 2.19 KB
/
Copy pathensure_boot_extracted
File metadata and controls
executable file
·111 lines (90 loc) · 2.19 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
############################################################################
#
# Copyright (c) 2012 - dsixda (dislam@rocketmail.com)
#
# Android Kitchen is 100% free. This script file is intended for personal
# and/or educational use only. It may not be duplicated for monetary
# benefit or any other purpose without the permission of the developer.
#
############################################################################
#
# This script extracts the contents of the boot.img from the Working folder
#
# It has one optional parameter:
#
# $1 = if set to 'no_clear' then it won't clear at start
#
if [ "$1" == "" ]
then
clear
fi
scripts/prompt_remove_boot_extracted
if [ ! -d BOOT-EXTRACTED ]
then
if [ -d WORKING_* ]
then
echo
echo Working folder found
else
echo
echo Working folder not found, you will need to create one!
exit 0
fi
cd WORKING_*
if [ -e boot.img ]
then
cd ..
scripts/check_bootimg_header
scripts/check_kernel_offset
res=$?
if [ "$res" == "0" ]
then
kernel_file=extract-kernel.pl
ramdisk_file=extract-ramdisk.pl
else
exit 0
fi
echo Making folder 'BOOT-EXTRACTED' ...
cd WORKING_*
mkdir ../BOOT-EXTRACTED
cp boot.img ../BOOT-EXTRACTED/
cd ..
cp tools/extract_boot_files/$kernel_file BOOT-EXTRACTED/extract-kernel.pl
cp tools/extract_boot_files/$ramdisk_file BOOT-EXTRACTED/extract-ramdisk.pl
cd BOOT-EXTRACTED
echo
echo Extracting kernel ...
./extract-kernel.pl boot.img 2>/dev/null
if [ ! -e zImage ]
then
echo "Error: No zImage found!"
else
test_z=`od -A n -j 1 -N 4 zImage | sed 's/ //g'`
if [ "$test_z" == "" ]
then
echo "Error: zImage is empty!"
fi
fi
echo Extracting ramdisk ...
./extract-ramdisk.pl boot.img 2>/dev/null
if [ ! -d boot.img-ramdisk ]
then
echo "Error: No ramdisk folder found!"
fi
rm boot.img
rm extract-*.pl
cd ..
echo
else
if [ -e boot/initrd.gz ] && [ -e boot/zImage ]
then
cd ..
scripts/ensure_nand_extracted $1
else
echo "Error: boot.img not found!"
echo
cd ..
exit 0
fi
fi
fi