=Target Board= RK3399 Core board, Build Env = AMD64 Ubuntu 18.04 =Console= Baud rate: 1,500,000 If you don't have any terminal support this speed, try to use picocom:
picocom --baud 1500000 /dev/ttyUSB0
==Default Login==
User Name: linaro
Password: linaro
==Preparation== Install some development packages from repository:
sudo apt-get install libssl-dev liblz4-tool binfmt-support
Install QEMU User Static Version (>=3.1):
sudo apt-get install qemu-user-static
If your system doesn't provide version 3.1 or higher, you can download it manually and install it:
sudo dpkg -i qemu-user-static_3.1*.deb
Other Linaro Building Environment Packages:
sudo dpkg -i debian/ubuntu-build-service/packages/*.deb
Fix dependencies:
sudo apt-get install -f
==Make Clean== If you want to clean up all compiled outputs:
sudo -s
./build.sh cleanall
=Build Image (Debian System)= Extract all files to /root, assume build.sh is in directory /root/rk3399/linux, the directory should look like:
root@rk3399build:~# cd /root/rk3399/linux
root@rk3399build:~/linux# ls
Makefile  app  br.log  build.sh  buildroot  debian  device  distro  docs  external  kernel  mkfirmware.sh  prebuilts  rkbin  rkflash.sh  rockdev  tools  u-boot  yocto
root@rk3399build:~/linux# ./build.sh --help
Usage: build.sh [OPTIONS]
Available options:
BoardConfig*.mk    -switch to specified board config
uboot              -build uboot
kernel             -build kernel
modules            -build kernel modules
rootfs             -build default rootfs, currently build buildroot as default
buildroot          -build buildroot rootfs
ramboot            -build ramboot image
multi-npu_boot     -build boot image for multi-npu board
yocto              -build yocto rootfs
debian             -build debian9 stretch rootfs
distro             -build debian10 buster rootfs
pcba               -build pcba
recovery           -build recovery
all                -build uboot, kernel, rootfs, recovery image
cleanall           -clean uboot, kernel, rootfs, recovery
firmware           -pack all the image we need to boot up system
updateimg          -pack update image
otapackage         -pack ab update otapackage image
save               -save images, patches, commands used to debug
allsave            -build all & firmware & updateimg & save

Default option is 'allsave'.

We need to use uboot, kernel, modules, rootfs, debian, updateimg . ==Build System Image== Switch to root first:
sudo -s
===Build U-Boot===
./build.sh uboot
===Build Kernel=== Latest kernel: https://github.com/ShanghaiNovotech/RK3399-kernel (rk3399_xdma branch)
./build.sh kernel
./build.sh modules
===Build Debian rootfs=== Latest debian: https://github.com/ShanghaiNovotech/RK3399-debian-rootfs
./build.sh debian
===Build Firmware Update Image===
./build.sh updateimg
==FLASK RK3399 update.img==
sudo tools/linux/Linux_Upgrade_Tool/Linux_Upgrade_Tool_v1.38/upgrade_tool uf rockdev/update.img
==Extra Peripherals== ===PCIe XDMA=== Test if PCIe Device exists:
lspci -vvv | grep -i xilinx
Load Kernel Module:
sudo insmod xdma.ko poll_mode=1
Some Xilinx Notes on XDMA with ARM: https://forums.xilinx.com/t5/PCIe-and-CPM/PCI-express-DMA-driver-for-ARM-Linux/td-p/889190 ===Flash TUSB9261 Firmware=== (WIP, No success yet.) Extract TUSB9261 Firmware & Burner package.
sudo insmod eBurner.ko
sudo ./burn.sh
===SPI=== Drivers should be built with kernel, and to Test SPI, use this following test program.
$ git clone https://github.com/rm-hull/spidev-test
$ cd spidev-test
$ gcc spidev_test.c -o spidev_test

#devices at 
ls /dev/spi*
===GPIO=== ====GPIO Map====
Number = BANK * 32 + Index
Index is ranged from A0 to D7, converted to integer value 0 ~ 31. A0~A7 = 0~7, B0~B7 = 8~15, C0~C7 = 16~23, D0~D7 = 24~31 Example:
GPIO 1 RK_PB7, GPIO Number = 1 * 32 + 15 = 47
GPIO Numbers are used in user level GPIO control. ====View kernel GPIO state====
cat /sys/kernel/debug/gpio
====Setup GPIO configuration on user level==== Use GPIO 1 RK_PB7 (GPIO Number 47) as example. Export GPIO:
echo 47 > /sys/class/gpio/export
Set GPIO direction to output:
echo out > /sys/class/gpio/gpio47/direction
Set GPIO direction to input:
echo in > /sys/class/gpio/gpio47/direction
Write state to GPIO (Direction should be output):
echo 1 > /sys/class/gpio/gpio47/value #Set to high
echo 0 > /sys/class/gpio/gpio47/value #Set to low
Read state from GPIO (Direction should be input):
cat /sys/class/gpio/gpio47/value
===Graphic=== RK3399 uses MaliT860MP4 GPU. Need some private packages to use. (Already installed in released image.) We use X11 as default graphic environment, for easier usage and development. But if you want to full EGL support and performance, you should use EGLFS in Qt5, or wayland. To use those environments, you may need to use buildroot to create your own rootfs instead of standard Linux distributions.