1srec_binary(5)                File Formats Manual               srec_binary(5)
2
3
4

NAME

6       srec_binary - binary file format
7

DESCRIPTION

9       It is possible to read and write binary files using srec_cat(1).
10
11   File Holes
12       A file hole is a portion of a regular file that contains NUL characters
13       and is not stored in any data block on disk.  Holes are a long‐standing
14       feature  of  Unix files.  For instance, the following Unix command cre‐
15       ates a file in which the first bytes are a hole:
16
17              $ echo -n "X" | dd of=/tmp/hole bs=1024 seek=6
18              $
19
20       Now /tmp/hole has 6,145 characters (6,144  NUL  characters  plus  an  X
21       character), yet the file occupies just one data block on disk.
22
23       File  holes were introduced to avoid wasting disk space.  They are used
24       extensively by database applications and, more generally, by all appli‐
25       cations that perform hashing on files.
26
27       See   http://www.oreilly.com/catalog/linuxkernel2/chapter/ch17.pdf  for
28       more information.
29
30   Reading
31       The size of binary files is taken from the size of the file on the file
32       system.   If the file has holes these will read as blocks of NUL (zero)
33       data, as there is no elegant way to detect Unix file  holes.   In  gen‐
34       eral,  you  probably  want to use the -unfill filter to find and remove
35       large swathes of zero bytes.
36
37   Writing
38       In producing a binary file, srec_cat(1) honours the address information
39       and  places the data into the binary file at the addresses specified in
40       the hex file.  This usually results on holes in  the  file.   Sometimes
41       alarmingly large file sizes are reported as a result.
42
43       If  you  are  on  a brain‐dead operating system without file holes then
44       there are going to be real data blocks containing real zero bytes,  and
45       consuming real amounts of disk space.  Upgrade - I suggest Linux.
46
47       To make a file of the size you expect, use
48
49              srec_info foo.s19
50
51       to find the lowest address, then use
52
53              srec_cat foo.s19 -intel -offset -n -o foo.bin -binary
54
55       where  n is the lowest address present in the foo.s19 file, as reported
56       by srec_info(1).  The negative offset serves to move the data  down  to
57       have an origin of zero.
58

SEE ALSO

60       srec_input(1)
61               for a description of the -unfill filter
62
63       srec_examples(1)
64               has  a  section  about  binary files, and ways of automagically
65               offseting the data back to zero in a single command.
66
68       SRrecord version 1.64
69       Copyright (C) 1998, 1999, 2000, 2001, 2002,  2003,  2004,  2005,  2006,
70       2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Peter Miller
71
72       The SRrecord program comes with ABSOLUTELY NO WARRANTY; for details use
73       the 'SRrecord -VERSion License' command.  This is free software and you
74       are  welcome  to  redistribute it under certain conditions; for details
75       use the 'SRrecord -VERSion License' command.
76

MAINTAINER

78       Scott Finneran   E‐Mail:   scottfinneran@yahoo.com.au
79       Peter Miller     E‐Mail:   pmiller@opensource.org.au
80
81
82
83Reference Manual                    SRecord                     srec_binary(5)
Impressum