Jump to content
  • 0

RK3399 NanoPI-M4 boot issues



I'm trying to build a linux from source on a RK3399 nanopi-m4. I did the below steps:


###  Download and compile ARM-TF ###
$ git clone https://github.com/ARM-software/arm-trusted-firmware.git
$ make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31


### Download and complie U-Boot ###
$ cd ..
$ git clone https://gitlab.denx.de/u-boot/u-boot.git
$ cd u-boot/
$ git checkout v2019.10
$ make CROSS_COMPILE=arm-linux-gnueabi- nanopi-m4-rk3399_defconfig
$ cp ../arm-trusted-firmware/build/rk3399/release/bl31/bl31.elf .
$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu-
$ make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- u-boot.itb

$ ./tools/mkimage -n rk3399 -T rksd -d ./tpl/u-boot-tpl-dtb.bin idbloader.img
Image Type:   Rockchip RK33 (SD/MMC) boot image
Data Size:    47104 bytes
$ cat spl/u-boot-spl-dtb.bin >> idbloader.img


### Build kernel ###
$ git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
$ cd linux
$ git checkout v5.1

**I've used the arm64 defconfig ***
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
$ make CROSS_COMPILE=aarch64-linux-gnu- ARCH=arm64


### Create boot.img ###
$ cd ..
$ mkdir boot
$ cp linux/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4.dtb boot/
$ cp arch/arm64/boot/Image boot/
$ cp linux/arch/arm64/boot/Image boot/
$ mkdir boot/extlinux
$ nano boot/extlinux/extlinux.conf

label NanoPi M4 5.1
  kernel /boot/Image
  devicetree /boot/rk3399-nanopi-m4.dtb
  append earlycon=uart8250,mmio32,0xff1a0000 root=/dev/mmcblk1p1 rootwait


$ dd if=/dev/zero of=boot.img bs=1M count=32
$ sudo mkfs.fat boot.img
$ mkdir tmp
$ sudo mount boot.img tmp/
$ cp -r boot/* tmp/
$ umount tmp


*** copy the images to a folder ***
$ mkdir images
$ cp boot.img images/ 
$ cp u-boot/idbloader.img images/
$ cp u-boot/u-boot.itb images/


### Create sd card image ###
$ cd images/

*** I'm using a VM so it was easier to use a loop device to create the image ***
$ dd if=/dev/zero of=sdcard.img bs=1024 count=0 seek=400000 || exit 1
$ sudo losetup -f
$ sudo losetup /dev/loop18 sdcard.img 
$ sudo dd if=idbloader.img of=/dev/loop18 seek=64
$ sudo dd if=u-boot.itb of=/dev/loop18 seek=16384
$ sudo dd if=boot.img of=/dev/loop18 seek=32768
$ sync

Flush the image(sdcard.img) with etcher to a card and place the card in the board.
Plug the UART cable and power on the board. I receive the below message:
U-Boot TPL board init
sdram_init: data training failed
rk3399_dmc_init DRAM init failed -5


Does anyone know what the issue is?


Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Donate and support the project!

This topic is now closed to further replies.

  • Create New...