FATGEN is a utility that runs on a Unix system as an ordinary unprivileged program and generates a regular file containing a block image of a DOS FAT16 file system optionally filled with files. Although some lip service has been paid to the idea of making FATGEN a generic utility, in actuality its creation has been driven by one specific need. As everyone knows these days, FAT file systems have far outgrown their place of origin on the MS-DOS planet in the IBM PC starsystem and are used in many places where neither DOS-like operating systems nor even x86 processors are anywhere in sight. In particular, architecture- and OS-independent flash-based block devices like USB sticks and SD/MMC cards are generally expected to contain a FAT file system preceded by an IBM PC MBR (master boot record), i.e., they pretend to be what the inhabitants of the IBM PC universe call a "hard drive". Furthermore, there exists at least one family of non-x86 embedded processors (ARM chips from TI like the one on the popular BeagleBoard) which actually *require* an SD/MMC card in this format as their boot medium; working with these processors is what has motivated the author to write this utility. The traditional way of preparing DOS-formatted media under Unix involves first partitioning the medium with one utility (some variant of fdisk), then creating a blank FAT filesystem with another utility (usually called mkdosfs, mkfs.vfat, mkfs.msdos or the like), then mounting it, then filling it with files. These manipulations are manual, error-prone when done repetitively, and operate on real hardware, which in turn makes them OS-dependent and root-requiring. In other words, a pain in the ass. Using loopback mounting may eliminate the real hardware requirement, but it's still OS-dependent and root-requiring, and doesn't really help with the MBR part. FATGEN is an alternative based on a different approach. With FATGEN the user prepares a parameters file describing the fake geometry and other properties of the "virtual hard drive" to be created, and another file containing the manifest of files with which this FAT file system should be populated. (Use /dev/null as your manifest if you want a blank file system image.) Then run the utility and get a block image file which you can simply dd to /dev/sdb or whatever; the MBR and VBR with the right fake geometry, all DOS file system structures and the files listed in the manifest will be inside. Limitations: * While MBR generation may be enabled or disabled, FATGEN always generates a FAT16 file system, i.e., FAT12 is not supported. Therefore, FATGEN in its present form cannot generate standard floppy disk images. * FAT32 isn't supported either: FAT16 was sufficient for the author's needs, and the AM3517 processor which I'm booting with these FATGEN-generated MMC images happily accepts them. :-) * The fill-with-files-from-manifest feature has two limitations of its own: a) No LFN support, only classic MS-DOS 8.3 filenames. Once again, the AM3517 processor is happy and so am I. :-) b) No support for subdirectories, i.e., all files go into the root directory. This was/is sufficient for my needs which consist of booting TI processors and programming their native flash. Credit attribution: FATGEN has been written by Michael Sokolov of Harhan Engineering Co. while consulting for Fresenius Medical Care North America; the Free Software community sincerely thanks Fresenius for sponsoring the creation of this free program.