How to read the USB flash disk in protect mode?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
zeven
Posts: 3
Joined: Sun May 26, 2013 2:55 am

How to read the USB flash disk in protect mode?

Post by zeven »

I want to run my OS from in my USB flash disk.It has been successfully booted and go to the Kernel code.Now it's in protect mode(x86) and how can I read the USB disk?Have I to write a USB driver?I would not like to change the CPU's mode...
Also,I try to read it like ATA disk (through the I/O port 0x1F0--0x1F7) but failed.
friends help me... :cry:
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How to read the USB flash disk in protect mode?

Post by Combuster »

Two sensible options, really.

1:
write a USB driver
2:
Just load whatever you might care for from the USB stick into memory using the BIOS before actually launching your kernel, so you don't need a driver later. Ramdisks work pretty much the same way.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
osdog
Posts: 19
Joined: Wed May 01, 2013 2:59 am

Re: How to read the USB flash disk in protect mode?

Post by osdog »

Combuster wrote:1:
write a USB driver
You can try http://www.amazon.com/gp/product/1468151983
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: How to read the USB flash disk in protect mode?

Post by sortie »

That book looks pretty ideal for hobby osdev work.
User avatar
IanSeyler
Member
Member
Posts: 326
Joined: Mon Jul 28, 2008 9:46 am
Location: Ontario, Canada
Contact:

Re: How to read the USB flash disk in protect mode?

Post by IanSeyler »

The author reviewed his own book and only gave it 4/5 :|

Seriously though, has anyone read this book? Is it a good resource?
BareMetal OS - http://www.returninfinity.com/
Mono-tasking 64-bit OS for x86-64 based computers, written entirely in Assembly
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: How to read the USB flash disk in protect mode?

Post by DavidCooper »

I downloaded the Kindle version a week or two ago when it first came out (I couldn't afford to take a punt on the paper version before that, but I should have known to trust Mike Gonta when he recommended it here a year and a half ago). I've been reading through it repeatedly ever since then, and it certainly does make it all look possible, although there are still more than a few gaps left in my understanding. I reckon it could be the book that saves the hobby OS when EFI takes over, so it's probably an essential purchace, and it does a lot more than it says on the tin. Five stars from me.

I wouldn't want to work with it on a Kindle though - best to download the free program Kindle for PC (from Amazon) to read it on a computer so that you can navigate and scroll through it efficiently, or ideally get a paper version of the book.

As for the author reviewing his own book at Amazon, that was a clear mistake born out of modesty - his rating's the lowest one it's likely to get.
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming
Post Reply