Page 1 of 1

OS Dev in Linux

Posted: Sat Sep 10, 2005 1:54 am
by Kyretzn
Heya all!

Basic question! :)

I have NASM and GCC and such on my Linux install. but Im kinda unsure how to get the bootsector.bin and the kernel.bin to their respective locations on the floppy disk.

I was simpl ythinking...

Ok, we can probably write ONE .bin file to the disk... like...

dd if=bootl.bin of=/dev/fd0

so... I should just combine... bootl.bin and prog.bin

im not exactly sure how to though.

touch newfile.bin
cat bootl.bin >> newfile.bin
cat prog.bin >> newfile.bin ?

Well, any help would be appreciated as usual.
Thanks!

~kyretzn

Re:OS Dev in Linux

Posted: Sat Sep 10, 2005 2:58 am
by Solar
Would work if your bootsector is exactly 512 byte (as it should be).

For simplicity, write:

cat bootl.bin prog.bin > newfile.bin

Re:OS Dev in Linux

Posted: Sat Sep 10, 2005 3:29 am
by Kyretzn
Thanks Solar! :)

Re:OS Dev in Linux

Posted: Sat Sep 10, 2005 4:50 am
by JoeKayzA
There's also a complicated way: ;D

Code: Select all

dd if=bootl.bin of=/dev/fd0
and then

Code: Select all

dd if=prog.bin of=/dev/fd0 conv=notrunc seek=1
The 'seek' tells dd to skip 1 block in the output file, notrunc is only needed when the output is a file rather than a block device (such as a floppy image for bochs). Just for completeness :)

cheers Joe