Bochs and FAT16

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
Revelation
Member
Member
Posts: 47
Joined: Sat Jun 21, 2008 8:15 am

Bochs and FAT16

Post by Revelation »

Hi,

I'm having trouble with running a fat16 image of random size in Bochs. It says it can't boot from the image. Actually, I am not sure where I should link the image to Bochs. I have tried setting it in Floppy Disk 0, but that failed. The HD/CD option requires me to give other info like cylinders.

What should I do?
Now is the winter of my disk content.
User avatar
Combuster
Member
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: Bochs and FAT16

Post by Combuster »

If its a floppy, it's always FAT12 - a floppy doesn't have enough sectors (2880) to force a higher bitsize (2¹² = 4096)

Hence it must be a harddisk.

How to configure that in bochs:
http://bochs.sourceforge.net/doc/docboo ... STER-SLAVE
http://bochs.sourceforge.net/doc/docboo ... modes.html
http://bochs.sourceforge.net/doc/docboo ... image.html
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Revelation
Member
Member
Posts: 47
Joined: Sat Jun 21, 2008 8:15 am

Re: Bochs and FAT16

Post by Revelation »

So if I correctly understand what the manual suggests, I must use bximage to create an empty HDD image. Having done that, I am still baffled on how to copy my kernel and bootsector into the image. I have a feeling that if I just DD them in there, I will ruin the file system.
Now is the winter of my disk content.
User avatar
Combuster
Member
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: Bochs and FAT16

Post by Combuster »

True, but going into details about that will have me repeat practically everything said in your other thread ( http://forum.osdev.org/viewtopic.php?f=1&t=17287 ).

Edit: Speaking of which, maybe its time to install mtools as it will do just that which you seem to have been trying the past week.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Revelation
Member
Member
Posts: 47
Joined: Sat Jun 21, 2008 8:15 am

Re: Bochs and FAT16

Post by Revelation »

First of all, I apologize for my stupidity. I can't seem to figure it out how to boot from an unpartitioned HDD image.

This is what I've tried:

- create a 10mb HD image with bximage
- I configure Bochs: ata0-master: type=disk, mode=flat, translation=auto, path="c-20-16-63.img", cylinders=20, heads=16, spt=63, biosdetect=auto, model="Generic 1234"
- losetup -o32256 /dev/loop0 c-20-16-63.img
- mkfs.vfat -F 16 /dev/loop0 (says something about using standard HD settings)

Then I copy my boot sector on top of it, but I leave the disk's FAT sector as it is. Note that my boot sector hasn't got a partition table.

This renders my image non-bootable and sometimes its size is reduced to 512 bytes. It would really help if I had examples for FAT16 and HDD image, and not the usual floppy examples.
Now is the winter of my disk content.
User avatar
Revelation
Member
Member
Posts: 47
Joined: Sat Jun 21, 2008 8:15 am

Re: Bochs and FAT16

Post by Revelation »

I made some progress. I now have a working MBR (an adaptation of this one) that loads the first bootable partition. The code of that partition is still this code, only with the correct settings for a FAT16 partition.

When running this in Bochs, everything runs fine until the boot sector has to find kernel.bin. Bochs gives this error:

int13_diskette: read/write/verify: parameter out of range

5 times, because the code gives the read 5 tries. Obviously there is something wrong and I am baffled. Have you got any ideas?
Now is the winter of my disk content.
Post Reply