U-Boot on SPI flash - discussion
#11
(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?
  Reply
#12
(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
Come have a chat in the Pine A64 IRC channel >>
  Reply
#13
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.
  Reply
#14
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?
  Reply
#15
@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.
--
Arwen Evenstar
Princess of Rivendale
  Reply
#16
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.
  Reply
#17
(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
  Reply
#18
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.
  Reply
#19
(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.
  Reply
#20
Well, I happen to have one of those already, nice. I guess I'm already set to experiment without worry.
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  How to Boot Manjaro from emmc? Sats 1 48 2 hours ago
Last Post: xmixahlx
  Booting from an SD card without the boot order update jaysistar 6 180 8 hours ago
Last Post: jaysistar
  Boot from SD and edit screen res on native OS? dhosh 3 41 10 hours ago
Last Post: dhosh
  boot partition bsammon 0 58 01-25-2020, 06:10 PM
Last Post: bsammon
  U-Boot with direct NVMe boot support for eMMC/SPI Flash pcm720 56 5,919 01-24-2020, 02:46 PM
Last Post: Wizzard
  Unable to boot: blinking red light houki 3 158 01-18-2020, 04:45 AM
Last Post: houki
  Bionic image boot from SD mamboman777 9 192 01-17-2020, 06:39 AM
Last Post: pete
  Can I boot system from nvme SSD? plumlis 6 525 01-12-2020, 04:47 PM
Last Post: bcnaz
  The usage/access of the SPI flash aaspectre 2 163 01-06-2020, 08:14 AM
Last Post: aaspectre
  PIneBook Pro - Boot from SD mcdomx 9 1,344 12-19-2019, 12:43 PM
Last Post: tophneal

Forum Jump:


Users browsing this thread: 1 Guest(s)