3. Building RK3326 Linux Kernel 5.10 on macOS Using Docker - dmikey/retros GitHub Wiki

This guide helps you build a Linux 5.10 kernel and device tree blob (DTB) for RK3326 devices like R36S or Odroid Go Advance — using Docker to avoid macOS compatibility issues.


✅ Prerequisites

Install Docker if you haven’t already:

brew install --cask docker
open -a Docker

🔁 Clone the Kernel Source

git clone --depth=1 --branch develop-5.10 https://github.com/rockchip-linux/kernel.git linux-rk3326
cd linux-rk3326

🐳 Dockerfile to Build RK3326 Kernel

Save this as Dockerfile.rk3326:

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y \
  build-essential \
  git \
  curl \
  bc \
  nano \
  flex \
  bison \
  libssl-dev \
  libncurses-dev \
  wget \
  ca-certificates \
  crossbuild-essential-arm64 \
  device-tree-compiler \
  && apt-get clean

WORKDIR /src

🚀 Build and Launch Container (with DTS Access)

Make sure your DTS file (e.g. r36s-clone.dts) is in the same directory as your kernel source.

Then build and run:

docker build -f Dockerfile.rk3326 -t rk3326-kernel .
docker run -it --rm \
  -v $(pwd):/src \
  -w /src \
  rk3326-kernel bash

🧼 Clean Broken Host Artifacts (inside Docker)

rm -rf Documentation/Kbuild  # in case it's a dir
make mrproper

🧩 Add RK3326 Kernel Config

Create a minimal defconfig:

cat > arch/arm64/configs/rk3326_linux_defconfig <<EOF
CONFIG_SYSVIPC=y
CONFIG_NO_HZ_IDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_PREEMPT=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_RK3326=y
CONFIG_ROCKCHIP_IODOMAIN=y
CONFIG_PINCTRL_RK805=y
CONFIG_REGULATOR_RK8XX=y
CONFIG_ROCKCHIP_THERMAL=y
CONFIG_MFD_RK8XX=y
CONFIG_I2C_RK3X=y
CONFIG_VIDEO_ROCKCHIP_ISP1=y
CONFIG_ROCKCHIP_VOP=y
CONFIG_ROCKCHIP_ANALOGIX_DP=y
EOF

⚙️ Set Env and Configure Kernel

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-

make rk3326_linux_defconfig
make menuconfig   # Optional: enable Rockchip platform support

➕ Add Your Custom RK3326 DTS

  1. Copy your DTS file to the kernel's Rockchip directory (inside container):
cp /src/r36s-clone.dts arch/arm64/boot/dts/rockchip/
  1. Edit the DTS Makefile:
nano arch/arm64/boot/dts/rockchip/Makefile

Add the line:

dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3326-r36s-clone.dtb

🛠️ Build Kernel + DTBs

make -j$(nproc) Image dtbs

📦 Output

You’ll find your results in:

arch/arm64/boot/Image
arch/arm64/boot/dts/rockchip/rk3326-r36s-clone.dtb

💾 Deploy to SD Card

Mount your EmuELEC SD card and copy:

cp arch/arm64/boot/Image /Volumes/EMUELEC/kernel.img
cp arch/arm64/boot/dts/rockchip/rk3326-r36s-clone.dtb /Volumes/EMUELEC/dtb.img

🎉 Done!

You’ve now built a working Linux 5.10 kernel + DTB for RK3326 entirely using Docker from macOS. Enjoy fast iteration without EmuELEC overhead.

Let me know if you'd like a build-rk3326.sh script to wrap this process!