As I’ve installed ubuntu 18.04 on the Firefly-RK3399, compiling the RK3399 kernel natively is the same process as cross-compiling the kernel.

There is one issue, the custom tools have only been compiled for x86. However, the source is included in with the SoC Vendor Kernel, so it just needs to be copied and recompiled.

The error is:

/bin/sh: 1: ./scripts/mkkrnlimg: Exec format error
arch/arm64/Makefile:167: recipe for target 'kernel.img' failed
make: *** [kernel.img] Error 2

Assuming ../../rockchip-linux/ is a clone of Update the tools for arm64.

cd firefly-kernel/scripts
rm mkkrnlimg
cp ../../rockchip-linux/scripts/mkkrnlimg.c
make mkkrnlimg
rm resource_tool
cp ../../rockchip-linux/scripts/resource_tool.c .
make resource_tool

Paths will change for the installation

make firmware
sudo make modules_install firmware_install INSTALL_FW_PATH=/lib/firmware/

The SD card image device is /dev/mmcblk0

sudo dd if=resource.img seek=32768 of=/dev/mmcblk0
sudo dd if=kernel.img seek=65536 of=/dev/mmcblk0
sudo reboot

Updated kernel version:

Linux Firefly-RK3399 4.4.126 #4 SMP Fri Jan 25 22:37:01 ACDT 2019 aarch64 aarch64 aarch64 GNU/Linux