User:Brendlefly62/Rockchip RK3399 Asus Tinker Board 2 S

From Gentoo Wiki
Jump to:navigation Jump to:search

Construction of this page began 8 May 2024 (work in progress)

This is a relatively inexpensive ($119 on Amazon as of 5/8/2024 Amazon link) armv8 SBC based on the Rockchip rk3399 SoC, made by a very popular motherboard manufacturer (Asus). See details below. This system runs Gentoo Linux, with further objectives, as described below.

Asus Tinkerboard 2 s, shown here in the bottom half of an old original Raspberry Pi case, for non-conductive protection. The large heatsink was shipped with the board and would be too big to fit in most rpi-type cases. This board has an I/O layout similar to RPi 2/3 and might otherwise fit those old cases, maybe with some modification to fit the barrel-connector of the 12V power supply. The PSU visible on the left is re-used from an old CPAP machine and was modified to include a switch on its DC supply side. Also visible here is an SPDT switch wired to the Tinkerboard 2 S's "maskrom" jumper - allowing easier selection of either eMMC or SD Card as primary boot device, an LED used to automate a status indicator useful in headless operation, a USB connector for wireless keyboard/mouse, an ethernet cable connection, and an FTDI serial-to-USB converter wired to the Tinkerboard 2 S's debug uart header (stty2) and connected to a PC for serial console monitoring via putty.
Tinkerboard 2 s, shown here at a later stage in ongoing project. Note 128G NVMe (encrypted rootfs luks/lvms, hub apparently required, as this did not work connected directly to USB3 port. Key for encrypted rootfs is on tinyUSB center. Wifi module in slot not compatible with NVMe. Debug UART connection to PC is still connected, but u-boot handoff to kernel and custom initramfs is now seamless. Note 3 x status leds back/right, supported by cron job checking VPN, services, and CPU temp status. Original heatsink shipped with product. Fan was added after observing CPU running at 70.9 degrees C during big compile job. SPDT switch still enables dual-boot Android on eMMC or Gentoo on microSD+NVME.

Overall status

This will eventually be a complete built-from-scratch system. Currently, the board has a Gentoo rootfs system, a custom amd64-cross-compiled kernel built using kernel.org upstream sources. The board is currently using the bootloader installed on the boot device with a custom-built Armbian image. The author's intent is to create a custom amd64-cross-compiled u-boot bootloader to replace the last remaining component "built by others."

Hardware

Make/model Notes
Board
Asus Tinkerboard 2 S Manual

dtb: rk3399-tinker-2-s.dtb

SoC
Rockchip RK3399-T quickstart guide

soc datasheet

RAM
2GB Dual-CH LPDDR4 2GB
Firmware
** Currently as provided by custom-built Armbian Image To do: Custom-cross compile u-boot by on gentoo amd64 desktop PC
Boot media
eMMC*, SD Card
  • model 2 s has eMMC
System will boot from either eMMC or SD Card, depending on position of "maskrom" jumper header. Note that author has replace the jumper with a SPDT switch, to facilitate easy selection of boot device. PXE not tested but should be available once custom u-boot is developed (supported by u-boot standard). USB boot option also exists in u-boot documentation, but it was not tested (and there may be issues with that).[1][2]

SoC

Rockchip RK3288

  • kernel: Author's custom amd64-cross-compiled 6.5.4 (Linux tinker04 6.5.4 #1 SMP Tue Sep 19 15:28:12 EDT 2023 armv7l ARMv7 Processor rev 1 (v7l) Rockchip (Device Tree) GNU/Linux)
Device Make/model* Status kernel drivers Notes
CPU Dual-core Arm® Cortex®-A72 @ 2.0 GHz

Quad-core Arm® Cortex®-A53 @ 1.5 GHz

Works The CPU will operate at full capacity, but requires heat

dissipation and AC adapter stability

GPU Arm® Mali™-T860 MP4 GPU @ 800 MHz

1 x HDMI* supports up to 4K

1 x 15-pin MIPI DSI supports up to HD

Works midgard HDMI supports a maximum resolution of up to 4K, and the iGPU

only supports H.264/H.265 4K hardware decoders

Memory Dual-CH LPDDR4 2GB (4G also available) Works
Storage 16/32GB eMMC

Micro SD(TF) card slot (push/pull)

Works
Audio 1 x HDMI™ audio output

1 x S/PDIF TX pin (from GPIO) 1 x PCM/I2S pins (from GPIO)

Not tested
Camera 1 x 15-pin MIPI CSI-2 (2 lane) Works Works - but tested with distributed Android OS only
Wireless * AW-CB375NF 802.11 b/g/n wireless

BT 4.0 + EDR

Not tested rtl8723ds Works - but as yet tested w Android OS only
  • board ships with this wifi module populating pcie slot
USB 3 x USB 3.2 Gen1 Type-A ports

1 x USB 3.2 Gen1 Type-C® OTG port

Works usbhid,

usb-storage, dwc2_hsotg

Ethernet 1 x RTL8211E/F GbE LAN Works st_gmac
IO 1 x 40-pin header includes: up to 28 x GPIO pins; up to 2 x SPI bus; up to 2 x I2C bus; up to 2 x UART; up to 3 x PWM; up to 1 x PCM/I2S; up to 1 x S/PDIF TX; 2 x 5V power pins; 2 x 3.3V power pins; 8 x ground pins


1 x 4-pin Recovery/MaskROM/PowerOn header for Power On and eMMC Recovery (author employs with spdt boot dev select switch)
1 x 2-pin Reset header between ethernet and usb ports
1 x 2-pin Debug UART header between usb ports
1 x 2-pin Fan header between recovery header and hdmi port

Works
Others RTC Not tested
Power 1 x 12~19V (up to 45W) DC Power Input Jack (5.5/2.5 mm) Works Recommneded to use with 5V/3A PSU

Accessories

  • Standard (shipped in kit): heat sink
  • Added by author - case, and power supply, fan optional.
  • (optional) Keyboard, mouse, HDMI cable, and FTDIboard-with-miniUSB cable

Peripherals

Component Make/model Status Kernel driver(s) Notes
PMIC Rockchip RK808 Works rk808 Power Management Integrated Circuit (Regulators, Clocking)[3][4]
Ethernet PHY RTL8211E Works realtek_phy via RGMII
Analog Audio Not Present

Board Layout

Tinker2s layout reduced.png

Mask ROM, eMMC Recovery jumpers

The TinkerBoard and TinkerBoard 2 S come with a four-pin header for setting jumper(s) to enable recovery of the contents of the eMMC. When set to "Mask ROM" and connected via USB to a PC, the board's boot process will bypass the bootloader on the eMMC and the board will appear as a USB-attached flash storage device. This enables the user to easily (re)flash write an OS image to the eMMC.

Jumper configurations

board  "default disable"        "eMMC Recovery"
edge       aka "Park"           aka "Mask ROM"  
  |     jumper position         jumper position
  |                                                                                         
  |         +      +                +      +
  |                                        |
  |                                        |
  |         +------+                +      +  

Alternatively, with the jumper in this position while a bootable SD card is inserted in the SD card reader, then the board will boot from the SD card. Thus, the author has replaced the normal jumper with a SPDT switch, to enable easy selection of one of two bootable storage devices.

Boot device select switch

               "eMMC
board         Recovery"
edge       (boot SD card)
  |              |
  |              |
  |       +      +
  |            \
  |             \
  |       +      + ---- COM
  |       |
  |       |
  |    default
  |    disable
  |  (boot eMMC)

There is also a "Power ON" jumper setting that documentation indicates can be used when the DC power supply is not switchable, to power down the board. The author has not tested this.

board      "Power On"   
edge       (untested)   
  |     jumper position
  |
  |         +      +
  |         |
  |         |              
  |         +      + 

Serial Console Setup

To use for troubleshooting and viewing bootloader console output, connect Debug UART RX/TX to a serial/USB converter as described in the TinkerBoard Developer Guide.

Tip
The TinkerBoard 2 defconfig sets up the bootloader to use UART2 (stty2) on Debug UART header pins. Also note Armbian u-boot default baud rate is 15000000

GCC optimization[5]

FILE /etc/portage/make.confRK3399 example
COMMON_FLAGS="-mcpu=cortex-a72.cortex-a53+crc+crypto -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
Note
For a hardened system consider appending -fstack-protector-all

Gentoo Installation Options and Procedures

Getting to Know the Board

The purpose of this guide is to document "from scratch" procedures for installing a pure gentoo system on this SBC. However the quicker way to get Gentoo up and running is to install another distribution, and replace the root file system contents. Start by consulting User:Brendlefly62/Rockchip_RK3399_Asus_Tinker_Board_2_S/Getting to Know the Board

Bootloader Build and Installation

To build a U-Boot bootloader from sources, see Build-Install-U-Boot

Assemble a Working Gentoo System

To assemble a working Gentoo system with minimal effort, using resources developed above, consult Assemble a Gentoo System

Kernel Build and Installation

To build a gentoo linux kernel (including modules, device tree blobs, etc) from sources, see build_install_kernel

Install a Gentoo System "From Scratch"

By Hand

To "manually" build a linux system from scratch, see linkname_tbd

With some automation...

To build a gentoo linux system with tools that automate many of the steps entailed in procedures described above, see linkname_tbd

Binary Kernel/Firmware packages

To use pre-built binary packages for linux kernel, molules, dtbs, and bootloader, see linkname_tbd/Pre-built-binary-packages

Bootable gentoo system images

To use pre-built bootable system images files, see linkname_tbd/Bootable-System-Images

Issue 1

When X happens, Y is how you fix it.

See also

(Optional section.)

External resources

References (Footnotes in the text above)