Mainline U-Boot with SPI, NVMe and SATA boot support
#17
(02-02-2020, 11:40 AM)belfastraven Wrote: People have started to build mainline u-boot for the Pinebook-pro,  I'd like to try with a more robust dts than is being used (something based more on the manjaro one).  People are going through all kins of trouble writing to spi_flash with rkpdeveloptools to write the current mainline,  but I'd love to be able to provide them with a bootable flashing image like yours.  Sometimes the connections with rkdevelptools are a bit problematic.
The one thing I don't understand (I'm a linux newbie) is how to write the flashable image to get the correct "padding" between  the idbloader.image  and u-boot.itb. Is it just a dd command?   thnx
It would be cool to see a similar mainline U-Boot project for Pinebook Pro. I don't have a PBP, otherwise I would work on it, but if someone who has a PBP can take my work and adapt it that'd be great.

If you're asking about how to create spi_combined.img, it can be done using a dd command. On RK3399 the idbloader.img is always read first from a fixed location, SPI offset 0, by the boot ROM. Then, u-boot.itb is loaded by the code inside idbloader.img, from a configurable offset, set at U-Boot build time using CONFIG_SYS_SPI_U_BOOT_OFFS - you can see in that linked file it's set to 0x60000 for this build.
So, assuming idbloader.img is less than 0x60000 bytes long, we want to include padding after it so that u-boot.itb starts at 0x60000. This is done here in the build script, in particular this line:
Code:
dd if=/dev/zero of=$(img1name) conv=notrunc bs=1 count=1 seek=$padsize

pads the file $(img1name) to $padsize+1 (by seeking to offset $padsize and writing a single zero byte). $padsize is set to (0x60000 - 1) a few lines above. Then the u-boot.itb can just be concatenated on the end, using the cat command, to make spi_combined.img.

Then the flash script just loads that image to the address where a kernel would normally be loaded (${kernel_addr_r}) and then uses the "sf update" command to write it to SPI flash.
(02-02-2020, 11:40 AM)belfastraven Wrote: Also, Is it possible to just (through the serial console)  stop u-boot, probe, load the spi image (from whatever you are running u-boot), and sf update?  I guess I don't understand why one would have to disable the other devices to do that.  OF course once the flash was written, you'd have to stop u-boot and reboot, I guess.  Just curious...
Yes, it is possible to boot from any medium, stop autoboot, enable the SPI flash (if disabled) then run the commands in the flash script at the U-boot prompt to achieve the same effect as booting from a SD-card containing the flash_spi.img. Omitting the "run blink_work" commands, of course, since they just blink the white LED.
The only reason to need to disable SPI to do this is if somehow the code currently in your SPI won't boot up correctly as far as U-Boot proper, and you need to stop the Boot ROM trying to load it at all, to be able to do this.
  Reply


Messages In This Thread
RE: Mainline U-Boot with SPI and NVMe support (alpha/pre-release version for testing) - by sigmaris - 02-02-2020, 03:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  enble boot after power loss/restore dkebler 18 9,436 12-04-2023, 12:14 PM
Last Post: ok38
Bug Broken boot: What am I missing? mkosarek 1 667 09-08-2023, 08:14 AM
Last Post: wdt
  Unable to boot Armbian on new RockPro64 mooseball 5 4,260 07-14-2023, 08:59 AM
Last Post: rockjonn
  no boot white led flashing moserwi 7 4,319 05-18-2023, 10:46 AM
Last Post: wdt
  u-boot locked on pine64pro ljones 1 1,549 09-06-2022, 10:32 AM
Last Post: ljones
  Cannot get my board to boot deutschlmao 11 8,205 09-05-2022, 04:23 PM
Last Post: ljones
  U-BOOT Tutorial hazz 0 1,153 07-19-2022, 10:48 PM
Last Post: hazz
  Installation Debian on emmc: which U-Boot and where? vongillus 3 2,801 07-02-2022, 09:24 AM
Last Post: dkebler
  ROCKPRO64 PCI SSD SD-boot Install pspgarret 0 1,164 06-09-2022, 10:56 AM
Last Post: pspgarret
  Support says "regulator" on the SBC burned out; how to fix? dmos 0 912 06-02-2022, 02:20 AM
Last Post: dmos

Forum Jump:


Users browsing this thread: 3 Guest(s)