Booting of flash drives

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
Coldberg
Posts: 8
Joined: Fri Apr 25, 2008 2:03 pm

Booting of flash drives

Post by Coldberg »

Does anyone have any resources on booting from the flash drive (besides the usb mass storage specs), i'd like to see an overview of what i'd have to code for it to work (considering my bootoptions since floppies seem to have started disapearing fromt he face of the earth)
indiocolifa
Member
Member
Posts: 41
Joined: Sat May 24, 2008 12:41 pm
Location: La Plata, Argentina

Post by indiocolifa »

Format your USB drive using mtools, make it bootable transferring your boot sector with mformat. It should work if your BIOS supports booting from USB.

For Windows systems, see http://www.bootdisk.com/pendrive.htm for tips.

I hope that helps...
indiocolifa
Member
Member
Posts: 41
Joined: Sat May 24, 2008 12:41 pm
Location: La Plata, Argentina

Post by indiocolifa »

Coldberg
Posts: 8
Joined: Fri Apr 25, 2008 2:03 pm

Post by Coldberg »

but as i see it , it works based on emulation , and isn't that bios only ?
if i need to load more files of that usb not actually using the bios ?
User avatar
CmpXchg
Member
Member
Posts: 61
Joined: Mon Apr 28, 2008 12:14 pm
Location: Petrozavodsk, Russia during school months, Vänersborg Sweden in the summertime

Post by CmpXchg »

Well, yes, BIOS will boot your bootsector, and probably your second-stage loader too, and most likely the kernel too.

To load further files without using BIOS you'll need to implement:
-) a USB low-level access driver which actually accesses the USB bus;
-) a USB mass storage device driver which interacts with your flash drive (using the access driver to communicate over USB)
-) Generic FAT16/32 filesystem driver which will rely on the mass storage device driver to read/write sectors.

Challenging, eh? :D
Coldberg
Posts: 8
Joined: Fri Apr 25, 2008 2:03 pm

Post by Coldberg »

a bit XD
what about CD-ROM booting ?
i know CD-ROM's come in different types ATAPI (that is standartised i gues so no problem in coding a driver for that) what about SCSI tho ? is that standartised or is it like different for each drive ?
User avatar
CmpXchg
Member
Member
Posts: 61
Joined: Mon Apr 28, 2008 12:14 pm
Location: Petrozavodsk, Russia during school months, Vänersborg Sweden in the summertime

Post by CmpXchg »

SCSI is unfortunately not standardized, so we hoobyists can't make drivers for it. Well, if you manage to download a specification, you can try coding some driver, but it won't work on every computer.

So it's best to implement ATAPI instead. Then goes the tedious CD-ROM UDF filesystem...

A good OS should be able to start at least from FAT32 hard drives and from CD-ROMs, in my opinion.

Cheers,
CmpXchg
User avatar
Masterkiller
Member
Member
Posts: 153
Joined: Sat May 05, 2007 6:20 pm

Post by Masterkiller »

I think I'm gonna use USB flash for booting. In the CMOS setup in the boot priority There is option USB-zip and two more USB (I don't remember them now).
When booting from CD-ROM, immediately after the boot AL contains the BIOS number of the device to pass to INT13/AH=03;AH=43; to read. Does booting from USB flash is the same? The virtual PC and bochs does not support USB boot, so could it be possible the same loader code work for USB and CD-ROM (getting BIOS number, using EXTENTED READ INT13/AH=43; Load fixed location of kernet code/data...);
Since I still work on the kernel, I need read/write access anywhere, and due to some problems I prefer this not to be HDD (I don't want to lose the information :wink: );
ALCA OS: Project temporarity suspended!
Current state: real-mode kernel-FS reader...
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

If you want to write a Pmode driver, i would say the easiest to code is the
Hdd, then fdd and cd, which are about the same and the hardest would be the USB.

Anything that users fdd/hdd emulation unless you switch it off (send the right code), stops working in Pmode, BUT and that a big but, when you go back to realmode, emulation works as you left it, this means you can Read/write to a USB key fob or read from the floppy image on a CD, by going to and from real mode at any time.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

CmpXchg wrote:SCSI is unfortunately not standardized, so we hoobyists can't make drivers for it.
That's not true? :?

Now, SCSI controllers on the hand... you're right, a driver would have to developed for each chipset, but a generic SCSI layer is possible.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
CmpXchg
Member
Member
Posts: 61
Joined: Mon Apr 28, 2008 12:14 pm
Location: Petrozavodsk, Russia during school months, Vänersborg Sweden in the summertime

Post by CmpXchg »

Brynet-Inc wrote:Now, SCSI controllers on the hand... you're right, a driver would have to developed for each chipset, but a generic SCSI layer is possible.
Yep, the generic SCSI layer is possible, but the access drivers (the ones who perform IN/OUT instructions and handle interrupts) will be different.

To be exact, even the USB PCI config space registers are different for for motherboard (or USB controller), so we generally don't use them, right, Dex?
Last edited by CmpXchg on Sun Jun 08, 2008 2:07 am, edited 1 time in total.
Coldberg
Posts: 8
Joined: Fri Apr 25, 2008 2:03 pm

Post by Coldberg »

i'm just looking for an easy way to boot without using a floppydrive or bios
bios would be nice if i could actually use it but v86 is kicking me in the balls
and i don't feel like switching modes all the time
i decided to go with CD (el-torito no emulation mode)
here's my sketch did i miss anything ?
Image
User avatar
CmpXchg
Member
Member
Posts: 61
Joined: Mon Apr 28, 2008 12:14 pm
Location: Petrozavodsk, Russia during school months, Vänersborg Sweden in the summertime

Post by CmpXchg »

This brings us to a discussion on BIOS in PMode. Unfortunately, INT13h services become unavailable in PMode, but there is still some subset of BIOS functions that can be called from PMode, VBE3 or PCIBIOS32, to name some.

Where can I get a full list of these? It could of a lot help to an OS.

@Coldberg: The sketch looks allright. Just thought maybe it's best to start PMode in bootkernel, because you'll need real-mode BIOS to load your ATAPI and ISO-9660 drivers.
Coldberg
Posts: 8
Joined: Fri Apr 25, 2008 2:03 pm

Post by Coldberg »

this is the monolithic part that goes into the part that gets autoloaded
Post Reply