Samuel
Samuel

Reputation: 1152

Installing bootloaders

I am creating a toy os and cannot find a good way to install the bootloader onto the first sector of a drive.

I use PARTCOPY but that only works on xp with floppy disks.

Does anyone know a program or method to install a 512 byte bin file onto the first sector of a drive. Preferably the program can also read the first sector of a drive.

I am running windows

Upvotes: 0

Views: 193

Answers (1)

thor
thor

Reputation: 22560

dd in Linux can do that: http://www.cyberciti.biz/faq/howto-copy-mbr/

For example (http://en.wikipedia.org/wiki/Dd_%28Unix%29#Master_boot_record_backup_and_restore), to backup the first sector of a harddrive:

dd if=/dev/sda of=MBR.img bs=512 count=1

to restore the first sector:

dd if=MBR.image of=/dev/sda

You can change /dev/sda to /dev/sda1 if you want to target the first partition instead of the entire disk.

Upvotes: 1

Related Questions