Page 1 of 1

Bochs and FAT16

Posted: Sun Jun 22, 2008 11:12 am
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?

Re: Bochs and FAT16

Posted: Sun Jun 22, 2008 11:46 am
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

Re: Bochs and FAT16

Posted: Sun Jun 22, 2008 2:28 pm
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.

Re: Bochs and FAT16

Posted: Sun Jun 22, 2008 3:20 pm
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.

Re: Bochs and FAT16

Posted: Wed Jun 25, 2008 6:10 am
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.

Re: Bochs and FAT16

Posted: Thu Jun 26, 2008 11:17 am
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?