views:

105

answers:

4

Hi,

My only experience in O/S development before this has been to create a 'Hello World' OS running from a Floppy drive.

What I need now is to develop a simple O/S to boot from a USB stick. And I have a few roadblocks:

  1. How do I write to the boot "sector" of a USB stick? Are there any tools available?

  2. Do you know of any good tutorials or guides directed towards USB bootloading?

  3. I need to be able to read files on the USB; what is the standard file system on a USB stick? FAT? Does Linux natively use FAT to store/read files on a USB?

NB: I am doing this just for learning all the dirty low level tricks, that's why I don't want linux on a stick to do this job.

+2  A: 

Boot from USB Stick

Bdiem
mkbt from the link is exactly what I was looking for! Thanks.
Rusty
Using a utility isn't really a 'dirty low level trick' ;)
Spidey
agreed :) but atleast to test the real kernel easily.
Rusty
A: 

Just adding an information. Mac on Stick will be a useful thing. You can get the core idea on file structure etc. Having a careful look will solve most of the above problems. :)

Chathuranga Chandrasekara
+1  A: 

Just some answers off the top of my head (since I deal with low-level disk structure a lot):

  1. You can just use a good hex editor that will let you write directly to a disk (such as HxD), or roll your own app that uses the CreateFile API (or the Linux equivalent).

  2. You can check out something like BartPE, which allows you to make a bootable XP image on a USB device.

  3. USB drives are 99% FAT. Linux does indeed support FAT natively for reading USB mass storage.

Dmitry Brant
+2  A: 
  1. There's no special boot sector, you just write the MBR to the very first 512 bytes on the flash drive.
  2. There are a lot of guides at Pendriveinux.com
  3. FAT works in most (if not all) cases. While Linux can work from FAT, you could just create another partition on the USB stick which will be ext2 (or any other non-journaling filesystem) and let Linux work on it. IT Solutions Knowledge Base has an article about making a persistent BackTrack flash drive installation using an ext2 partition.
Spidey