Hey guys! How would I boot my kernel from an USB? I've tried using AH=08h but it still says the kernel is not found. The floppy image works. However, when I put it on the USB, it says kernel not found. I've tried Plop Boot Manager (for VirtualBox) for the USB. It says kernel not found. What should I do?
Cheers
Steve
How do I boot kernel from USB?
How do I boot kernel from USB?
One day in the future... computers will be holograms...
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: How do I boot kernel from USB?
Some BIOSes don't support booting from USB. Other BIOSes support it, while some others can enable/disable it using a BIOS option. It would normally be called USB legacy or USB access from DOS.
Assuming your BIOS can boot from USB, the BIOS will typically emulate a floppy disk or a hard disk, depending on the contents of the first sector. If a valid MBR is found, the BIOS emulates a hard disk and you can see your USB stick as a hard disk, and you can then get its information using INT 0x13 function 0x48 and read/write with functions 0x42 and 0x43, respectively. If a valid MBR is not found, the BIOS will search for a valid BPB. If there is a BPB, it will emulate a floppy disk, and you can read it like you would any floppy disk. In fact, your code shouldn't even be aware that it's booting from USB.
Booting from USB in a beginning stage is not encouraged though, because when you enter 32-bit or 64-bit mode, you won't have access to the BIOS anymore, and will need to access the USB device yourself. To guarantee this works on all hardware, you're going to need drivers for all the major USB controllers (UHCI, OHCI, EHCI and xHCI) as well as drivers for the standard USB mass storage devices (although 99% of USB sticks are of the class "bulk-only").
Assuming your BIOS can boot from USB, the BIOS will typically emulate a floppy disk or a hard disk, depending on the contents of the first sector. If a valid MBR is found, the BIOS emulates a hard disk and you can see your USB stick as a hard disk, and you can then get its information using INT 0x13 function 0x48 and read/write with functions 0x42 and 0x43, respectively. If a valid MBR is not found, the BIOS will search for a valid BPB. If there is a BPB, it will emulate a floppy disk, and you can read it like you would any floppy disk. In fact, your code shouldn't even be aware that it's booting from USB.
Booting from USB in a beginning stage is not encouraged though, because when you enter 32-bit or 64-bit mode, you won't have access to the BIOS anymore, and will need to access the USB device yourself. To guarantee this works on all hardware, you're going to need drivers for all the major USB controllers (UHCI, OHCI, EHCI and xHCI) as well as drivers for the standard USB mass storage devices (although 99% of USB sticks are of the class "bulk-only").
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: How do I boot kernel from USB?
Do I need to pad out my BPB then? It says kernel not found when I boot from USB. When I use my floppy image, it does work. My USB used to be able to boot my kernels. Until, I recreated my kernel. Maybe it could be something to do with my bootloader.
One day in the future... computers will be holograms...
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: How do I boot kernel from USB?
Look at your boot loader yourself. Is it meant to go on a hard disk or floppy disk? If the latter, does it have a valid BPB? Else, does it have a valid MBR? Use the Wiki as reference on how MBRs and BPBs look like. Inspect it yourself using a hex editor as well. This is just very basic debugging, really.stevej150 wrote:Do I need to pad out my BPB then? It says kernel not found when I boot from USB. When I use my floppy image, it does work. My USB used to be able to boot my kernels. Until, I recreated my kernel. Maybe it could be something to do with my bootloader.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: How do I boot kernel from USB?
Hi,
My OS can boot from a pendrive.
At the bottom of the following webpage see section "Build (Linux)". Booting from USB is explained there.
https://sites.google.com/site/forthoperatingsystem/
Regards,
rob
My OS can boot from a pendrive.
At the bottom of the following webpage see section "Build (Linux)". Booting from USB is explained there.
https://sites.google.com/site/forthoperatingsystem/
Regards,
rob
Re: How do I boot kernel from USB?
Very interesting, what is the license by the way?bigbob wrote:My OS ...
It can, but hard coding the BIOS drive identifier is not a general (nor recommended solution) for systems that boot and run from USB.bigbob wrote:... can boot from a pendrive.
Re: How do I boot kernel from USB?
A good question. Currently nothing. I am thinking about GPLv3.mikegonta wrote:Very interesting, what is the license by the way?
You must be referring to 0x80.It can, but hard coding the BIOS drive identifier is not a general (nor recommended solution) for systems that boot and run from USB.
I should get the "BIOS drive identifier" somehow from BIOS, but how?
Re: How do I boot kernel from USB?
It comes free with every classic BIOS boot, just don't idly throw it away (and loose) it.bigbob wrote:You must be referring to 0x80.It can, but hard coding the BIOS drive identifier is not a general (nor recommended solution) for systems that boot and run from USB.
I should get the "BIOS drive identifier" somehow from BIOS, but how?
Re: How do I boot kernel from USB?
Now I understand it (dl). Thanks.mikegonta wrote:It comes free with every classic BIOS boot, just don't idly throw it away (and loose) it.