using dd to write to floppy
using dd to write to floppy
how do i use dd to write a boot sector to disk and to write my kernel file to the disk starting at the sector after the boot sector?
Re:using dd to write to floppy
You could start by reading the .:Quicklinks:. thread and the FAQ, and searching the forum archives:
Reply #17
reply #3
Reply #1
Reply #16
To be fair, the FAQ does not address this directly (though it does discuss creating disk image files), and it would require some knowledge of the dd(1)'s arguments to formulate a useful search string; but it still was not difficult to find this information here. The man page for dd(1) is also easy to find on the web (and should be on your system, anyway, if you're running Linux), if not particularly useful to a novice.
While creating a separate disk image is usually a better solution (as it can then be tested in an emulator such as BOCHS or VMware before running it live) the question of how to write directly to the disk comes up fairly often. Perhaps a page in the FAQ on this is called for.
In summation, what you want for the boot sector is probably:
[tt]dd if=<your boot file name> of=/dev/fd0 seek=0 bs=512[/tt]
while the kernel file would probably be
[tt]dd if=<your kernel file name> of=/dev/fd0 seek=1[/tt]
This is assuming that you are writing to fd0 (the first floppy drive). Before you do this, make sure that:
a) The files are in raw-binary format, and
b) the blank disk is loaded and mounted, if your setup doesn't do so automatically.
HTH, and welcome to the board.
Reply #17
reply #3
Reply #1
Reply #16
To be fair, the FAQ does not address this directly (though it does discuss creating disk image files), and it would require some knowledge of the dd(1)'s arguments to formulate a useful search string; but it still was not difficult to find this information here. The man page for dd(1) is also easy to find on the web (and should be on your system, anyway, if you're running Linux), if not particularly useful to a novice.
While creating a separate disk image is usually a better solution (as it can then be tested in an emulator such as BOCHS or VMware before running it live) the question of how to write directly to the disk comes up fairly often. Perhaps a page in the FAQ on this is called for.
In summation, what you want for the boot sector is probably:
[tt]dd if=<your boot file name> of=/dev/fd0 seek=0 bs=512[/tt]
while the kernel file would probably be
[tt]dd if=<your kernel file name> of=/dev/fd0 seek=1[/tt]
This is assuming that you are writing to fd0 (the first floppy drive). Before you do this, make sure that:
a) The files are in raw-binary format, and
b) the blank disk is loaded and mounted, if your setup doesn't do so automatically.
HTH, and welcome to the board.