FAT12 Boot Sector

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
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

FAT12 Boot Sector

Post by kenneth_phough »

I wrote a FAT12 boot sector but am not sure if it works. I'm going to assume that it doesn't work because I can mount the floppy after I dd my boot.bin to my floppy but I could have done it wrong. This is how I wrote my boot sector to my floppy.

Code: Select all

mkfs -t msdos -I /dev/sda 1440
dd if=boot.bin of=/dev/sda bs=512 count=1
Could this be the problem or my code?
http://www.kenax.byethost9.com/osdev/bo ... sector.asm

Thanks,
Kenneth
Mikae
Member
Member
Posts: 94
Joined: Sun Jul 30, 2006 1:08 pm

Post by Mikae »

So, what is the source of your question? Have you doubts about your code, which works with FAT12, or about how you have to move the code to a floppy?

Anyway, this is very strange that you could mount it, because you destroyed MBR partition table. After this, the floppy remains bootable, but I think that you will not able to manage its FS using Windows.
User avatar
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

I want my floppy to be bootable and at the same time have an FS. I wrote a bootsector that follows the fat12 boot sector format but couldn't write to the floppy and also I am not sure if my code will work because I haven't been able to test it.
Also I haven't been able to format my floppy on SuSE Linux. It says I should use setfdrpm which I haven't been able to work either. (My floppy drive is an external USB FDD)

Yours,
Kenneth
Mikae
Member
Member
Posts: 94
Joined: Sun Jul 30, 2006 1:08 pm

Post by Mikae »

Well, I think that the first command was right -- you created the file system, but the second was not -- writing to the first sector you destroyed MBR and its partition table. After that drive became unbootable.

To change file system boot sector you have to 'dd' your FAT12 code to the first sector of an active partition, not the drive itself. To find offset, where active partition begins you may use linux's fdisk.

For now, I think that you have to repartition your drive with fdisk, create file system using mkfs (or just format it under Windows), find where active partition begins and 'dd' your FAT12 code to this sector.

After that, I think you will able to boot from the drive and to test your code :).
joke
Member
Member
Posts: 56
Joined: Sat Jul 22, 2006 6:20 am

Post by joke »

Hell, thank you kennenth plough, YOU SAVED ME. Your bootsector contains code for a problem i had, and know i can solve it. A thousand thanks!
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
kenneth_phough
Member
Member
Posts: 106
Joined: Sun Sep 18, 2005 11:00 pm
Location: Williamstown, MA; Worcester, MA; Yokohama, Japan
Contact:

Post by kenneth_phough »

@joke:
Your welcome :D

@Mikae:
Thanks, I got it to work!
:D
Post Reply