PINE64
U-Boot on SPI flash - discussion - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: General Discussion on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=112)
+--- Thread: U-Boot on SPI flash - discussion (/showthread.php?tid=8452)

Pages: 1 2 3


RE: U-Boot on SPI flash - discussion - zaius - 12-02-2019

(12-02-2019, 11:09 AM)xalius Wrote: You can write SPI flash from u-boot or from Linux, for emergency recovery even in the PBP, two IC test clips are probably the easiest solution...

By shunting the clock pin to ground?


RE: U-Boot on SPI flash - discussion - xalius - 12-02-2019

(12-02-2019, 02:01 PM)zaius Wrote:
(12-02-2019, 11:09 AM)xalius Wrote: You can write SPI flash from u-boot or from Linux, for emergency recovery even in the PBP, two IC test clips are probably the easiest solution...

By shunting the clock pin to ground?

Yes


RE: U-Boot on SPI flash - discussion - pcm720 - 12-02-2019

While it's not something you're really after, after a lot of frustration and head-scratching I was able to build a working SPI flash image for my fork of U-Boot:

[Image: nz86P8H.png]

I ended up using Rockchip's firmwareMerger with the following config to build the image:
Code:
[System]
FwVersion=19.12.03
BLANK_GAP=1
FILL_BYTE=0
[UserPart1]
Name=IDBlock
Flag=0
Type=2
File=rkbin/bin/rk33/rk3399_ddr_933MHz_v1.24.bin,rkbin/bin/rk33/rk3399_miniloader_spinor_v1.14.bin
PartOffset=0x40
PartSize=0x7C0
[UserPart2]
Name=uboot
Type=0x20
Flag=0
File=u-boot.img
PartOffset=0x4000
PartSize=0x2000
[UserPart3]
Name=trust
Type=0x10
Flag=0
File=out/sd/trust.img
PartOffset=0x6000
PartSize=0x2000

For some reason, firmwareMerger from Rockchip repository doesn't work properly, so I had to use the version from Radxa's repository to get proper image.
It should also be possible to use U-Boot TPL and SPL instead of Rockchip blobs, but haven't found any concrete answer on how to build the image using these. Documentation just isn't clear enough, and recovery process is too cumbersome and annoying.

dd is good enough for flashing the image to the SPI. Just make sure to use flash_erase beforehand.
In case something goes wrong and PBP gets stuck somewhere in early boot, the easiest recovery method I found is taking off the metal shield and shorting SPI clock to ground until ARM Trusted Firmware (BL31) initialization. After Linux boots, you can just use dd or flash_erase to reflash/erase the chip.

Overall, it works fine on my device, so there's no more eMMC in my Pinebook Pro Smile
You can find the image here. The build scripts for everything are here.


RE: U-Boot on SPI flash - discussion - Wizzard - 12-03-2019

So if I just flash that SPI image, it will boot directly from SD, then NMVe and then eMMC? No other uboot flash for eMMC is needed?


RE: U-Boot on SPI flash - discussion - Arwen - 12-03-2019

@pcm720, Thank you for both trying and making your results available to all.

Does your SPI version support booting off SD card if one is installed?

Edit: Never mind, just read your latest post in the "U-Boot with direct NVMe boot support", it answers yes, we can boot SD cards with your SPI image.


RE: U-Boot on SPI flash - discussion - pcm720 - 12-03-2019

Yes. However, pre-made SD images do not work:
[Image: tTMBMZP.png]
For some reason Rockchip's SPL tries (and fails) to initialize trust mode with the microSD, so it must not contain any of the bootcode.
In other words, SD has to be partitioned just like any block device. The same most likely goes for the eMMC.


RE: U-Boot on SPI flash - discussion - Wizzard - 12-03-2019

(12-03-2019, 06:18 AM)pcm720 Wrote: Yes. However, pre-made SD images do not work:

For some reason, Rockchip's SPL tries to use SD card and fails to initialize trust mode, so the microSD should not contain any of the bootloaders.
In other words, SD should be partitioned just like any block device. The same most likely goes for the eMMC.

So, it will not boot SD cards like Ubuntu or Debian or any of other PBP images? How to fix that?

edit: answer: here: https://forum.pine64.org/showthread.php?tid=8439


RE: U-Boot on SPI flash - discussion - aaspectre - 01-05-2020

Maybe a silly question, but is the SPI flash not clippable? I haven't seen the hardware itself so I don't know. If one can use a pomona clip and flashrom or s/t then it's a fairly easy recovery.


RE: U-Boot on SPI flash - discussion - hmuller - 01-06-2020

(01-05-2020, 11:19 PM)aaspectre Wrote: Maybe a silly question, but is the SPI flash not clippable? I haven't seen the hardware itself so I don't know. If one can use a pomona clip and flashrom or s/t then it's a fairly easy recovery.

The Pomona 5250 clip works well. There are cheap knockoffs but the reviews of them are not favorable. The authentic version runs about $15.50 USD before shipping. If you are in the US, you can pick one up at Grainger and save yourself shipping.


RE: U-Boot on SPI flash - discussion - aaspectre - 01-07-2020

Well, I happen to have one of those already, nice. I guess I'm already set to experiment without worry.