I also wrote a simple tool that does everything I need. Currently I use it to make disk images with proper file systems. It can combine files and make modifications at any offsets. The tool takes input line by line and it can be used directly by typing "commands" or redirecting commands from so called script files.
Example script file (script.txt):
Code:
# Comments are allowed
. = 16 # Offset is zero by default but can be changed
=some/path/file.bin # Include this file here (offset is incremented accordingly)
# Edit the beginning of the file
. = 16 # Set offset again
S$ "ABCD" # S$ is for strings
4$ 0x10 # Little endian 4byte
4$ 0x10, 4, 0x2 # Three little endian 4bytes
4$B 0x10 # Big endiand 4byte
4$L 0x10 # Explicit little endian 4byte (same as without 'L')
1.5$ 1,2,3,4 # Four 1.5 bytes (used for FAT 12, always little endian)
D$ SOME_DEFINE # Use builtin define ("SOME_DEFINE" is not available)
. = 0x1000 # Set offset again
=some/path/another.bin # Include this file here (offset is incremented accordingly)
Usage:
Code:
Usage: ./Collector <file size>
Example: ./Collector 0x8000 < script.txt > final.img
Of course there are drawbacks and I do not claim it is a perfect tool. However, I really like it.
Source Code for CollectorScript for creating an ISO 9660 El Torito CD