OpenWrt Forum Archive

Topic: Boot directly from USB

The content of this topic has been archived on 16 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
From USB storage HowTo, I realized that USB storage can be made as root filesystem. However, I am wondering if there is a way to boot directly from USB device just like what BIOS does on every PC nowsaday.
Thanks for advice.
David

techie wrote:

Hi,
From USB storage HowTo, I realized that USB storage can be made as root filesystem. However, I am wondering if there is a way to boot directly from USB device just like what BIOS does on every PC nowsaday.
Thanks for advice.
David

There are basically two approaches to loading kernel direct from USB:
1) Add the functionality to your bootloader
2) Use a simple kernel image + initrd + Kexec, to find and execute a kernel from USB storage.

To do it 'just like what BIOS does on every PC nowsaday' requires a PC BIOS with PC BIOS interrupts, and they'll be difficult to emulate on non-x86 routers, so the best bet is just make your BIOS understand one of the Linux supported file systems like ext2 and grab the kernel from some pre-determined place (e.g. /boot/bzImage).   EXT2 reading code is arguably simpler than implementing your own BIOS.

cheers,
Biff.

i think there might be an other approach: Just resident the kernel+initrd in the internal flash but mount external usb-storage device as root partition.

But, i think, in both approaches, the router-box will not work independently any more -- boot process will rely on an external usb-storage device which looks not so reliable. some sophisticated scripts will be needed when exception occurred. That would be very tricky and dirty.

wish those be useful
Bug

yellowbug wrote:

i think there might be an other approach: Just resident the kernel+initrd in the internal flash but mount external usb-storage device as root partition.
Bug

I believe that is exactly the situation that the OP was trying to avoid, hence his post.

bifferos wrote:
techie wrote:

Hi,
From USB storage HowTo, I realized that USB storage can be made as root filesystem. However, I am wondering if there is a way to boot directly from USB device just like what BIOS does on every PC nowsaday.
Thanks for advice.
David

There are basically two approaches to loading kernel direct from USB:
1) Add the functionality to your bootloader
2) Use a simple kernel image + initrd + Kexec, to find and execute a kernel from USB storage.

To do it 'just like what BIOS does on every PC nowsaday' requires a PC BIOS with PC BIOS interrupts, and they'll be difficult to emulate on non-x86 routers, so the best bet is just make your BIOS understand one of the Linux supported file systems like ext2 and grab the kernel from some pre-determined place (e.g. /boot/bzImage).   EXT2 reading code is arguably simpler than implementing your own BIOS.

cheers,
Biff.

Where is the initrd file??  How can I create one??

I would love a easy step by step on this so I can get my 520gc doing something useful.

I have made USB Mod into 520GC, tried DD-WRT, Oleg's Firmware, but I'd like something more flexible, can someone help to make 520GC fully support OpenWRT,  USB Boot with all needed extantions ?

The discussion might have continued from here.