1 1

RK3399 NanoPI-M4 boot issues

Recommended Posts

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?


Share this post

Link to post
Share on other sites
49 minutes ago, crobert said:

Does anyone know what the issue is?


This works for us. When you get to the boot loader ... generic arm64 kernel config you will not get you far. 

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.

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.

1 1