PINE64
u-boot on SPI: USB boot partition - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=85)
+--- Forum: General Discussion on ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=86)
+--- Thread: u-boot on SPI: USB boot partition (/showthread.php?tid=5695)



u-boot on SPI: USB boot partition - prof7bit - 02-12-2018

I have read that it is possible to flash u-boot to the SPI flash to have more choice on boot devices. I have also seen a tutorial in the wiki mentioning it. But what I could not find is a detailed description of what is actually going on when u-boot is starting:

* does it look for a certain device type or are all USB mass storage or UBS/SATA bridges supported?
* does it look for a certain position in the USB bus, for example always the first USB storage found anywhere or always only the first port on the first hub?
* does it search all devices and look for a partition with a certain label?

I cannot seem to find any documentation about this u-boot configuration, also generally I cannot find much documentation about the boot process of the Rock64,  for example if the SPI flash is erased, what does it look for if it comes out of reset, is there always a fixed minimal loader in mask ROM somewhere and is it documented? Is it possible to accidentally brick the device?

It would be nice if someone could give a detailed description of the boot process, please describe it as detailed and low level as possible, target audience for this description would be an embedded (cortex M0 and M4) bare metal programmer who has no fear of beginnig to learn about the low level stuff going on during initialization and boot  in the larger ARM processors.

Thank you.


RE: u-boot on SPI: USB boot partition - xalius - 02-12-2018

It is a bit different for every ARM SoC, but usually there is a boot ROM in the hardware that looks for a valid boot device (sdcard, emmc, spi-flash, nand...), then there is a second stage loader (SPL - from u-boot or other source) on the image that initializes DRAM and loads the ATF (ARM Trusted Firmware) and u-boot from the image, u-boot then usually does some more hardware initialization if necessary and then loads your devicetree, initrd, kernel from the image to boot whatever OS you have... how you structure the image wrt to firmware location and partition layout is dependent on the first stage boot ROM and how you configure u-boot as well as what your OS requires, the FAT partition is more a convenience thing for Windows users so they can access some config files, it is not strictly necessary...

You can find more details how RK3328 boot in the technical reference manual (http://opensource.rock-chips.com/images/9/97/Rockchip_RK3328TRM_V1.1-Part1-20170321.pdf) and by looking at ayufan's github for the sources of u-boot, linux and the image build system, also the sources for the u-boot on the SPI flash: http://www.github.com/ayufan-rock64