Bona Fide OS Developer
View unanswered posts | View active topics It is currently Sun Nov 10, 2024 2:17 pm



Post new topic Reply to topic  [ 8 posts ] 
 booting from USB thumbdrive - info or snippets anyone? 
Author Message

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post booting from USB thumbdrive - info or snippets anyone?
I haven't googled or searched due to time... but I know I'm gonna need to at some point... I'm posting here so that maybe what I'm looking for will magically gather here and I'll have an easier time by he time I need this info... any help would help...

I am looking for info or example code on the intricacies in booting from a thumbdrive or from a SD card in case a PC has a slot for them...

A "hello world" bootloader from a USB thumbdrive... Reading and writing to and from a thumbdrive programmaticaly without support from the OS... A USB disk driver... BIOS support for USB harddrives and/or SD/MMC slots...

any stuff of the sort would help...


Mon Aug 31, 2009 5:14 pm
Profile
Site Admin

Joined: Sat Jul 25, 2009 7:44 am
Posts: 274
Location: United Kingdom
Post Re: booting from USB thumbdrive - info or snippets anyone?
I know GRUB will boot from a USB drive, I think you can use standard BIOS hard-disk interrupts as the USB drive becomes an emulated hard-disk. However I have never tried booting from an SD card or any other type of memory card, I do not know If BIOS's would emulate theese.

_________________
Thank you for reading,

Kieran C G Foot


Mon Aug 31, 2009 6:08 pm
Profile WWW

Joined: Tue Aug 04, 2009 12:44 pm
Posts: 11
Post Re: booting from USB thumbdrive - info or snippets anyone?
I think so, since your BIOS detect the SD card (inserted into card reader) as a disk, of course... but the point is once you are in protected mode, there is no more BIOS interrupts, so you will need to have the driver to read/write on USB disks or SD cards... but, AFAK some SD card readers are implemented as PATA devices, so it should work as hard disks... look at http://wiki.osdev.org/ATA_PIO_Mode for more information on how to read/write in hard disk using the ATA PIO mode.


Wed Sep 02, 2009 3:15 pm
Profile
Site Admin

Joined: Fri Jul 24, 2009 10:02 pm
Posts: 247
Location: Las Vegas, NV, US
Post Re: booting from USB thumbdrive - info or snippets anyone?
Also, read http://www.osdever.net/tutorials/lba.php for a simple example.

ATA is pretty well documented online, so it should be easy, though if you are using a USB card reader you will need to develop a USB hub interface. This also is well documented online.


Thu Sep 10, 2009 12:22 pm
Profile

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: booting from USB thumbdrive - info or snippets anyone?
You can't boot off SD cards. Not natively, anyway. You can however use tricks such as chain loading and create your own standard that is documented for your boot loader. In order to boot via USB you need a few things:

  • A BIOS that supports booting from USB.
  • The BIOS needs to be configured to allow that.
  • The device needs to allow that (i.e., a special chip that helps with booting - it is precisely this reason why you can't boot off a card reader... reminds you of the PnP Expansion Headers?).
  • Perhaps a special signature like the infamous 0x55AA.

The problem is that not all BIOSes treat USB booting the same and there's not even a de facto standard. Most of them use things like hard disk or floppy disk emulation and the usual El Torito for USB optical drives. I'd really hate to see someone trying to boot off some kind of USB Zip drive via a SCSI interface since that's probably the antonym of BAID :)


Wed Oct 14, 2009 12:36 pm
Profile

Joined: Mon Oct 26, 2009 2:33 pm
Posts: 38
Location: United Kingdom
Post Re: booting from USB thumbdrive - info or snippets anyone?
Do a search on google for HP USB Boot Key Utility, or alternatively PM me and I'll email it to you.

This program will format a USB key and ask for a bootable floppy image to copy onto the USB. So long as you write your bootloader and stuff and it works from a floppy disk, save out the image, stick it thru the HP Boot Key utility and voila, I think it formats it with FAT 12 or something so as long as your bootloader can read that then you get it to boot straight into a command line or something.

_________________
Andy Esser
neogenix Broadcast


Sun Nov 08, 2009 6:25 am
Profile
Post Re: booting from USB thumbdrive - info or snippets anyone?
All the conditions I have previously stated hold. The utility just writes sectors starting from offset 0, no magic whatsoever.


Mon Nov 09, 2009 12:58 am

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: booting from USB thumbdrive - info or snippets anyone?
That was me before. I didn't realize I could post without being logged on. Are you sure this is a good idea?

Cheers,
Bogdan


Mon Nov 09, 2009 1:00 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.