1BMAPTOOL(1)                      User Commands                     BMAPTOOL(1)
2
3
4

NAME

6       bmaptool - create block map (bmap) for a file or copy a file using bmap
7
8

SYNOPSIS

10       bmaptool [--help] [--version] [--quiet] [--debug] <command> [<options>]
11       <args>
12
13

DESCRIPTION

15       Bmaptool is a generic tool for creating the block map (bmap) for a file
16       and  copying  files  using the block map. The idea is that large files,
17       like raw system image files, can be copied or flashed a lot faster with
18       bmaptool than with traditional tools, like "dd" or "cp".
19
20
21       Bmaptool supports 2 commands:
22         1. copy - copy a file to another file using bmap or flash an image to
23         a block device
24         2. create - create a bmap for a file
25
26
27       Please, find full documentation for the project online.
28
29

OPTIONS

31       --version
32         Print bmaptool version and exit.
33
34
35       -h, --help
36         Print short help text and exit.
37
38
39       -q, --quiet
40         Be quiet, do not print extra information.
41
42
43       -d, --debug
44         Print debugging messages.
45
46

COMMANDS

48   copy [options] IMAGE DEST
49         Copy file IMAGE to the destination regular file or block device  DEST
50         using  bmap.  IMAGE  may  either  be a local path or an URL. DEST may
51         either be a regular file or a block device (only local).
52
53
54         Unless the bmap  file  is  explicitly  specified  with  the  "--bmap"
55         option,  bmaptool  automatically  discovers  it by looking for a file
56         with the same basename as IMAGE but with the ".bmap"  extension.  The
57         bmap  file  is  only looked for in IMAGE's directory (or base URL, in
58         case IMAGE was specified as an URL). If the bmap file is  not  found,
59         bmaptool fails. To copy without bmap, use the "--nobmap" option.
60
61
62         Both  IMAGE  and  the  bmap file may be specified as an URL (http://,
63         ftp://, https://, file://, ssh://). In order to make bmaptool  use  a
64         proxy   server,   please,   specify  the  proxy  using  the  standard
65         "$http_proxy", "$https_proxy", "$ftp_proxy" or  "$no_proxy"  environ‐
66         ment variables.
67
68
69         If  the server requires authentication, user name and password may be
70         specified   in   the    URL,    for    example    "https://user:pass‐
71         word@my.server.org/image.raw.bz2",        or        "ssh://user:pass‐
72         word@host:path/to/image.raw".
73
74
75         IMAGE may be compressed, in which case bmaptool decompresses  it  on-
76         the-fly.   The compression type is detected by the file extension and
77         the following extensions are supported:
78
79             1. ".gz", ".gzip", ".tar.gz" and ".tgz" for  files  and  tar  ar‐
80             chives compressed with "gzip" program
81             2.  ".bz2",  "tar.bz2", ".tbz2", ".tbz", and ".tb2" for files and
82             tar archives compressed with "bzip2" program
83             3. ".xz", ".tar.xz", ".txz" for files and tar archives compressed
84             with "xz" program
85             4.  ".lzo",  "tar.lzo",  ".tzo"  for  files and tar archives com‐
86             pressed with "lzo" program
87             4. ".lz4", "tar.lz4", ".tlz4" for files  and  tar  archives  com‐
88             pressed with "lz4" program
89
90
91         IMAGE  files  with  other  extensions are assumed to be uncompressed.
92         Note, bmaptool uses "pbzip2" and "pigz"  programs  for  decompressing
93         bzip2  and  gzip  archives  faster, unless they are not available, in
94         which case if falls-back to using "bzip2" and "gzip".
95
96
97         If DEST is a block device node (e.g., "/dev/sdg"), bmaptool opens  it
98         in  exclusive mode. This means that it will fail if any other process
99         has IMAGE block device node opened. This also  means  that  no  other
100         processes  will  be  able  to  open IMAGE until bmaptool finishes the
101         copying. Please, see semantics of the "O_EXCL" flag of  the  "open()"
102         syscall.
103
104
105         The  bmap file typically contains SHA-256 checksum for itself as well
106         as SHA-256 checksum for all the mapped data regions, which  makes  it
107         possible to guarantee data integrity. bmaptool verifies the checksums
108         and exits with an error in case of a mismatch. Checksum  verification
109         can  be  disabled  using  the "--no-verify" option. bmaptool does not
110         verify that unampped areas contain only zeroes, because  these  areas
111         are anyway dropped and are not used for anything.
112
113
114         The  bmap file may be signed with OpenPGP (gpg). The signature may be
115         either detached (a separate file) or "built into" the bmap  file  (so
116         called "clearsign" signature).
117
118
119         The detached signature can be specified with the "--bmap-sig" option,
120         otherwise bmaptool tries to automatically discover it by looking  for
121         a file with the same basename as the bmap file but with the ".asc" or
122         ".sig" extension.  This is very similar to the bmap file auto-discov‐
123         ery.  So  if a ".asc" or ".sig" file exists, bmaptool will verify the
124         signature.
125
126
127         The clearsign signature is part of the bmap file and  bmaptool  auto‐
128         matically detected and verifies it.
129
130
131         If the signature is bad, bmaptool exits with an error. Bmap file sig‐
132         nature verification  can  be  disabled  using  the  "--no-sig-verify"
133         option.
134
135         OPTIONS
136           -h, --help
137             Print short help text about the "copy" command and exit.
138
139
140           --bmap BMAP
141             Use  bmap  file  "BMAP" for copying. If this option is not speci‐
142             fied, bmaptool tries to automatically discover the bmap file.
143
144
145           --bmap-sig SIG
146             Use a detached OpenPGP signature file  "SIG"  for  verifying  the
147             bmap  file  integrity and publisher. If this option is not speci‐
148             fied, bmaptool tries  to  automatically  discover  the  signature
149             file.
150
151
152           --nobmap
153             Disable  automatic  bmap file discovery and force flashing entire
154             IMAGE without bmap.
155
156
157           --no-verify
158             Do not verify data checksums when copying (not recommended).  The
159             checksums are stored in the bmap file, and normally bmaptool ver‐
160             ifies that the data in IMAGE matches the checksums.
161
162
163           --no-sig-verify
164             Do not verify the OpenPGP bmap file signature (not recommended).
165
166           EXAMPLES
167             bmaptool copy image.raw.bz2 /dev/sdg
168               Copy bz2-compressed local file "image.raw.bz2" to block  device
169               "/dev/sdg". The image file is uncompressed on-the-fly. The bmap
170               file is discovered  automatically.  The  OpenPGP  signature  is
171               detected/discovered automatically too.
172
173             bmaptool       copy      http://my-server.com/files/image.raw.bz2
174             $HOME/tmp/file
175               Copy bz2-compressed  remote  "image.raw.bz2"  to  regular  file
176               "$HOME/tmp/file".   The  image file is uncompressed on-the-fly.
177               The bmap file is discovered automatically. The  OpenPGP  signa‐
178               ture is detected/discovered automatically too.
179
180             bmaptool   copy   --bmap   image.bmap  --bmap-sig  image.bmap.asc
181             image.raw /dev/sdg
182               Copy non-compressed local  file  "image.raw"  to  block  device
183               "/dev/sdg"  using  bmap file "image.bmap". Verify the bmap file
184               signature   using   a   detached   OpenPGP    signature    from
185               "imag.bmap.asc".
186
187
188   create [options] IMAGE
189       Generate  bmap  for a regular file IMAGE. Internally, this command uses
190       the Linux "FIEMAP" ioctl to find out which  IMAGE  blocks  are  mapped.
191       However,  if  "FIEMAP" is not supported, the "SEEK_HOLE" feature of the
192       "lseek" system call is used instead. By  default,  the  resulting  bmap
193       file is printed to stdout, unless the "--output" option is used.
194
195
196       The  IMAGE  file  is always synchronized before the block map is gener‐
197       ated. And it is important to make sure that the IMAGE file is not modi‐
198       fied when the bmap file is being generated, and after the bmap file has
199       been generated. Otherwise the bmap file becomes  invalid  and  checksum
200       verification will fail.
201
202
203       The image file can further be signed using OpenPGP.
204
205         OPTIONS
206           -h, --help
207             Print short help text about the "create" command and exit.
208
209
210           -o, --output OUTPUT
211             Save  the  generated bmap in the OUTPUT file (by default the bmap
212             is printed to stdout).
213
214
215           --no-checksum
216             Generate a bmap file without SHA1 checksums (not recommended).
217
218         EXAMPLES
219           bmaptool create image.raw
220             Generate bmap for the "image.raw" file and print it to stdout.
221
222           bmaptool create -o image.bmap image.raw
223             Generate  bmap  for  the  "image.raw"  file  and   save   it   in
224             "image.bmap".
225
226

AUTHOR

228       Artem Bityutskiy <artem.bityutskiy@linux.intel.com>.
229
230

REPORTING BUGS

232       Please,    report    bugs    to    Artem    Bityutskiy   <artem.bityut‐
233       skiy@linux.intel.com>  or  to  the  bmap-tools  mailing   list   <bmap-
234       tools@lists.infradead.org>.
235
236
237
238bmap-tools 3.2                   February 2014                     BMAPTOOL(1)
Impressum