Page 1 of 1

Dealing with floppy images and Bochs [SOLVED]

Posted: Thu May 01, 2008 12:42 pm
by KrnlHckr
This should have been a straight forward project. It's turned into another nightmare.

I've worked throught the Bram tutorial and have successfully done some tweaking here and there in the code that allowed me to stretch my legs in OS development concepts. I used GRUB for that part of my project and it worked without much effort.

Now I've "rebooted" my training path and went back to basics to deepen my understanding of the boot sequence and the goofy things that go on during the real->protected switch and other things like A20 and near/far jumping (general x86 architecture knowledge).

I've entered in the basic "do nothing" asm code:

Code: Select all

loop:
     jmp loop

times 512 - ($ - $$) dd 0
     dd     0x55
     dd     0xAA
Assembled:

Code: Select all

$ nasm boot1.asm -f bin -o boot1.bin
I then made my floppy image:

Code: Select all

$ dd if=/dev/zero of=floppy.flp bs=512 count=2880
2880+0 records in
2880+0 records out
1474560 bytes (1.5 MB) copied, 0.027858 seconds, 52.9 MB/s
I dumped my binary to the image:

Code: Select all

$ sudo dd if=boot1.bin of=floppy.flp conv=notrunc
1+1 records in
1+1 records out
520 bytes (520 B) copied, 6.3486e-05 seconds, 8.2 MB/s
I verified that .bochsrc referenced my 'floppy.flp' image and started bochs.

What I got was a "FATAL: No bootable device" error.

I'm not entirely sure how to read it, but hexdump gives me the following:

Code: Select all

$ hexdump boot1.bin 
0000000 feeb 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200 0055 0000 00aa 0000                    
0000208

$ hexdump floppy.flp 
0000000 feeb 0000 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 0000 0000 0000 0000
*
0000200 0055 0000 00aa 0000 0000 0000 0000 0000
0000210 0000 0000 0000 0000 0000 0000 0000 0000
*
0168000
:evil: What gives? That seemed to be a straight forward "babystep".

Re: Dealing with floppy images and Bochs

Posted: Thu May 01, 2008 1:00 pm
by AJ
Hi,
You're going to kick yourself :)
KrnlHckr wrote:

Code: Select all

times 512 - ($ - $$) dd 0
     dd     0x55
     dd     0xAA
Should be:
times 510 - ($ - $$) db 0
db 0x55
db 0xAA
Cheers,
Adam

Re: Dealing with floppy images and Bochs

Posted: Thu May 01, 2008 1:08 pm
by KrnlHckr
AJ wrote:Hi,
You're going to kick yourself :)
OH MY GOD! :shock: :oops: :lol:

Yes, sir, it's one of those days. I stared at that for an hour and didn't notice that teeny tiny screw up. Pardon me as I head to a corner of the room and cry.

Thanks for pointing that out. I honestly feel really, really stupid.

Posted: Thu May 01, 2008 1:23 pm
by AJ
Don't worry - everyone has those days - me more than most!

Cheers,
Adam