Hello!
I'm fairly new to OS development (I started this Friday), and I've run into a problem with making an image file.
I understand how a simple "Hello world" bootloader work, and also made a clear screen function. (Both without using interrupts)
I should mention that I started reading BrokenThorn's tutorials yesterday, and got to tutorial 6 before having a problem.
I want to write a floppy disk image in the FAT12 file system, so that I can continue to follow BrokenThorn's tutorials.
The problem I'm having isn't really related to actually loading it (since I haven't got that far yet).
I know that the problem with my current approach is that PowerISO is writing the FAT12 bootsector to the image. How do I avoid that?
When I at first only had a bootsector, it was all fine - because it's just those 512 bytes that the BIOS reads.
Now I also have a second bootloader (or mini asm kernel), so that won't work anymore.
I then tried to search this forum and Google on how to do it. (The forum archive here is huge, so it'll be a big help I bet!)
I'm testing if it works with the binaries downloaded from the tutorial.
When I've got that working, I'm going to start on my own implementation. I don't want to start writing something I can't test.
Thanks in advance!
How do I write a FAT12 floppy disk image file?
How do I write a FAT12 floppy disk image file?
Last edited by az on Sun Oct 26, 2014 2:30 pm, edited 1 time in total.
Re: How do I write a FAT12 floppy disk image file?
Use the wiki, Luke, it has cookies^W articles.
Did you try to start from http://wiki.osdev.org/Disk_Images ?
Did you try to start from http://wiki.osdev.org/Disk_Images ?
Re: How do I write a FAT12 floppy disk image file?
Yes, and I looked at the "dd" command (I should've mentioned that in my original post).Nable wrote:Use the wiki, Luke, it has cookies^W articles.
Did you try to start from http://wiki.osdev.org/Disk_Images ?
I managed to create a floppy image, but how do I make it possible to add FAT12 headers to the files?
Sorry if the question is stupid, I don't really know exactly how FAT12 exactly works yet.
I know that FAT12 has the BIOS Parameter Block in the bootsector, and has same signature as a bootsector (which makes it a bootsector I guess)
And I assume every file has a FAT12 header which contains filename and such.
How do I get that header information in the image?
That's the part that confuses me.
Thanks.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: How do I write a FAT12 floppy disk image file?
Reading that page a bit further shows the whole shebang of tools for various combinations of filesystems and image files.how do I make it possible to add FAT12 headers to the files?
But I have a nagging suspicion you're trying to go at this without a clue on what's actually needed. If you're going to make a CD, are you only trying to make that floppy image because PowerISO is telling you it needs one? Have you figured out why it needs one?
Re: How do I write a FAT12 floppy disk image file?
Here-here to Combuster's overall assessment of your current predicament (ignoring the OS specifics of their analysis).
But... to clarify some simple steps (already pointed out to you)...
Make a floppy image:
Linux:... creates an emptry 1.44 meg floppy image named whateverfile.img.
... magically turns that image into a FAT12 formatted one.
Moving on...
Windows... I don't know about windows... forget it.
Moving on again...
If you're looking to make a FAT formatted disk yourself (from scratch... with your own blood sweat and tears)... see http://en.wikipedia.org/wiki/File_Allocation_Table to get an idea of how to setup the first sector, what's expected of the FAT tables (what clusters are), and how the directory structures are laid out. You'll easily be able to format one from scratch from that, and, as a bonus, be able to write a fully functional mini-driver for reading from the FAT filesystem during boot.
Finally... if you need an empty FAT12 formatted 1.44 image... here you go. Attached. Enjoy.
But... to clarify some simple steps (already pointed out to you)...
Make a floppy image:
Linux:
Code: Select all
$ dd if=/dev/zero bs=512 count=2880 of=whateverfile.img
Code: Select all
$ mkfs.msdos whateverfile.img
Moving on...
Windows... I don't know about windows... forget it.
Moving on again...
If you're looking to make a FAT formatted disk yourself (from scratch... with your own blood sweat and tears)... see http://en.wikipedia.org/wiki/File_Allocation_Table to get an idea of how to setup the first sector, what's expected of the FAT tables (what clusters are), and how the directory structures are laid out. You'll easily be able to format one from scratch from that, and, as a bonus, be able to write a fully functional mini-driver for reading from the FAT filesystem during boot.
Finally... if you need an empty FAT12 formatted 1.44 image... here you go. Attached. Enjoy.
- Attachments
-
- emptyfat12.img.gz
- Completely blank FAT12 formated 1.44 floppy image.
- (1.65 KiB) Downloaded 257 times
Re: How do I write a FAT12 floppy disk image file?
Just wanted to say that I no longer have problems with making a formatted floppy disk image.
I am using PowerISO to format it, and then I just overwrite first 512 bytes with my bootsector. I don't know what I was so confused about before to be honest.
I guess I will write my own formatter later on. Gave it a try a few days ago, but I ended up failing writing the FAT.
Thanks for the replies though!
I am using PowerISO to format it, and then I just overwrite first 512 bytes with my bootsector. I don't know what I was so confused about before to be honest.
I guess I will write my own formatter later on. Gave it a try a few days ago, but I ended up failing writing the FAT.
Thanks for the replies though!
Re: How do I write a FAT12 floppy disk image file?
http://staff.washington.edu/dittrich/misc/fatgen103.pdf is an earlier paper on FAT from MS that I find really useful. It was before they started ignoring documenting the specifics of what they were doing so it actually has very straight-forward and useful technical details in it. When you get back into reading/writing to a FAT FS that is.dib wrote:I guess I will write my own formatter later on. Gave it a try a few days ago, but I ended up failing writing the FAT.
Re: How do I write a FAT12 floppy disk image file?
Hi, thanks.mrstobbe wrote:http://staff.washington.edu/dittrich/misc/fatgen103.pdf is an earlier paper on FAT from MS that I find really useful. It was before they started ignoring documenting the specifics of what they were doing so it actually has very straight-forward and useful technical details in it. When you get back into reading/writing to a FAT FS that is.dib wrote:I guess I will write my own formatter later on. Gave it a try a few days ago, but I ended up failing writing the FAT.
Re: How do I write a FAT12 floppy disk image file?
As a side note you can also use WinImage (Runs natively on Windows and on Linux through Wine), It gives you options like modifying the bootsector, injecting files etc.
When you say, "I wrote a program that crashed Windows," people just stare at you blankly and say, "Hey, I got those with the system, for free." - Linus Torvalds
64 bit Kernel in early development
http://github.com/nerdguy12/core64
64 bit Kernel in early development
http://github.com/nerdguy12/core64