OS Dev in Linux

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
Kyretzn

OS Dev in Linux

Post 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
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:OS Dev in Linux

Post 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
Every good solution is obvious once you've found it.
Kyretzn

Re:OS Dev in Linux

Post by Kyretzn »

Thanks Solar! :)
JoeKayzA

Re:OS Dev in Linux

Post 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
Post Reply