Page 1 of 1

Copying boot.bin to sectors on Linux

Posted: Sun Nov 21, 2004 2:57 pm
by Vladaz
Hello, I have a problem:
I am using linux, and i want to copy boot.bin to bootable sector of floppy. I use like this: dd if=boot.bin of=/dev/fd0 , it writes me that it copied, but when I try to emulate it with bochs or with my real pc, it does not load. On bochs it writes:
[BIOS ] BIOS panic at rombios.c, line 1558

On my real pc it just skips and loads GRUB menu where I choose to load linux or windows. Can someone help me with that please?

Re:Copying boot.bin to sectors on Linux

Posted: Mon Nov 22, 2004 1:43 am
by Candy
Did you include a boot signature (0x55 0xaa) at the end of the first sector? If not, no computer is going to see your disk as bootable and thus complain.

Re:Copying boot.bin to sectors on Linux

Posted: Mon Nov 22, 2004 10:31 am
by Pype.Clicker
Vladaz wrote: On bochs it writes:
[BIOS ] BIOS panic at rombios.c, line 1558
What about Using the Source ? get the sources package for your distribution, locate bios/rombios.c, head yourself to line 1558 and read the comments around there to know what you should try to fix ?

Re:Copying boot.bin to sectors on Linux

Posted: Mon Nov 22, 2004 11:17 am
by Curufir
Not really helpful Pype. That particular part of rombios.c is a hack to make sure the panic message gets written out. The error itself probably happened way back in the code.

Re:Copying boot.bin to sectors on Linux

Posted: Mon Nov 22, 2004 11:28 am
by Vladaz
You see, my bootloader even doesn't boot on my real pc. I think there's a problem copying bootloader to boot sector. On windows everything is OK, but on linux there's that problem.
Im sure, that my boot.bin is ok. Because when i tried to boot it straight from bochs, it booted, and it worked, but using floppy it isn't. I think that there is some problem copying to floppy :/
Maybe you know any OS that has installation for linux, so i could just copy that os to floppy and then try?

Re:Copying boot.bin to sectors on Linux

Posted: Mon Nov 22, 2004 1:18 pm
by Curufir
No need to get that complicated.

Code: Select all

dd if=boot.bin of=/dev/fd0
dd if=/dev/fd0 of=boot.bin.bak bs=512 count=1

md5sum boot.bin boot.bin.bak
Or something similar if all you want is to verify that the 512 bytes of your bootsector did in fact get copied.

Re:Copying boot.bin to sectors on Linux

Posted: Tue Nov 23, 2004 6:00 am
by Pype.Clicker
Curufir wrote: Not really helpful Pype. That particular part of rombios.c is a hack to make sure the panic message gets written out. The error itself probably happened way back in the code.
well, not being sure i had the same bochs here, that was the best i could suggest ...

Re:Copying boot.bin to sectors on Linux

Posted: Tue Nov 23, 2004 11:57 am
by Curufir
Apologies, read that again and it sounds...odd.

I meant the code wasn't particularily helpful, the suggestion was sound.

Re:Copying boot.bin to sectors on Linux

Posted: Wed Nov 24, 2004 4:47 pm
by Vladaz
I've tried that code that Curufir posted.
boot.bin.bak is 0 bytes sizes. So I think it doesn't copy that boot.bin.
And one more thing, when i copy i get the result like this:
1+0 records in
1+0 records out
512 bytes transferred in 0,496871 seconds (1030 bytes/sec)
.
But there is one thing, when it is copying my boot.bin, fdd does not make any noise, that you can hear always when you are copying any data to floppys.

Re:Copying boot.bin to sectors on Linux

Posted: Wed Nov 24, 2004 5:18 pm
by Vladaz
Sorry guys for bothering you ;D
The problem was in my floppy disc :) It wasn't working :)

Re:Copying boot.bin to sectors on Linux

Posted: Mon Nov 29, 2004 4:48 am
by Pype.Clicker
Vladaz wrote: fdd does not make any noise, that you can hear always when you are copying any data to floppys.
The way linux uses the FDD is different from the way BIOS uses it, which means you may not recognize typical noises ...

Moreover, when writing to a floppy in linux, the actual data write may be postponed or may continue even after the program terminates. Usually, you should umount or sync to make sure the move is completed ...

Re:Copying boot.bin to sectors on Linux

Posted: Mon Nov 29, 2004 11:39 am
by Candy
Pype.Clicker wrote: Moreover, when writing to a floppy in linux, the actual data write may be postponed or may continue even after the program terminates. Usually, you should umount or sync to make sure the move is completed ...
Only when writing to a mounted device. If you write to the device file itself (/dev/fd0) you do get a direct write.