OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 7:58 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: mkfat - Create a FAT image from a directory
PostPosted: Mon Feb 10, 2014 5:05 pm 
Offline
Member
Member

Joined: Mon Apr 09, 2007 12:10 pm
Posts: 775
Location: London, UK
I ran into a small problem when playing around with UEFI in that a FAT filesystem image is required. This can be problematic on some systems (e.g. Windows) where a loopback device is not possible (yes I know there are other ways with virtual disks etc), and is even a problem on e.g. linux as loopback devices need superuser privileges. So I went looking for a utility to create a FAT image from a directory in the current filesystem (in the same way that mkisofs creates a ISO9660 volume from a directory) but couldn't find one, so wrote this utility instead.

I release it here in the hope it is useful. MIT licensed.

It is based upon fatfs and will build with g++ on a system with the Boost libraries. Usage is simple:
Code:
mkfat [-o image_name] directory
to create 'image_name' from 'directory' (or can output to stdout if -o not specified).

Download

pre-alpha, no warranty etc. Please report bugs/feature requests.

Regards,
John.

_________________
Tysos | rpi-boot


Last edited by jnc100 on Thu Feb 13, 2014 11:15 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: mkfat - Create a FAT image from a directory
PostPosted: Mon Feb 10, 2014 7:58 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2426
Location: Canada
The traditional way to handle DOS/FAT filesystems on Unix is with mtools.

It seems to be reinvented often, someone else posted a similar utility here a few months ago.

_________________
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.


Top
 Profile  
 
 Post subject: Re: mkfat - Create a FAT image from a directory
PostPosted: Thu Feb 13, 2014 11:14 am 
Offline
Member
Member

Joined: Mon Apr 09, 2007 12:10 pm
Posts: 775
Location: London, UK
Brynet-Inc wrote:
The traditional way to handle DOS/FAT filesystems on Unix is with mtools.
Yes, I used to use mtools, however it has certain limitations for the particular task I was trying to do, namely create a reasonably large (~30 MiB) hard drive image for use with UEFI. Namely, it requires: 1) a way of creating a file of a particular size (e.g. dd), 2) knowing in the first place how big the file needs to be (which has to be hard wired into the build script or calculated with complex shell trickery), 3) need to supply the geometry of any non-standard disk (i.e. anything which isn't a floppy) and 4) the need for 'mtools_skip_check=1' in a ~/.mtoolsrc file on the users system for anything non-standard. As I am trying to have my build script work automatically on most systems (unix + windows), these limitations were becoming a bit of a headache, and so I created this instead.

tl;dr yes, there are other tools which work just as well in many situations. This is provided if anyone needs it.

Regards,
John.

_________________
Tysos | rpi-boot


Top
 Profile  
 
 Post subject: Re: mkfat - Create a FAT image from a directory
PostPosted: Thu Feb 13, 2014 1:30 pm 
Offline
Member
Member
User avatar

Joined: Tue Oct 17, 2006 9:29 pm
Posts: 2426
Location: Canada
For such a simple utility, all the dependencies seem to be a bit overkill. No? :-)

C++, fatfs.. and Boost?

The license for the FAT library appears to be permissive, but custom.. and surprisingly difficult to find, being stashed in a DOS formatted 00readme.txt file.

Regardless though, good luck with your project!

_________________
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.


Top
 Profile  
 
 Post subject: Re: mkfat - Create a FAT image from a directory
PostPosted: Tue Apr 25, 2017 1:15 am 
Offline

Joined: Tue Apr 25, 2017 1:04 am
Posts: 1
Hello John,

I have a question about fatfs and I guess you could point me in the right direction.
I have several partitions on a SD card, let's say partition A (e.g. user data) and partition B (e.g. read only data). I am trying to find out if it is possible to replace the partition A with an FatFs image (e.g. created with your tool). My idea is to update the complete user data by providing just one (image) file.

regards
Matthias


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group