Topic: Booting from USB

This is a quick explanation about how to configure Novena's U-Boot to load a Linux kernel from an attached USB device.

The way that I did this was to modify a variable within U-Boot, known as 'novena_boot' under 'CONFIG_EXTRA_ENV_SETTINGS' that Novena runs as a script in order to boot.

PROTIP: Before modifying U-Boot you should make a backup of your MicroSD card using the 'dd' command (not explained here).

First, since I don't have the hardware or know-how to talk to the serial console, I specify output to the monitor by adding:

"setenv stdout vga ; " \
"setenv stdin vga ; " \

Second, I hackishly forced booting from the first USB device by manually overriding the boot medium and device number:

"setenv bootsrc usb ; " \
"setenv bootdev 0 ; " \

Third is the tricky bit. According to the documentation, USB polls the device every millisecond, which can cause the OS to crash during boot, so USB support is not enabled by default, and must be disabled before booting. The results of all this is that we need to start USB support, load the Linux kernel off of it, then stop USB support. Add this piece of code before the 'fatload' commands (immediately or long before, it makes no difference):

"usb start ; " \

and this piece of code after the 'fatload' commands:

"usb stop ; " \

Note that it takes a couple of seconds when USB supported is started for it to scan devices. (Interestingly enough, USB fails to recognize my fail keyboard and doesn't stop the system and it hasn't failed to boot for me... yet! Best to be safe, of course.)

Now follow the instructions for installing (Deploying) U-Boot at: http://www.kosagi.com/w/index.php?title … _PVT_Notes

Oh, and, one terrible thing about this quick hack is that you *must* boot from USB since the bootsource has been overridden.

...you did make backups, right?

Re: Booting from USB

That's cool that USB booting works!  I hadn't tried it yet.

You're modifying core U-Boot and not anything SPL, so you can install your changes by copying u-boot.img to /boot/.  Since /boot/ is a FAT image, you can recover a system even if all you have handy is a Windows machine.

You might be able to get it working through uEnv.txt hooks.  Good find with "usb stop" -- that might be a thing to add to U-Boot to do that anyway.