minimOS file system
While a ROM-based system like Durango-X may not depend on it, a file system for managing a mass-storage device is always desirable. But a limited 8-bit system may struggle with the large file systems found on today's storage devices. Thus, a simplified file system should be implemented.
The idea behind this is to simply add a header to any "file" which creates, by simple concatenation, a linked list, easily sorted out by the filesystem software by jumping between headers. This very same principle has been used on the minimOS Operating System as a means to manage ROM contents, but it's suitable for implementing a barebones filesystem in mass-storage devices as well, especially Solid-State ones (like a readily available SD card).
Simply put, a volume is a concatenation of files, each of them preceded by a suitable header. Some padding must be applied at the end of every file, in case its length is not a 512-byte multiple, as required by most storage devices.
From the very first sector (the leading 256 bytes would suffice) of a volume, any file can be accessed as all headers form a linked list; from the file's size (conveniently rounded up to the nearest 512-byte multiple) you may compute the next file's sector number, and so on. When this points to a non-valid header (at least three magic numbers must be checked), the volume has ended.
A single file (with the proper header) is suitable as a whole volume as well, as the sector following it is (very) likely to contain garbage, and will thus fail the header validation procedure.
In very rare circumstances, older device contents after the volume's end may be recognised as a valid header; this shouldn't be a concern as the only ill effect would be the "recovery" of older files after the volume's contents; but in case of doubt, you may add a fake sector suitably filled (
$FF is convenient for most devices) after every volume, for extra safety.
Concatenating files and ROM images can be easily done with the
cat command, like the following example:
cat image1.dux image2.dux image3.dux > durango.av
From the point of view of the storage device filesystem, the Durango-X volume is represented by the
durango.av file in the root directory of any FAT32-formatted device (valid with bootloader v2.0 and beyond)
Current bootloader software (up to v1.3) does NOT check for any host filesystem, assuming the volume is written from the very first block of the device. In Linux, a
dd command is suitable for raw writing the volume onto the storage device.
The use of the
dd command or any equivalent one is very risky as any incorrect parameter may result in data loss. Exert extreme caution when writing raw images!
Flashing the volume into the storage device with the current bootloader software (up to v1.3) can be done in Linux like this:
dd if=path-to/durango.av of=/dev/_your-device_
Take extreme caution when determining
your-device, as any wrong choice will cause data loss.
Check the ROM image format for details.