Skip to content

Native Mac Builds for Rockchip and D-Robotics Platforms ​

On an Apple Silicon Mac, full-build both the Rockchip RV1126B and D-Robotics S100P embedded SDKs with native arm64 containers. kernel builds get 4–7× faster, the amd64/x86 path is untouched, and both platforms have been flashed and verified on hardware.

Results ​

MetricNotes
~7×S100P kernel: 63.5 → 9.1 min (under gcc's integer-heavy load, Rosetta's overhead far exceeds estimates)
~4.1×RV1126B kernel: 1217s → 293s (-j14 parallelism dilutes the per-core overhead, so the speedup is lower than S100P's)
Full chainS100P: mcu / kernel / deb-all / full image ✓; RV1126B: kernel / buildroot / recovery / update.img / AMP RISC-V MCU ✓
Non-breakingnative x86 Linux, Mac+Rosetta and native Mac arm64 all coexist, switched with the same command

Overview: How It Runs ​

Switching platforms is one environment variable, and the default is still amd64 (zero impact on colleagues' x86 hosts):

PlatformCommand
RV1126BRV1126B_BUILD_PLATFORM=linux/arm64 scripts/docker/build.sh kernel
S100PS100_BUILD_PLATFORM=linux/arm64 west s100-build kernel

Two Entry Gates ​

Hard-won prerequisite

Without a case-sensitive volume as the foundation, nothing else works — macOS silently merges the kernel's paired netfilter files.

Breakthrough One: The Vendor Ships No aarch64 Host Toolchain ​

The central porting problem: the SDK hard-codes the aarch64-none-linux-gnu-* prefix, but ARM/Linaro never publish that toolchain for aarch64 hosts.

Supporting fixes (all because GCC 11.4 is stricter than the old toolchain):

SymptomRoot causeFix
RV1126B's get_toolchain just exit 1snobody wrote the "aarch64 host building an aarch64 target" branchadd a native branch that returns the shim prefix
the rtl8733bu driver fails to compileCONFIG_WERROR=y plus GCC 11's stricter -Wmisleading-indentationappend KCFLAGS=-Wno-error for native builds

Breakthrough Two: rkbin Is x86-only, but Only for Packaging ​

Testing also cleared up a handover myth: check-sdk does no arch check at all (it only checks the FSTYPE whitelist and that the tools exist), so an arm64 container passes straight through — the only real x86-only piece is rkbin.

S100P Full Chain ​

StagePitfallFix
deb-alldepends on the rootfs sysroot; running it bare just failsrun image-prepare first (downloads a 2.5GB samplefs)
image-preparetar --same-owner is rejected on virtiofs (container root is really uid 501)detect virtiofs and skip the owner fixup
Image buildingmkfs.ext4 -d reports ENOENT on symlinks (1.46 is too old)build e2fsprogs 1.47 + -E no_copy_xattrs
First-boot resize fails1.47 enables orphan_file by default and the board's 1.46 doesn't understand itadd -O ^orphan_file to mke2fs
adb won't startsee the "three-layer diagnosis" belowbake fix_rootfs_ld_path() into the image

The adb Case: -ENODEV Isn't a Missing Driver Patch ​

RV1126B Full Chain ​

Five Pitfalls in a Row on the AMP MCU (Getting the RISC-V Firmware to Build) ​

A pitfall the compiler can't catch

The AMP shared-memory address is hard-coded once in each place — link.lds / the ITS / the DTS / three source files — so changing the layout means syncing six of them, and a mismatch only shows up once it's on the board.

buildroot Pitfalls ​

PitfallFix
the Go 1.4 bootstrap doesn't support aarch64swap in a prebuilt Go 1.19 as stage1
sources.buildroot.net runs at ~1KB/s from Chinadownload the big tarballs by hand into dl/
rkaiq's j2s host tool hard-codes x86 flags (-m64 etc.)just delete it (it's redundant anyway)
rsync --exclude 'rockdev/' also hits the packaging tool directoryanchor it at the top level instead: '/rockdev/'

Flashing: Two Different Mechanisms ​

RV1126B(Rockchip)S100P(D-Robotics)
Toolupgrade_tool / rkdeveloptoolHorizon fastboot (flash_all.sh -m all)
Enter download modeadb reboot loader, wait 5–18s for enumeration (Vid 0x2207)send Ctrl+C repeatedly on the serial port to break the zero-delay autoboot → Hobot$ → fastboot 0
Key detailthe mac builds of the tools need unzip + chmod\x03 must be sent one byte at a time at ~100ms intervals; every 10ms floods the U-Boot input buffer and actually fails

Toolchain Distribution: Host the Important Tools Yourself ​

New machine, new colleague or a dead upstream link — no problem: it's fetched automatically at build time, measured at 24 MB/s over the public internet.

Pitfall Cheat Sheet ​

SymptomRoot causeFix
Paired kernel files go missingAPFS is case-insensitiveuse a case-sensitive volume
check-sdk flags ext4virtiofs isn't in the whitelistbuild inside a Docker volume
apt proxy refused inside the container127.0.0.1 inside the container is the container itselfpoint the proxy at host.docker.internal
"no name for user ID 501"the Mac uid has no matching container usercreate the user dynamically via a Dockerfile ARG
docker build times out fetching metadataauth.docker.io needs the proxyproxy only the metadata; let apt go direct
Edited the source but it still reports the old errorbuildroot's .stamp_extracted gaterm -rf output/*/build/<pkg>-*
adb reports more than one with several boardstwo boards connected at oncepick one with ANDROID_SERIAL=<序列号>
Something unclear here, or want to talk about similar work?Message me →