File: bmaptool.1

package info (click to toggle)
bmap-tools 3.9.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 760 kB
  • sloc: python: 5,822; sh: 105; makefile: 2
file content (370 lines) | stat: -rw-r--r-- 10,639 bytes parent folder | download
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
.TH BMAPTOOL "1" "March 2025" "bmaptool 3.9.0" "User Commands"

.SH NAME

.PP
bmaptool - create block map (bmap) for a file or copy a file using bmap

.SH SYNOPSIS

.PP
.B bmaptool
[\-\-help] [\-\-version] [\-\-quiet] [\-\-debug] <command> [<options>] <args>

.SH DESCRIPTION

.PP
\fIbmaptool\fR is a generic tool for creating the block map (bmap) for a file and
copying files using the block map. The idea is that large files, like raw
system image files, can be copied or flashed a lot faster with \fIbmaptool\fR than
with traditional tools, like "dd" or "cp".

.PP
\fIbmaptool\fR supports 2 commands:
.RS 2
1. \fBcopy\fR - copy a file to another file using bmap or flash an image to a block device
.RE
.RS 2
2. \fBcreate\fR - create a bmap for a file
.RE

.PP
Please, find full documentation for the project online.

.\" ===========================================================================
.\" Global options
.\" ===========================================================================
.SH OPTIONS

.PP
\-\-version
.RS 2
Print \fIbmaptool\fR version and exit.
.RE

.PP
\-h, \-\-help
.RS 2
Print short help text and exit.
.RE

.PP
\-q, \-\-quiet
.RS 2
Be quiet, do not print extra information.
.RE

.PP
\-d, \-\-debug
.RS 2
Print debugging messages.
.RE

.\" ===========================================================================
.\" Commands descriptions
.\" ===========================================================================
.SH COMMANDS

.\"
.\" The "copy" command description
.\"
.SS \fBcopy\fR [options] IMAGE DEST

.RS 2
Copy file IMAGE to the destination regular file or block device DEST
using bmap. IMAGE may either be a local path or an URL. DEST may either
be a regular file or a block device (only local).

.PP
Unless the bmap file is explicitly specified with the "--bmap" option, \fIbmaptool\fR
automatically discovers it by looking for a file with the same name as IMAGE
but with the ".bmap" extension. If it was unable to find it that way, it will
try filenames with each extension of IMAGE removed and ".bmap" added to it. So
if your IMAGE is named \fIdisk.img.gz\fR, it will first try
\fIdisk.img.gz.bmap\fR, then \fIdisk.img.bmap\fR and finally \fIdisk.bmap\fR.
The bmap file is only looked for in
IMAGE's directory (or base URL, in case IMAGE was specified as an URL). If the
bmap file is not found, \fIbmaptool\fR fails. To copy without bmap, use
the "--nobmap" option.

.PP
Both IMAGE and the bmap file may be specified as an URL (http://, ftp://,
https://, file://, ssh://). In order to make \fIbmaptool\fR use a proxy server,
please, specify the proxy using the standard "$http_proxy", "$https_proxy",
"$ftp_proxy" or "$no_proxy" environment variables.

.PP
If the server requires authentication, user name and password may be specified
in the URL, for example "https://user:password@my.server.org/image.raw.bz2", or
"ssh://user:password@host:path/to/image.raw".

.PP
IMAGE may be compressed, in which case \fIbmaptool\fR decompresses it on-the-fly.
The compression type is detected by the file extension and the following
extensions are supported:

.RS 4
1. ".gz", ".gzip", ".tar.gz" and ".tgz" for files and tar archives compressed with "\fIgzip\fR" program
.RE
.RS 4
2. ".bz2", "tar.bz2", ".tbz2", ".tbz", and ".tb2" for files and tar archives compressed with "\fIbzip2\fR" program
.RE
.RS 4
3. ".xz", ".tar.xz", ".txz" for files and tar archives compressed with "\fIxz\fR" program
.RE
.RS 4
4. ".lzo", "tar.lzo", ".tzo" for files and tar archives compressed with "\fIlzo\fR" program
.RE
.RS 4
5. ".lz4", "tar.lz4", ".tlz4" for files and tar archives compressed with "\fIlz4\fR" program
.RE
.RS 4
6. ".zst", "tar.zst", ".tzst" for files and tar archives compressed with "\fIzstd\fR" program
.RE

.PP
IMAGE files with other extensions are assumed to be uncompressed. Note,
\fIbmaptool\fR uses "\fIpbzip2\fR" and "\fIpigz\fR" programs for decompressing
bzip2 and gzip archives faster, unless they are not available, in which case if
falls-back to using "\fIbzip2\fR" and "\fIgzip\fR". Furthermore, uncompressed
IMAGE files can be piped to the standard input using "-".

.PP
If DEST is a block device node (e.g., "/dev/sdg"), \fIbmaptool\fR opens it in
exclusive mode. This means that it will fail if any other process has IMAGE
block device node opened. This also means that no other processes will be able
to open IMAGE until \fIbmaptool\fR finishes the copying. Please, see semantics
of the "O_EXCL" flag of the "open()" syscall.

.PP
The bmap file typically contains SHA-256 checksum for itself as well as SHA-256
checksum for all the mapped data regions, which makes it possible to guarantee
data integrity. \fIbmaptool\fR verifies the checksums and exits with an error
in case of a mismatch. Checksum verification can be disabled using the
"--no-verify" option. \fIbmaptool\fR does not verify that unampped areas
contain only zeroes, because these areas are anyway dropped and are not used for
anything.

.PP
The bmap file may be signed with OpenPGP (gpg). The signature may be either
detached (a separate file) or "built into" the bmap file (so called "clearsign"
signature).

.PP
The detached signature can be specified with the "--bmap-sig" option, otherwise
\fIbmaptool\fR tries to automatically discover it by looking for a file with
the same name as the bmap file but with the ".asc" or ".sig" extension.
If it was unable to find it that way, it will try filenames with each extension
of IMAGE removed and ".asc" or ".sig" added to it.
This is very similar to the bmap file auto-discovery. So if a ".asc" or ".sig"
file exists, \fIbmaptool\fR will verify the signature.

.PP
The clearsign signature is part of the bmap file and \fIbmaptool\fR
automatically detected and verifies it.

.PP
If the signature is bad, \fIbmaptool\fR exits with an error. Bmap file
signature verification can be disabled using the "--no-sig-verify" option.
.RE

.\"
.\" The "copy" command's options
.\"
.RS 2
\fBOPTIONS\fR
.RS 2
\-h, \-\-help
.RS 2
Print short help text about the "copy" command and exit.
.RE

.PP
\-\-bmap BMAP
.RS 2
Use bmap file "BMAP" for copying. If this option is not specified, \fIbmaptool\fR
tries to automatically discover the bmap file.
.RE

.PP
\-\-bmap-sig SIG
.RS 2
Use a detached OpenPGP signature file "SIG" for verifying the bmap file
integrity and publisher. If this option is not specified, \fIbmaptool\fR
tries to automatically discover the signature file.
.RE

.PP
\-\-fingerprint FINGERPRINT
.RS 2
The GPG fingerprint which you expect to have signed the bmap file.
.RE

.PP
\-\-keyring KEYRING
.RS 2
Path to the GPG keyring that will be used when verifying GPG signatures.
.RE

.PP
\-\-nobmap
.RS 2
Disable automatic bmap file discovery and force flashing entire IMAGE without bmap.
.RE

.PP
\-\-no-sig-verify
.RS 2
Do not verify the OpenPGP bmap file signature (not recommended).
.RE

.PP
\-\-no-verify
.RS 2
Do not verify data checksums when copying (not recommended). The checksums are
stored in the bmap file, and normally \fIbmaptool\fR verifies that the data in
IMAGE matches the checksums.
.RE

.PP
\-\-psplash\-pipe PATH
.RS 2
Write periodic machine-readable progress reports to a fifo in the format
used by \fBpsplash\fR. Each progress report consists of "PROGRESS" followed
by a space, an integer percentage and a newline.
.RE

.PP
\-\-removable\-device
.RS 2
Copy to destination only if it is a removable block device. This option is
recommended when writing on SD Card or USB key to avoid involuntary
destructive operations on non-removable disks. The copy command fails when the
destination file does not exist, is not a block device or is not removable.
.RE

.RE
.RE

.\"
.\" The "copy" command's examples
.\"
.RS 2
\fBEXAMPLES\fR
.RS 2
\fIbmaptool\fR copy image.raw.bz2 /dev/sdg
.RS 2
Copy bz2-compressed local file "image.raw.bz2" to block device "/dev/sdg". The
image file is uncompressed on-the-fly. The bmap file is discovered
automatically. The OpenPGP signature is detected/discovered automatically
too.
.RE
.RE

.RS 2
\fIbmaptool\fR copy http://my-server.com/files/image.raw.bz2 $HOME/tmp/file
.RS 2
Copy bz2-compressed remote "image.raw.bz2" to regular file "$HOME/tmp/file".
The image file is uncompressed on-the-fly. The bmap file is discovered
automatically. The OpenPGP signature is detected/discovered automatically
too.
.RE
.RE

.RS 2
\fIbmaptool\fR copy --bmap image.bmap --bmap-sig image.bmap.asc image.raw /dev/sdg
.RS 2
Copy non-compressed local file "image.raw" to block device "/dev/sdg" using bmap file
"image.bmap". Verify the bmap file signature using a detached OpenPGP signature
from "imag.bmap.asc".
.RE
.RE

.RS 2
cat image.raw | \fIbmaptool\fR copy --bmap image.bmap - /dev/sdg
.RS 2
Copy non-compressed image from standard input to block device "/dev/sdg" using bmap file
"image.bmap".
.RE
.RE

.\"
.\" The "create" command description
.\"
.SS \fBcreate\fR [options] IMAGE

.PP
Generate bmap for a regular file IMAGE. Internally, this command uses the
Linux "FIEMAP" ioctl to find out which IMAGE blocks are mapped. However, if
"FIEMAP" is not supported, the "SEEK_HOLE" feature of the "lseek" system call
is used instead. By default, the resulting bmap file is printed to stdout,
unless the "--output" option is used.

.PP
The IMAGE file is always synchronized before the block map is generated. And it
is important to make sure that the IMAGE file is not modified when the bmap
file is being generated, and after the bmap file has been generated. Otherwise
the bmap file becomes invalid and checksum verification will fail.

.PP
The image file can further be signed using OpenPGP.

.\"
.\" The "create" command's options
.\"
.RS 2
\fBOPTIONS\fR
.RS 2
\-h, \-\-help
.RS 2
Print short help text about the "create" command and exit.
.RE

.PP
\-o, \-\-output OUTPUT
.RS 2
Save the generated bmap in the OUTPUT file (by default the bmap is printed to
stdout).
.RE

.PP
\-\-no-checksum
.RS 2
Generate a bmap file without SHA1 checksums (not recommended).
.RE
.RE
.RE

.\"
.\" The "create" command's examples
.\"
.RS 2
\fBEXAMPLES\fR
.RS 2
\fIbmaptool\fR create image.raw
.RS 2
Generate bmap for the "image.raw" file and print it to stdout.
.RE
.RE

.RS 2
\fIbmaptool\fR create -o image.bmap image.raw
.RS 2
Generate bmap for the "image.raw" file and save it in "image.bmap".
.RE
.RE

.SH AUTHOR

Artem Bityutskiy <artem.bityutskiy@linux.intel.com>.

.SH Maintainers

Trevor Woerner <twoerner@gmail.com>
Joshua Watt <JPEWhacker@gmail.com>
Tim Orling <ticotimo@gmail.com>

.SH REPORTING BUGS

This project is hosted on github; please use it to report any issues or
post any patches: https://github.com/yoctoproject/bmaptool