-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathREADME
282 lines (197 loc) · 8.04 KB
/
README
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
libbootimage api
The Bootimage Utils Functions
=============================
enum bootimage_utils_filetype
{
BOOTIMAGE_UTILS_FILETYPE_UNKNOWN = 0,
BOOTIMAGE_UTILS_FILETYPE_NEXUS_FACTORY_IMAGE,
BOOTIMAGE_UTILS_FILETYPE_UPDATE_ZIP,
BOOTIMAGE_UTILS_FILETYPE_OTA_UPDATE_ZIP,
BOOTIMAGE_UTILS_FILETYPE_STANDARD_BOOT_IMAGE,
BOOTIMAGE_UTILS_FILETYPE_OEM_BOOT_IMAGE,
BOOTIMAGE_UTILS_FILETYPE_STANDARD_RECOVERY_IMAGE,
BOOTIMAGE_UTILS_FILETYPE_OEM_RECOVERY_IMAGE,
BOOTIMAGE_UTILS_FILETYPE_STANDARD_RAMDISK,
BOOTIMAGE_UTILS_FILETYPE_RECOVERY_RAMDISK,
BOOTIMAGE_UTILS_FILETYPE_COMPRESSED_KERNEL,
BOOTIMAGE_UTILS_FILETYPE_MAX = BOOTIMAGE_UTILS_FILETYPE_COMPRESSED_KERNEL
}
struct bootimage_utils
{
int file_type ;
char* data ;
}
struct bootimage_utils* bootimage_utils_initialize();
bootimage_utils_read(struct bootimage_utils* biu,const char* file_name);
The Main Bootimage Functions
============================
struct bootimage* bootimage_initialize();
struct bootimage* bootimage_initialize_from_factory_image(char* data);
struct bootimage* bootimage_initialize_from_ota_zip(char* data);
bootimage_free(struct bootimage** bip);
bootimage_file_read(struct bootimage* bi,const char* file_name)
The Main Bootimage File Extraction Functions
============================================
bootimage_file_extract_header(const char* file_name,const char* header_name);
bootimage_file_extract_header_block(const char* file_name,const char* header_block_name);
bootimage_file_extract_kernel(const char* file_name,const char* kernel_name);
bootimage_file_extract_kernel_config(const char* file_name,const char* kernel_config_name);
bootimage_file_extract_kernel_config_gz(const char* file_name,const char* kernel_config_gz_name);
bootimage_file_extract_kernel_ramdisk(const char* file_name,const char* kernel_ramdisk_name);
bootimage_file_extract_kernel_ramdisk_archive(const char* file_name,const char* kernel_ramdisk_dir_name);
bootimage_file_extract_kernel_ramdisk_entry(const char* file_name,const char* kernel_ramdisk_entry_name);
bootimage_file_extract_uncompressed_kernel(const char* file_name,const char* uncompressed_kernel_name);
bootimage_file_extract_ramdisk(const char* file_name,const char* ramdisk_name);
bootimage_file_extract_ramdisk_archive(const char* file_name,const char* ramdisk_dir_name);
bootimage_file_extract_ramdisk_entry(const char* file_name,const char* ramdisk_entry_name);
bootimage_file_print_header(const char* file_name);
bootimage_file_print_header_fd(const char* file_name,int fd);
bootimage_file_print_kernel(const char* file_name);
bootimage_file_print_kernel_version(const char* file_name);
bootimage_file_print_ramdisk(const char* file_name);
bootimage_file_print_ramdisk_list(const char* file_name);
bootimage_file_print_ramdisk_file(const char* file_name,const char* ramdisk_file);
bootimage_file_print_ramdisk_files(const char* file_name,const char** ramdisk_files);
bootimage_file_print_all(const char* file_name);
bootimage_extract_header(struct bootimage* bi,const char* header_name);
bootimage_extract_header_block(struct bootimage* bi,const char* header_block_name);
bootimage_extract_kernel(struct bootimage* bi,const char* kernel_name);
bootimage_extract_kernel_config(struct bootimage* bi,const char* kernel_config_name);
bootimage_extract_kernel_config_gz(struct bootimage* bi,const char* kernel_config_gz_name);
bootimage_extract_kernel_ramdisk(struct bootimage* bi,const char* kernel_ramdisk_name);
bootimage_extract_kernel_ramdisk_archive(struct bootimage* bi,const char* kernel_ramdisk_dir_name);
bootimage_extract_kernel_ramdisk_entry(struct bootimage* bi,const char* kernel_ramdisk_entry_name);
bootimage_extract_uncompressed_kernel(struct bootimage* bi,const char* uncompressed_kernel_name);
bootimage_extract_ramdisk(struct bootimage* bi,const char* ramdisk_name);
bootimage_extract_ramdisk_archive(struct bootimage* bi,const char* ramdisk_dir_name);
bootimage_extract_ramdisk_entry(struct bootimage* bi,const char* ramdisk_entry_name);
bootimage-utils features
Print Bootimage Image Header
Print Bootimage Image File Structure
Print Bootimage Type
Fingerprint BootImage
Kernel Compression
Kernel Version
Kernel Uncompressed Size
Kernel Config.gz
List Properties
List Services
Add/Change Service
Add/Change Property
Mount Ramdisk
usage
bootimage-utils extract [ options ] <file>
options:
-i <name> --bootimage=<name> [ default boot.img ]
-d --out-dir - output directory [ default : cwd ]
-k --kernel=<name> [ default : kernel ]
-r --ramdisk=<directory> [ default : ramdisk ]
-x --ramdisk-archive=<name>
-f --ramdisk-file=<name>
-o --output-file=<name>
-F --ramdisk-files=<name>;<name>
-O --output-file=<name>;<name>
-h --header
-
bootimage-utils features technical implementation
=================================================
Known FileTypes
Nexus Factory Image
file contains a zip file and the zip file contains
at least a boot.img
Update Zip
file contains a META-INF and has an updater-script
OTA Update Zip ( incremental )
file contains a META-INF and has an updater-script
Standard Boot Image
Has Android Magic at offset 0.
Has Valid Kernel Data
Has Valid Ramdisk Data
Does not have sbin/recovery
default.prop does not contain build.prop info
OEM Boot Image
Has Android Magic not at offset 0
Has Valid Kernel Data
Has Valid Ramdisk Data
Does not have sbin/recovery
default.prop does not contain build.prop info
Standard Recovery Image
Has Android Magic at offset 0.
Has sbin/recovery
default.prop contains build.prop info
OEM Recovery Image
Has Android Magic at offset 0.
Has sbin/recovery
default.prop contains build.prop info
Standard Ramdisk
Is a cpio or cpio.gz file
Does not have sbin/recovery
default.prop does not contain build.prop info
Recovery Ramdisk
Is a cpio or cpio.gz file
has sbin/recovery
default.prop contains build.prop info
Compressed Kernel
Is a valid Kernel Compression Type
UnCompressed Kernel
Has a valid kernel Version Line
Has ( other ) kernel identifiers
Bootimage Utils Options
=======================
The options control how the program behaves with regard to
memory usage and allocation strategy, Temporary File Usage
default action behaviour. Search Path Behaviour, Logging Options
Clobber Behaviour. These can be set in an "options" file or passed
as command line arguments
Top Level Actions
=================
info - Print Various Bootimage or archive info
print - same as info
extract - Extract various parts of a bootimage
update - update various parts of a bootimage
create - create a bootimage
options - print default options
Print Action
============
bootimage-utils [print|p] [ options ] [ program options ] < file >
-B |--boot-image=<bootimage> ( default : boot.img )
If the <file> is a nexus factory image or an update zip
and contains a file named <bootimage> then the data is printed
from <bootimage>
-R |--recovery-image=<recoveryimage> ( default : recovery.img )
If the <file> is a nexus factory image or an update zip
and contains a file named <recoveryimage> then the data is printed
from this, recovery images will be attempted to be fingerprinted
-H|--header
Prints the image header information
-k|--kernel
Prints the image kernel information
-K|--kernel-version
Prints the kernel version line only
-r|--ramdisk
Prints ramdisk information
-f|--file=<file1,file2,...>
Print ramdisk file. if the file is a text file
-P|--property=<property1,property2,...>
Print property value found in default.prop
-L|--list-ramdisk
Examples
bootimage-utils print <factory image>
Prints File Type " Android Nexus Factory Image "
Prints Internal Zip File Name / Zip File Size
Prints Internal Zip Boot Image Name and size
Prints boot.img header structure
Second Level Actions
====================
These are quick shortcuts to actions arguments
print-header
print-bootimage-header
print-recovery-header
print
print-kernel = print --kernel <file>
Prints all kernel details.
Kernel Compressed Size, Version
print-kernel-version = print --kernel-version <file>
print-header = print --header <file>
print-ramdisk = print --ramdisk <file>
print-ramdisk-ls = print --ramdisk-ls <file>