2 2
dacen

How to boot from nvme in Rock pi 4B?

Recommended Posts

As the title, I successfully flashed my spi flash according to Radxa official course but my board could not boot. 

 

I found when I inserted the SDcard and connected the nvme disk which both was flashed lastly Armbian buster image, my board can boot and boot from nvme disk.  It looks like an SD card can boot nvme because start the sd card central subsystem first and then run the system in nvme. 

 

now i want to boot Armbian from nvme disk and don't insert SDcard, what should I do?

Share this post


Link to post
Share on other sites
Want Armbian t-shirt or a cup?

2 hours ago, dacen said:

As the title, I successfully flashed my spi flash according to Radxa official course but my board could not boot. 


Armbian has nothing to do with Radxa official SPI flashing. We don't provide boot from SPI at the this moment, especially not from 3rd party boot loader. 
 

2 hours ago, dacen said:

It looks like an SD card can boot nvme because start the sd card central subsystem first and then run the system in nvme.


That is expected to work - such install way is officially supported. I don't know if nvme boot is supported ...

 

2 hours ago, dacen said:

now i want to boot Armbian from nvme disk and don't insert SDcard, what should I do?

 

In theory? (if nvme support exists in u-boot) Adjust SPI boot loader sources that will be looking for Armbian boot boot.scr script. Recompile, flash to SPI and boot the board. Most likely - without looking into the code or their official images - the only difference is that they have FAT boot partition, while Armbian boots from EXT4. Some small adjustments ... I am out for vacations and will not look into the code for some time.

Share this post


Link to post
Share on other sites

I was able to boot from NVME with the u-boot from Radxa. I compiled an Armbian image from the dev branch and copied the image to the nvme drive. I had to then press ctrl-c to get to the u-boot shell. This then makes it boot with a rootfs from the NVME. Most of it is from the armbian u-boot. I just added the few lines needed to enable pcie.

setenv scriptaddr 0x00500000
setenv load_addr "0x39000000"
setenv overlay_error "false"
# default values
setenv rootdev "/dev/nvme0n1p1"
setenv verbosity "1"
setenv console "both"
setenv rootfstype "ext4"
setenv docker_optimizations "on"
echo "Boot script loaded from ${devtype} ${devnum}"
setenv prefix /boot/
if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then
    load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt
    env import -t ${load_addr} ${filesize}
fi
if test "${console}" = "display" || test "${console}" = "both"; then setenv consoleargs "console=tty1"; fi
if test "${console}" = "serial" || test "${console}" = "both"; then setenv consoleargs "console=ttyS2,1500000 ${consoleargs}"; fi
if test "${devtype}" = "nvme"; then part uuid nvme ${devnum}:1 partuuid; fi
setenv bootargs "root=${rootdev} rootwait rootfstype=${rootfstype} ${consoleargs} panic=10 consoleblank=0 loglevel=${verbosity} ubootpart=${partuuid}"
if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1"; fi
setenv ramdisk_addr_r 0x04000000
setenv kernel_addr_r 0x02000000
load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd
load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image
setenv fdt_addr_r 0x01f00000
setenv fdtcontroladdr f5f06228
setenv fdtfile rockchip/rk3399-rock-pi-4.dtb
load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile}
fdt addr ${fdt_addr_r}
fdt resize 65536
load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/rockchip/overlay/${overlay_prefix}-fixup.scr
echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)"
source ${load_addr}

setenv bootargs "earlycon=uart8250,mmio32,0xff1a0000,1500000n8 root=${rootdev} rootwait rootfstype=${rootfstype} ubootpart=${partuuid}"

fdt set /pcie@f8000000 status okay
fdt set /pcie@f8000000 num-lanes <4>
fdt set /pcie@f8000000 max-link-speed <2>
fdt set /syscon@ff770000/pcie-phy status okay
fdt set /pcie@f8000000 ep-gpios  <0xb7 27 0>
fdt set /pcie@f8000000 pinctrl-names  default
fdt set /pcie@f8000000 pinctrl-0 <0x145>

booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}

 

Share this post


Link to post
Share on other sites

Yes, NEW Linux rockpi 4.4.198-rockchip64 boot fine SPI without SDcard

(Kingston A2000 NVME), also Gigabyte SSD M.2 2280 PCIe x2

SPI_boot_armbian.png

Share this post


Link to post
Share on other sites

Hello friends.
I also successfully booted with nvme without uSD and mmc.
Used the image: Armbian_19.11.3_Rockpi-4b_buster_legacy_4.4.198
Hardware: RockPI4B + KingSpec SSD M2 nvme 120gb
First updated SPI flash via rockpi4b_upgrade_bootloader.sh
U-Boot 2017.09-2681-geb41d9a6ce (Nov 04 2019 - 09:32:53 +0000), Build: jenkins-linux-build-testing-2-85
Also in arbianEnv.txt added fdtfile = rk3399-rockpi4b.dtb
and copied rk3399-rockpi4b.dtb to / boot / dtb

Share this post


Link to post
Share on other sites

something new has come, great

Armbian_19.11.3_Rockpi-4b_buster_current_5.3.11.img and radxa official SPI 4b u-boot,

 

Kingston A2000 M.2 2280 PCIe NVMe
Gigabyte SSD M.2 2280 PCIe x2 Model:GP-GSM2NE8128GNTD
XPG GAMMIX S5 PCIe Gen3x4 M.2 2280 512
Kingston 240GB A1000 SSD = PHISON PS5008-E8-10
Samsung 250GB 970 EVO Plus SSD-levy, M.2 2280, PCIe 3.0 x4, NVMe, 3500/2300 MB/s
Intel SSD 660p Model:SSDPEKNW512GB

 

boot with nvme without uSD and mmc

Share this post


Link to post
Share on other sites
On 11/21/2019 at 3:34 PM, atula said:

Yes, NEW Linux rockpi 4.4.198-rockchip64 boot fine SPI without SDcard

(Kingston A2000 NVME), also Gigabyte SSD M.2 2280 PCIe x2

SPI_boot_armbian.png

 

Hey, just wanna do the same things, but I don't know how to do it. I'm kinda new on this. Can you give me step-by-step pretty plaseeeeeeeeee 🥺 thank you!

Share this post


Link to post
Share on other sites

can do many ways, here's one

- first flash spi  u-boot  https://forum.radxa.com/t/spi-nvme-booting-beta/1306

- flash Armbian img DL https://dl.armbian.com/rockpi-4b/archive/ and extracxt http://www.7-zip.org/ and flash it to sdcard https://www.etcher.io/ 

- connect pin 23 and 25 together, put sdcard to rocpi , root,  passwd 1234

- apt update

- apt upgrade

- wget https://dl.armbian.com/rockpi-4b/archive/Armbian_19.11.3_Rockpi-4b_buster_legacy_4.4.198.7z

- 7z e armbian.com/rockpi-4b/archive/Armbian_19.11.3_Rockpi-4b_buster_legacy_4.4.198.7z

- dd if=Armbian_19.11.3_Rockpi-4b_buster_legacy_4.4.198.img of=/dev/nvme0n1 bs=1M

-  e2fsck -f /dev/nvme0n1p1

reboot, wait 2-3 sek. and remove SDcard, when red led light

again in "root" and passwd "1234".................

- apt update

- apt upgrade

- nano /boot/armbianEnv.txt

- add "fdtfile=rockchip/rk3399-rockpi4b.dtb" if 4.4.198, if 5.x.x , add "fdtfile=rockchip/rk3399-rock-pi-4.dtb"

ctrl + x .....y

- remove connect pins 23, 25,

- remove SDcard

- reboot

sorry my bad english

 

what brand of nvme you have?

 

 

Share this post


Link to post
Share on other sites

also 

PNY 250GB XLR8 CS3030 M.2 NVMe SSD-levy, PCIe Gen3 x4, 3500/1050  (Hynix)

not start SPI

works well with SDcard with Armbian

Share this post


Link to post
Share on other sites

WD_Black & WD_Black SN750 with spi u-boot works on rock pi 4a

 

installed armbian buster 5.3.11 this way

- flash armbian to sd-card
	Armbian_19.11.3_Rockpi-4b_buster_current_5.3.11.img
- flash spi u-boot
	https://wiki.radxa.com/Rockpi4/dev/spi-install

- boot from spi
- hit ctrl-c serveral times to enter u-boot command prompt
- plug sd-card
- execute in u-boot prompt
	dcache off;pci e; nvme scan; nvme info;
	setenv fdtfile rockchip/rk3399-rock-pi-4.dtb
	run bootcmd_mmc1
	
- login to armbian (first time pwd 1234)
- check nvme
	lsblk
- create new partition(s)
	optional boot partition needs to be the first partition on disk (256M) otherwise root is first partition
- mount root partition to /mnt (boot to /mnt/boot)
- copy running system
	tar -lpc --exclude dev/* --exclude proc/* --exclude sys/* / | tar -xpv -C /mnt
- prepare change root to /mnt
	mount -o bind /dev /mnt/dev
	mount -o bind /proc /mnt/proc
	mount -o bind /sys /mnt/sys
	chroot /mnt
- modify /etc/fstab (UUID for root; copy root and modify it to match boot)
	-- block id for single root partition
	blkid /dev/nvme0n1p1

	-- block id for boot partition
	blkid /dev/nvme0n1p1
	-- and root
	blkid /dev/nvme0n1p2
- modify UUID of root partition in /boot/armbianEnv.txt
- add fdtfile to /boot/armbianEnv.txt
	fdtfile=rockchip/rk3399-rock-pi-4.dtb
- create symbolic link for boot (boot partition only)
	cd /boot
	ln -s . boot
- update initramfs
	update-initramfs -u
- exit (chroot)
	exit
- shutdown running system (sd-card)
	poweroff
- unplug sd-card
- switch power off and on again

 

Share this post


Link to post
Share on other sites

The following works using an Intel 760p M.2 NVMe...

 

Download Radxa Debian 9 Desktop image:

    https://wiki.radxa.com/Rockpi4/downloads

 

Find the device letter for your SD card and write the image to it:
    sudo fdisk -l  
    gzip --stdout rockpi4-debian-stretch-desktop-arm64-20190730_2022-gpt.img.gz | sudo dd of=/dev/sdx status=progress

 

Boot Rock Pi 4 with Radxa Debian 9 Desktop SD Card:
    <Open a command-line window such as LXTerminal>
    sudo su - root
    apt-get update && apt-get -y dist-upgrade
    <This updates the Radxa tools and asks (type "y") to write the latest uboot image to the /dev/mtd0 SPI chip>

 

Download and write the Armbian image to the NVMe drive:
    wget https://dl.armbian.com/rockpi-4b/archive/Armbian_20.02.1_Rockpi-4b_bionic_current_5.4.20_minimal.7z
    apt-get install p7zip-full
    7z e -so Armbian_20.02.1_Rockpi-4b_bionic_current_5.4.20_minimal.7z | dd of=/dev/nvme0n1 status=progress

 

Add two lines to the armbianEnv.txt file:
    mount /dev/nvme0n1p1 /mnt
    vi /mnt/boot/armbianEnv.txt
        fdtfile=rockchip/rk3399-rock-pi-4.dtb
        overlays=pcie-gen2

 

Power off the Rock Pi 4 and remove the SD Card.

 

Power on and it boots Armbian using the NVMe drive.

 

FYI... You may have to jumper pin 23 (SPI_CLK) and 25 (GND) which disables the SPI chip to boot Armbian from an SD Card. You could also boot the Radxa Debian 9 Desktop and run /usr/sbin/flash_erase to wipe the SPI chip.

Share this post


Link to post
Share on other sites

Tested Rockpi4a v1.4 SPI U-Boot 2017.09-2686-g18c70dba63 (Dec 31 2019 - 12:33:07 +0000), Build: jenkins-linux-build-testing-2-136

 

this works, only flash img to nvme, do nothing  armbianEnv.txt or boot.cmd, no sdcard

Intel 660p 
Armbian_20.02.1_Rockpi-4a_buster_legacy_4.4.213.img
.......................
Hit key to stop autoboot('CTRL+C'):  0

Device 0: RKPARM: Invalid parameter part table
Vendor: 0x8086 Rev: 002C     Prod: BTNH90820C73512A
            Type: Hard Disk
            Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)
... is now current device
Scanning nvme 0:1...
Found U-Boot script /boot/boot.scr
2940 bytes read in 5 ms (574.2 KiB/s)
## Executing script at 00500000
Boot script loaded from nvme 0
189 bytes read in 6 ms (30.3 KiB/s)
6758686 bytes read in 67 ms (96.2 MiB/s)
19752968 bytes read in 171 ms (110.2 MiB/s)
93124 bytes read in 23 ms (3.9 MiB/s)
** File not found /boot/dtb/rockchip/overlay/rockchip-fixup.scr **
.............................

Kingston 2000 and Gigabyte

this works, armbianEnv.txt add fdtfile=rockchip/rk3399-rock-pi-4.dtb

Armbian_20.02.7_Rockpi-4a_buster_current_5.4.28.img
.................
Hit key to stop autoboot('CTRL+C'):  0

Device 0: RKPARM: Invalid parameter part table
Vendor: 0x2646 Rev: S5Z42102 Prod: 50026B72823F1B89
            Type: Hard Disk
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
... is now current device
Scanning nvme 0:1...
Found U-Boot script /boot/boot.scr
2940 bytes read in 4 ms (717.8 KiB/s)
## Executing script at 00500000
Boot script loaded from nvme 0
189 bytes read in 4 ms (45.9 KiB/s)
7287636 bytes read in 69 ms (100.7 MiB/s)
20787712 bytes read in 184 ms (107.7 MiB/s)
72736 bytes read in 11 ms (6.3 MiB/s)
2698 bytes read in 6 ms (438.5 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)

................................................................................

 

These NVME not works, tested , many scripts, there is errors

 

kingston A1000
Armbian_20.02.7_Rockpi-4a_buster_current_5.4.28.img
.................
Hit key to stop autoboot('CTRL+C'):  0

Device 0: RKPARM: Invalid parameter part table
Vendor: 0x2646 Rev: E8FK11.R Prod: 50026B76826C0418
            Type: Hard Disk
            Capacity: 228936.5 MB = 223.5 GB (468862128 x 512)
... is now current device
Scanning nvme 0:1...
Found U-Boot script /boot/boot.scr
2985 bytes read in 7 ms (416 KiB/s)
## Executing script at 00500000
Boot script loaded from nvme 0
189 bytes read in 5 ms (36.1 KiB/s)
ERROR: status = 13, phase = 1, head = 1
 ** fs_devread read error - block
ERROR: status = 13, phase = 0, head = 1
 ** fs_devread read error - block
72736 bytes read in 22 ms (3.2 MiB/s)
2698 bytes read in 10 ms (262.7 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)
................

 

PNY CS3030 250GB
.........................
Armbian_20.02.7_Rockpi-4a_buster_current_5.4.28.img
....................
Hit key to stop autoboot('CTRL+C'):  0

Device 0: RKPARM: Invalid parameter part table
Vendor: 0x1987 Rev: CS303224 Prod: PNY35190025670102900
            Type: Hard Disk
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
... is now current device
Scanning nvme 0:1...
Found U-Boot script /boot/boot.scr
2940 bytes read in 6 ms (478.5 KiB/s)
## Executing script at 00500000
Boot script loaded from nvme 0
189 bytes read in 5 ms (36.1 KiB/s)
ERROR: status = 2013, phase = 1, head = 1
 ** fs_devread read error - block
ERROR: status = 2013, phase = 0, head = 1
 ** fs_devread read error - block
72736 bytes read in 13 ms (5.3 MiB/s)
2698 bytes read in 11 ms (239.3 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)
...............................
Samsung 970 EVOPlus
Armbian_20.02.7_Rockpi-4a_buster_current_5.4.28.img
....................
Hit key to stop autoboot('CTRL+C'):  0

Device 0: RKPARM: Invalid parameter part table
Vendor: 0x144d Rev: 1B2QEXM7 Prod: S4EUNG0M122756V
            Type: Hard Disk
            Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
... is now current device
Scanning nvme 0:1...
Found U-Boot script /boot/boot.scr
2940 bytes read in 5 ms (574.2 KiB/s)
## Executing script at 00500000
Boot script loaded from nvme 0
189 bytes read in 3 ms (61.5 KiB/s)
ERROR: status = 2013, phase = 1, head = 1
 ** fs_devread read error - block
ERROR: status = 2013, phase = 0, head = 1
 ** fs_devread read error - block
72736 bytes read in 15 ms (4.6 MiB/s)
2698 bytes read in 7 ms (376 KiB/s)
Applying kernel provided DT fixup script (rockchip-fixup.scr)
.................................

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
2 2