FAT booting

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
joke
Member
Member
Posts: 56
Joined: Sat Jul 22, 2006 6:20 am

FAT booting

Post by joke »

Hi all,
i'm trying to implement fat12 in my little os. So i created a simple BPB structure and added some simple test routines below the bpb (THE BPB and the test routines are in the same file). The BPB and boot code are in absolute sector 1. dd if=kernel.bin of=/dev/fd0

After that my floppy is not recongnisable. So i reformated my floppy (i use fdformat and mkdosfs) . I've also read this thread http://www.osdev.org/phpBB2/viewtopic.php?t=2781
So i went to fdisk to see my booting partition and there was no partition. i created one and added the fat12 and bootable flag. fdisk told me that the newly created partition started at sector 18. So i did
dd if=kernel.bin obs=512 seek=17 of=/dev/fd0 . I rebooted and the computer displayed " This is not a bootable disk "etc .
How can i boot my kernel and have fat12??????
I need someone to show me the things in life that I cant find
I cant see the things that make true happiness, I must be blind
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post by matthias »

Hi "KilledByDeath" :lol: Why don't you use grub instead. Saves you a lot of trouble, I can give you a floppy image if you like or you could search google ;)
The source of my problems is in the source.
joke
Member
Member
Posts: 56
Joined: Sat Jul 22, 2006 6:20 am

Post by joke »

well i could but the point is to program it yourself :wink:
I need someone to show me the things in life that I cant find
I cant see the things that make true happiness, I must be blind
User avatar
chase
Site Admin
Posts: 710
Joined: Wed Oct 20, 2004 10:46 pm
Libera.chat IRC: chase_osdev
Location: Texas
Discord: chase/matt.heimer
Contact:

Post by chase »

Don't partition your floppy unless you actually want to have mutliple filesystems on it.

Reformat the floppy, verify that the fat12 format progam you are using only makes one reserved sector and try putting your boot sector back on.

You can look at mine if it would help, http://www.osdev.org/f12boot.asm
User avatar
hailstorm
Member
Member
Posts: 110
Joined: Wed Nov 02, 2005 12:00 am
Location: The Netherlands

Post by hailstorm »

Hi Joke!

The best thing you can do is format the floppy and use the dd-command to write your own bootsector to the first sector on the disk.
(For the recognition of the filesystem by other operating systems, make sure the oem string in the bpb states MSWIN4.1. However, for booting the disk, this is not necessary ofcourse.)
You should now be able to copy your kernel onto the disk. If your bootsector works properly, the bootsector should be able to load you kernel and boot it.

Good luck.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Post by earlz »

Don't partition your floppy unless you actually want to have mutliple filesystems on it.
It's possible to partition your floppy!! :shock: :shock:
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post by matthias »

hckr83 wrote:
Don't partition your floppy unless you actually want to have mutliple filesystems on it.
It's possible to partition your floppy!! :shock: :shock:
If Chase says so, it has to be, right? anyway wtf. But I think it should be possible indeed.
The source of my problems is in the source.
SpooK
Member
Member
Posts: 260
Joined: Sun Jun 18, 2006 7:21 pm

Post by SpooK »

matthias wrote:
hckr83 wrote:
Don't partition your floppy unless you actually want to have mutliple filesystems on it.
It's possible to partition your floppy!! :shock: :shock:
If Chase says so, it has to be, right? anyway wtf. But I think it should be possible indeed.
Considering your posts, I think you need to spend more time doing reseach and less time attempting to answer the questions of others, especially when you obviously lack knowledge of the subject at hand. There are no brownie-points for sounding smart.
User avatar
hailstorm
Member
Member
Posts: 110
Joined: Wed Nov 02, 2005 12:00 am
Location: The Netherlands

Post by hailstorm »

I think it doesn't matter anyways. Partitioning the floppy drive only makes the problem more difficult. It's also a waste of space I think...
SpooK
Member
Member
Posts: 260
Joined: Sun Jun 18, 2006 7:21 pm

Post by SpooK »

hailstorm wrote:I think it doesn't matter anyways. Partitioning the floppy drive only makes the problem more difficult. It's also a waste of space I think...
In these days where the TeraByte is standard, you are correct :)

Stick with a standard FAT12 format, and you will be fine.
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post by matthias »

SpooK wrote:
matthias wrote:
hckr83 wrote: It's possible to partition your floppy!! :shock: :shock:
If Chase says so, it has to be, right? anyway wtf. But I think it should be possible indeed.
Considering your posts, I think you need to spend more time doing reseach and less time attempting to answer the questions of others, especially when you obviously lack knowledge of the subject at hand. There are no brownie-points for sounding smart.
Uhm, I've seen such a floppy before, I'm not brabling something here. The only thing the BIOS does is load the bootsector if it finds the 0xAA55. So you could have a sort of MBR on your floppy that looks up the parition table instead of some fat table within the first sector and then loads the partition sector, so yes it is possible, the only thing will be that it's probably not supported by any other OS, but possible it is.
The source of my problems is in the source.
User avatar
chase
Site Admin
Posts: 710
Joined: Wed Oct 20, 2004 10:46 pm
Libera.chat IRC: chase_osdev
Location: Texas
Discord: chase/matt.heimer
Contact:

Post by chase »

As far as partitioning on a floppy goes the only real issue is that most partitioning software such as MS fdisk won't install a MBR with partition table to a floppy. Reading actually works for most unix-type OSes. I ran across this a couple years back but don't remember what partitioning program I was using.

As most people are pointing out it's a waste of space for such a small media. Floppies are pretty much dead, there only benefit is that you can test OSes without fear of corrupting your hard drive. With the increase in hardware that can boot from usb thumb drives and most virtual machines being free now you'll see floppies being used less and less for OS development.

Just as you can have floppies with partitions you can also have hard drives without them. While I personally think that coding your own boot loader is great for learning I think more developers will start writting raw FAT16 hard drive images to be used by a VM if they want to test boot loaders.
Post Reply