BBB boot from SPI flash

I’m attempting to implement boot to Linux from SPI flash on the Beaglebone Black. The motivation is to implement secure boot using u-boot vboot from write protected SPI flash.

I’ve been working with 2016.01 u-boot release.

My progress to date is that I can boot the u-boot SPL (MLO) from SPI and that runs, but it didn’t find any SPI device to boot from. So patched the code to enable pin mux for SPI0 and forced SPI boot in common/spl/spl.c.

Now I can see it loading u-boot.img from 0x20000 over the SPI bus. But it hangs when attempting to jump to the loaded u-boot.

Wondering has anyone got a howto on this?


I just tried the latest u-boot 2016.05 and it worked this time without any difficulty. I just had to edit configs/am335x_boneblack_defconfig and
replace option CONFIG_SYS_EXTRA_OPTIONS with
CONFIG_SYS_EXTRA_OPTIONS=“SPI_BOOT” and add line CONFIG_SPI_FLASH_STMICRO=y (because my SPI flash chip is a ST Microelectronics M25P16).

I was able to program the flash from another build of u-boot with the SPI bus enabled by entering the following commands from the u-boot command prompt:

sf probe 0
sf erase 0 +200000
mmc rescan
fatload mmc 0 ${loadaddr} MLO.byteswap
sf write ${loadaddr} 0 ${filesize}
fatload mmc 0 ${loadaddr} u-boot.img
sf write ${loadaddr} 0x20000 ${filesize}

To test, hold down the Beaglebone Black S2 button while applying power. That kicks in an alternative boot order which puts boot over SPI0 bus at the top of the list.