Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i put a compiled boot sector onto a USB stick or disk?

I'm actually interested in how an OS works, from the POST over the Boot process to the Kernel, GUI, etc.

Well I have to start at the beginning: The bootsector

Most tutorials only specify how to get your .bin bootstrapper onto an USB stick for Linux users.

But as I'm using XP I would like to ask how do I get my 512 byte .bin onto the right position on my USB, and thats definitely not by copying it with explorer :D

like image 934
orossum Avatar asked Dec 12 '09 22:12

orossum


People also ask

Can I use a USB stick as a boot drive?

To create a bootable USB flash drive Insert a USB flash drive into a running computer. Open a Command Prompt window as an administrator. Type diskpart . In the new command line window that opens, to determine the USB flash drive number or drive letter, at the command prompt, type list disk , and then click ENTER.


1 Answers

There's dd for Windows which I use regularly. http://www.chrysocome.net/dd

use it like so:

dd if=c:\my files\boot.bin of=\\.\z: bs=512 count=1

where 'z:' is the drive letter of your mounted USB drive, 'if' is the input file, and 'of' is the output device, bs is the block size, and the count is the number of blocks to copy

I do this about once a month to see how Haiku development progresses. They offer raw disk images that are written to a USB drive this way.

WARNING: Getting the drive letter wrong can destroy YOUR bootsector, so make sure you do a backup and become comfortable using dd first. I've lost a lot of data to it's power.

like image 75
RandomInsano Avatar answered Oct 03 '22 00:10

RandomInsano