4 ms·
I have noticed there are quite a few FAT-32 implementations out there, but none that do what I want. Ideally what I want is something that would do the followin
by howerj 6y ago
I have noticed there are quite a few FAT-32 implementations out there, but none that do what I want. Ideally what I want is something that would do the following; allow the creation of a new FAT-32 image file of a specified length given a target directory.
The program (or programs/scripts) must be command line driven and run under both Windows and Linux (so they can be integrated into our build system).
The use case is the following; the creation of a single binary image containing some firmware and a (per-unit) custom FAT-32 partition, both of which would effectively concatenated together.
Does anyone have any ideas? Otherwise I might have to make something myself.
- ptspts 6y agomtools, containing the mformat and mcopy tools.
- howerj 6y agoThat looks like it might work, thank you. My search did not find this.
- jaclaz 6y ago+1 The mtools/mformat are not AFAIK released pre-built for Windows, in case of need here is a build: http://reboot.pro/topic/14354-buidlingmodifying-floppy-images-with-mtools-as-replacement-for-winimageimdisk/ http://reboot.pro/topic/14354-buidlingmodifying-floppy-image... Syntax/option for mformat are a bit complex, again in case of need here is a small batch that hopefuly makes commands clearer: http://reboot.pro/topic/21664-makeiso/page-4#entry205455 http://reboot.pro/topic/21664-makeiso/page-4#entry205455
- any1 6y agoThere's also genimage [1] which uses mtools for FAT, but it can also do ext2 and more. [1] https://github.com/pengutronix/genimage https://github.com/pengutronix/genimage
- koolba 6y agoI can’t speak for Windows, but on any *nix OS you can do this with a loop back device. You’d have to determining in advance and likely round up a bit. But it’s a literally a couple line shell script.
- howerj 6y agoYeah, it is easy to do, but only on Unixen, the dev environment I am working on is primarily run under Windows (and also maybe Linux in the future).
- m463 6y agoWSL / WSL2 might be one answer
- shawnz 6y agoOn Windows you could create and mount a VHD file and format it as FAT32 by using the diskpart utility, with the commands "create vdisk", "attach vdisk", and "format"
- a1369209993 6y ago> allow the creation of a new FAT-32 image file of a specified length given a target directory [emphasis added] I think that's your problem: file systems are supposed to go onto a preexisting block device, which you'll need to create seperately. For example, on my system: dd if=/dev/zero of=/tmp/foo.dos bs=512 count=128K mkdosfs -F 32 /tmp/foo.dos Once you've created the filesystem, fill it with: mkdir /tmp/foo/ sudo mount -t msdos -o loop /tmp/foo.dos /tmp/foo/ # dump stuff into /tmp/foo/ sudo umount /tmp/foo.dos # or /tmp/foo/ # filesystem is in /tmp/foo.dos
- kevin_thibedeau 6y agoYou can adapt FatFS to do this. You just have to implement a few low level I/O routines to work using an conventional file as a fake block device.
- sgtnoodle 6y agoYou could use the non-petit version of this FAT library to do all the image twiddling from userspace, without having to rely on any kernel support. The only trick then would be compiling the code to run on windows. If you already support that in your build system, then great. Otherwise, you could try to find a suitable FAT implementation written in a cross platform language like python. Otherwise you're looking at some fairly nasty scripting to get windows to do the FAT filesystem manipulation for you. As far as I know, windows doesn't support loopback devices out of the box for example. Do you really need a baked FAT32 filesystem? Could you get away with a simpler payload like a tar?