Rockpi4/Linux system runs on M.2 NVME SSD
ROCK Pi 4 > Linux system runs on M.2 NVME SSD
- 1 Prerequisites
- 2 Step 1 Install ROCK Pi 4 u-boot image to SPI Flash
- 3 Step 2 Install ROCK Pi 4 system image to M.2 NVME SSD
- 4 Step 3 Test M.2 NVME SSD booting from SPI Flash
- 5 FAQs
- 6 Troubleshooting
It is exciting that, on ROCK Pi 4, NVME is able to boot from SPI Flash. Here is the tutorial about Linux system running on M.2 NVME SSD.
To follow this tutorial, you will need:
- A well-running ROCK Pi with eMMC or Micro SD Card
- Linux system image for ROCK Pi 4
- SPI Flash image (ROCK Pi 4 u-boot image)
- SPI Flash IC on ROCK Pi 4
- Single power supply voltage range: 2.7~3.6V
- Space: at least 4MB
- M.2 NVME SSD with M.2 NVMe SSD Reader Adapter
- Support brand: HP, Intel, MaxMemory, KingSpec, etc
Step 1 Install ROCK Pi 4 u-boot image to SPI Flash
There are two methods for installing u-boot image to SPI Flash, but you must installed the SPI Flash IC on your ROCK Pi4 before this methods.
Method One: Write image to SPI flash from USB OTG port
Fitrstly, Get ROCK Pi 4 u-boot image from here
Select the target files, called uboot-trust-spi.img and rk3399_loader_spinor_v1.15.114.bin .
Then just follow Write image to SPI flash from USB OTG port to flash image.
Method Two: Write image to SPI flash using mtd tool
This method requires a running system on ROCK Pi 4 board. So now power on the ROCK Pi 4. Maybe your ROCK Pi system is running on eMMC module or uSD card. It is OK.
Firstly, add Radxa APT source. The latest version of u-boot and kernel are still in testing.
For Debian stretch
$ export DISTRO=stretch-testing # update more frequently but maybe unstable $ echo "deb http://apt.radxa.com/$DISTRO/ stretch main" | sudo tee /etc/apt/sources.list.d/apt-radxa-com.list
or Ubuntu server
$ export DISTRO=bionic-testing # update more frequently but maybe unstable $ echo "deb http://apt.radxa.com/$DISTRO/ bionic main" | sudo tee /etc/apt/sources.list.d/apt-radxa-com.list
Get the pub key
$ wget -O - apt.radxa.com/$DISTRO/public.key | sudo apt-key add -
$ sudo apt-get update && sudo apt-get upgrade
Install necessary packages
$ sudo apt-get install -y rockchip-fstab $ sudo apt-get install -y rockchip-overlay $ sudo apt-get install -y rockpi4-dtbo $ sudo apt-get install -y linux-4.4-latest # Will update kernel
Update u-boot in uSD card or eMMC:
$ sudo apt-get install -y rockpi4b-rk-u-boot-latest # Will get the newest version of u-boot package, but not update the u-boot on eMMC or uSD card $ sudo /usr/local/sbin/rockpi4b_upgrade_bootloader.sh
Type YES to perform the flashing.
Modify file, /boot/hw_intfc.conf. Uncomment these lines.
intfc:uart4=off intfc:spi1=on intfc:dtoverlay=spi1-flash
Reboot the machine.
After login, there is a device /dev/mtd0.
Since we have done a lot of preparation, now it is time to install the image to SPI Flash. Just follow the commands.
$ sudo /usr/local/sbin/rockpi4b_write_spi_flash.sh
After that, something are shown to us.
Doing this will overwrite data stored on SPI Flash and it will require that you use eMMC or SD as your boot device. Type YES to continue or Ctrl-C to abort.
We follow its suggestion and type YES. Now we just wait until the installation job is done. Installation log shows like this.
Writing /dev/mtd0 with content of /usr/lib/u-boot-rockpi4b/spi/uboot-trust-spi.img Erasing 4 Kibyte @ 3ff000 -- 100 % complete Writing data to block 0 at offset 0x0 Writing data to block 1 at offset 0x1000 Writing data to block 2 at offset 0x2000 Writing data to block 3 at offset 0x3000 Writing data to block 4 at offset 0x4000 ... Writing data to block 1020 at offset 0x3fc000 Writing data to block 1021 at offset 0x3fd000 Writing data to block 1022 at offset 0x3fe000 Writing data to block 1023 at offset 0x3ff000 Done.
Step 2 Install ROCK Pi 4 system image to M.2 NVME SSD
It is convenient to install system image to M.2 NVME SSD.
Put the M.2 NVME SSD into M.2 NVMe SSD Reader Adapter, and then insert them to PC.
When they are ready, use tool command dd or APP Etcher to install system image to M.2 NVME SSD.
Use Etcher APP
Use tool command "dd"
Get your NVME SSD device path:
sudo fdisk -l
You can see the out put message just like this:
Disk /dev/nvme0n1: 232.9 GiB, 250059350016 bytes, 488397168 sectors #The '/dev/nvme0n1' is your NVME SSD device path Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
sudo dd if='your image path' of='your NVME SSD device path' bs=1M #such as: sudo dd if=rockpi4-debian-stretch-desktop-arm64-20190710_1940-gpt.img of=/dev/nvme0n1 bs=1M
Step 3 Test M.2 NVME SSD booting from SPI Flash
Power off ROCK Pi 4, remove eMMC module or uSD Card from ROCK Pi 4 since there is system image in eMMC module or uSD Card.
Insert M.2 NVME SSD into ROCK Pi 4.
Power on ROCK Pi 4.
- u-boot supporting NVME booting verison
- 2017.09-2676-g4490220395 (or newer)
- kernel version
- 4.4.154-87-rockchip-00029-g8216f17 (or newer)
- rockpi4-dtbo version
- 1.1 (or newer)
- Debug log
rock@ubuntu:~$ ls /dev/mtd* /dev/mtd0 /dev/mtd0ro /dev/mtdblock0 rock@ubuntu:~$ cat /proc/mtd dev: size erasesize name mtd0: 00400000 00001000 "loader" rock@ubuntu:~$ sudo dmesg | grep spi [sudo] password for rock: [ 2.227001] rockchip-spi ff1d0000.spi: Failed to request TX DMA channel [ 2.227587] rockchip-spi ff1d0000.spi: Failed to request RX DMA channel [ 2.228171] rockchip-spi ff1d0000.spi: no high_speed pinctrl state [ 2.229257] m25p80 spi32766.0: xt25f32b (4096 Kbytes) [ 2.229715] 1 ofpart partitions found on MTD device spi32766.0 [ 2.230273] Creating 1 MTD partitions on "spi32766.0":
- Verified SPI Flash
- How to know that the image has been successfully installed to SPI Flash?
- For the newest version of u-boot, when it runs, the red(or blue) led is on.
- You can remove booting devices such as uSD card, eMMC module and so on. Power on ROCK Pi 4 with SPI Flash on board to see if the red(or blue) led is on. If yes, it means that you make it.
- If you have a issue, start a new post on the forum. https://forum.radxa.com/