Flash dhivael's SPI uboot (risky) - Printable Version

+- PINE64 (
+-- Forum: Pinebook Pro (
+--- Forum: Pinebook Pro Tutorials (
+--- Thread: Flash dhivael's SPI uboot (risky) (/showthread.php?tid=9053)

Pages: 1 2 3 4 5 6

Flash dhivael's SPI uboot (risky) - clover - 02-06-2020

Exclamation Warning: As far as I am aware, so far, this flash process has had about a 16% failure rate. It is difficult to restore your machine with a bad SPI flash. Please proceed at your own risk, and probably best not to try at all if you don't have experience or the time it takes to recover your machineExclamation

Necessary Items:
 - a screwdriver
 - USB Type-A to USB-C cable
 - Another Computer with a USB-A 3.0 port (I used a Macbook Pro with a type-c dongle, if you use something else, idk.)
Not a requirement but if you want to boot from nvme you need:
 - bootable NVME (i.e., with /boot/boot.txt having root=/dev/whatever_your_nvme_is plus some operating system. I use Manjaro. if you are unsure how to do this or want to sync your emmc with your nvme before hand, as400 has a great guide) preferably an intel 660p since it is what I have. 

Build and install rkdeveloptool on your other computer, find out all the info to do that on their Github
sanity test that you have installed it correctly
rkdeveloptool --version
should output: rkdeveloptool ver 1.3

On this other computer, make a directory to hold all of your files in.
mkdir ~/PBPBoot

You will need to have two files in this directory get them from: SPI_Flash
  1. the db flash helper($/i1mNQ). This prepares the SPI for a binary, in this case, u-boot.
  2. the uboot binary ($/H3yzt), built from dhivael's version of u-boot. 
Note: This uboot binary was built for SPI environment only. It will not work if you try putting it on your eMMC. It also probably will not work when trying to boot a kernel that is not mainline.

mv rk3399_loader_spinor_v1.15.114.bin ~/PBPBoot
mv dhiv_SPI_uboot.bin ~/PBPBoot
cd ~/PBPBoot

Now that is all set up, we need to get our Pinebook Pro into maskrom mode.

Plug the Type-A end into your non-Pinebook Pro device. Plug the Type-C end into your Pinebook Pro.

Remove all bootable devices from your pinebook pro.

Extra steps to clear SPI 
(Only necessary if you have flashed your SPI before, skip to end if you have never flashed anything to your SPI. If you are not sure and want to make sure it is empty, feel free to follow these steps.)
- on other computer: 
fallocate -l 16M zerospi
dd if=/dev/zero of=zerospi bs=1M count=16

- Plug your usb-a end into your other computer and usb-c end into your pinebook pro

- On pinebook, get into maksrom mode. If you can't maskrom easily because SPI is bootable (only should be the case if you have flashed uboot or some other boot software to your SPI already) follow as400's guide

- Verify you are in maskrom. On other computer: 
rkdeveloptool ld
look for maksrom output (e.g., DevNo=1 Vid=0x2207,Pid=0x330c,LocationID=1401 Maskrom)

- flash zerospi 
rkdeveloptool db rk3399_loader_spinor_v1.15.114.bin
rkdeveloptool wl 0 zerospi
rkdeveloptool td
rkdeveloptool rd

(thanks as400 for this part)

Back to the regular tutorial...

Reboot your computer, it will look like nothing is happening, no LEDs or anything.

to verify you are in maskrom mode, with your computers connected
rkdeveloptool ld
you should get an output like this 
DevNo=1 Vid=0x2207,Pid=0x330c,LocationID=1401 Maskrom

if that is looking good, lets move forward. if you get something like no devices found, either your pinebook is off or you have some bootable device still in your pinebook, or your cable is bad, or your computer doesn't put enough power through its usb. (tried this with two pinebooks and it didn't work)

Now we will flash the flash helper db file.
rkdeveloptool db rk3399_loader_spinor_v1.15.114.bin

if that works you will get output
Downloading bootloader succeeded.

Now for the exciting part
time to flash the new uboot to your SPI
rkdeveloptool wl 0 dhiv_SPI_uboot.bin

your output should end up being
Write LBA from file (100%)

good work, now you can run a test to make sure it's healthy.
rkdeveloptool td

hopefully you get Reset Device OK.

Now run
rkdeveloptool rd

which essentially reboots your pinebook pro.

You should see the red dot almost immediately. if you do see it, congrats! you now have an upstream SPI uboot (don't need to have uboot on emmc anymore. its very cool.)
boot order:
sd -> nvme -> usb -> emmc

RE: Flash dhivael's SPI uboot - Wizzard - 02-07-2020

Hi, what it the difference between your SPI flash and the one from pcm720?

RE: Flash dhivael's SPI uboot - clover - 02-07-2020

This is dhivael's flash from his forum post (, only now it has nvme support and can be flashed to the SPI so it doesnt need to live in the emmc. This uboot should also have USB support, but I haven't personally tested it. Also you get a red light when uboot starts and green light when kernel starts. Seems at least 2 seconds faster as well.

RE: Flash dhivael's SPI uboot - as400 - 02-07-2020

And also no binary blobs from Rockchip and no slow boot because of big cores not initializing correctly.
Confirmed working booting from NVME and SD.

People who have written SPI before might have problems getting into maskrom mode but that will be covered in another post.

U-Boot TPL 2020.01-00482-g3d3dbebfe8 (Feb 07 2020 - 00:49:56)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2020.01-00482-g3d3dbebfe8 (Feb 07 2020 - 00:49:56 +0100)
Trying to boot from SPI

U-Boot 2020.01-00482-g3d3dbebfe8 (Feb 07 2020 - 00:49:56 +0100)

Model: Pine64 Pinebook Pro
DRAM:  3.9 GiB
PMIC:  RK808
MMC:   dwmmc@fe320000: 1, sdhci@fe330000: 0
In:    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
Model: Pine64 Pinebook Pro
## Error: Can't overwrite "serial#"
## Error inserting "serial#" variable, errno=1
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
Net:   No ethernet found.
Press q or Ctrl-C to interrupt autoboot
Card did not respond to voltage select!
PCIE-0: Link up (Bus0)

Device 0: Vendor: 0x1987 Rev: EDFM00E2 Prod: 2977079A0F1400255452
           Type: Hard Disk
           Capacity: 915715.3 MB = 894.2 GB (1875385008 x 512)
... is now current device
Scanning nvme 0:1...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
269 bytes read in 4 ms (65.4 KiB/s)
1:      Manjaro
Retrieving file: /initramfs-dracut.img
17926524 bytes read in 41 ms (417 MiB/s)
Retrieving file: /Image
21029376 bytes read in 46 ms (436 MiB/s)
append: initrd=/initramfs-dracut.img console=tty1 rootwait rd.luks.uuid=99da2c1e-271d-48a6-9d10-768909d41380 root=UUID=6e05bd38-f565-4830-9dbd-492fd7d5d52c rootflags=noatime video=eDP-1:1920x1080@60
Retrieving file: /dtbs/rockchip/rk3399-pinebook-pro.dtb
81675 bytes read in 4 ms (19.5 MiB/s)
## Flattened Device Tree blob at 01f00000
  Booting using the fdt blob at 0x1f00000
  Loading Ramdisk to f4df9000, end f5f1197c ... OK
ERROR: reserving fdt memory region failed (addr=0 size=0)
  Loading Device Tree to 00000000f4de2000, end 00000000f4df8f0a ... OK

Starting kernel ...

RE: Flash dhivael's SPI uboot - amiraeva - 02-07-2020

Thanks everyone - worked like a charm! Now I'm booting off NVMe without that pesky eMMC chip.

RE: Flash dhivael's SPI uboot - Wizzard - 02-07-2020

I flashed that, but it does not boot from NVMe neither SD card. I reflashed SD card with Armbian but still does not boot. What can be wrong? The screen is just blank with backlight and green LED is on.

RE: Flash dhivael's SPI uboot - User 15997 - 02-07-2020

green led would mean that the kernel is running but hasn't loaded display drivers yet. do you have uart output?

RE: Flash dhivael's SPI uboot - Wizzard - 02-07-2020

No, I dont. BTW, do you know that is the boot device priority? Maybe I should remove eMMC? There is no OS on it.

RE: Flash dhivael's SPI uboot - clover - 02-07-2020

(02-07-2020, 02:04 PM)Wizzard Wrote: I flashed that, but it does not boot from NVMe neither SD card. I reflashed SD card with Armbian but still does not boot. What can be wrong? The screen is just blank with backlight and green LED is on.

I'm sorry that it didnt work for you. It is important to note this process is kinda risky since there are only 3 confirmed successful flashes this way. Can you tell me exactly what you did? 

are you getting red then green dot or just green dot?

Worst case scenario you need to get back into maskrom then reflash pcm's uboot which you know works on your device. look at as400's guide in Pinebook Pro tutorials on how to do that. ( or simply erase the SPI completely and have uboot on emmc again or sd.

RE: Flash dhivael's SPI uboot - as400 - 02-07-2020

@Wizzard are you sure that there is uboot on your sdcard ?
As far as i remember with pcm720 uboot on spi to boot from sdcard you'd have to destroy uboot on sd...

Make a new sdcard of whatever OS you want and try again.