1srec_binary(5) File Formats Manual srec_binary(5)
2
3
4
6 srec_binary - binary file format
7
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 null charac‐
13 ters and is not stored in any data block on disk. Holes are a long-
14 standing feature of Unix files. For instance, the following Unix com‐
15 mand creates a file in which the first bytes are a hole:
16 $ echo -n "X" | dd of=/tmp/hole bs=1024 seek=6
17 Now /tmp/hole has 6,145 characters (6,144 null characters plus an X
18 character), yet the file occupies just one data block on disk.
19
20 File holes were introduced to avoid wasting disk space. They are used
21 extensively by database applications and, more generally, by all appli‐
22 cations that perform hashing on files.
23
24 See http://www.oreilly.com/catalog/linuxkernel2/chapter/ch17.pdf for
25 more information.
26
27 Reading
28 The size of binary files is taken from the size of the file on the file
29 system. If the file has "holes" these will read as blocks of zero
30 data, as there is no elegant way to detect Unix file holes. In gen‐
31 eral, you probably want to use the -unfill filter to find and remove
32 large swathes of zero bytes.
33
34 Writing
35 In producing a binary file, srec_cat(1) honours the address information
36 and places the data into the binary file at the addresses specified in
37 the hex file. This usually results on "holes" in the file. Sometimes
38 alarmingly large file sizes are reported as a result.
39
40 If you are on a brain-dead operating system without file "holes" then
41 there are going to be real data blocks containing real zero bytes, and
42 consuming real amounts of disk space. Upgrade - I suggest Linux.
43
44 To make a file of the size you expect, use
45 srec_info foo.s19
46 to find the lowest address, then use
47 srec_cat foo.s19 --intel -offset -n -o foo.bin -binary
48 where n is the lowest address present in the foo.s19 file, as reported
49 by srec_info(1). The negative offset serves to move the data down to
50 have an origin of zero.
51
53 srec_binary version 1.35
54 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
55 2007 Peter Miller
56
57 The srec_binary program comes with ABSOLUTELY NO WARRANTY; for details
58 use the 'srec_binary -VERSion License' command. This is free software
59 and you are welcome to redistribute it under certain conditions; for
60 details use the 'srec_binary -VERSion License' command.
61
63 Peter Miller E-Mail: millerp@canb.auug.org.au
64 /\/\* WWW: http://www.canb.auug.org.au/~millerp/
65
66
67
68Reference Manual SRecord srec_binary(5)