Dual Boot Bare-metal application and Linux


I need help to dual boot bare-metal application and Linux. Is there any simple version where this has been done before?

You can use U-boot to load either Linux or bare metal. U-boot has scripting capability, so you can control what to boot. U-boot also has basic HW initialization, especially SDRAM, so you can free yourself from low level initializations.


Is there any way to do dual boot. I need a simple application that runs immediately once the embedded system is powered on. The task is to mount USB Flash drive, then send data to the Host from the flash drive. I cannot wait for Linux to boot, as this is a time sensitive task. But once Linux has booted, I do not need my application and just will use Linux for the other tasks.

So U-Boot can only do one or the other, so then would I have to write a simple bootcode to boot U-boot on one core and that points to the script to mount USB and transfer a file to Host via TFTP. And have the other core run U-Boot to boot Linux.

How can this be achieved? Any guidance for a straight out of college person trying to accomplish a task.


U-boot will setup your basic hardware, load and execute your code on the first core only - which is the one running U-boot… If you want to use USB & a filesystem & ethernet & TFTP, all without an operating system, you would have to have all this functionality in your bare metal app. You could then boot Linux yourself from the USB.

Does it need to be a full-featured Linux? You can use Yocto can build a really stripped down minimal Linux which boots pretty damn quickly, but that’s quite a learning curve to go up. Initialising and starting a second (or more) core is pretty damn fiddley.

FreeRTOS might be what you’re looking for?

Good luck.

USB requires some time to initialize and enumerate the devices. Also it requires pretty large code to make it work. All in all - USB is not for immediate ready solutions. I suggest to use SD card which is ready really immediate. I’ve built the linux which boots in less than 2 seconds counting from power on to command prompt. For USB it requires additional 1-2 seconds to finish enumerate.