Skip to content

Native Mac Builds for Rockchip and D-Robotics Platforms ​

For the same SDK, the S100P kernel went from 63.5 minutes to 9.1 minutes, and RV1126B from 1217 seconds to 293 seconds. This did not turn a Linux SDK into a macOS project: the main compilation moved from a Rosetta-emulated x86 container to an arm64 Linux container.

Here, “native” means that the compiler executes as arm64 inside a Linux container, not directly on macOS. The timings below come from those build records and apply only to that environment. The original notes do not contain a complete benchmark configuration, so they cannot predict build times on an arbitrary Mac.

How much time did it save? ​

The chart rounds RV1126B to one decimal minute. Exact seconds and shorter MCU builds are listed below so they are not lost on the kernel chart scale. Emulated means Rosetta; native means an arm64 Linux container.

BuildRosetta emulationNative arm64Recorded scope
S100P kernel63.5 min9.1 minCold build, about 7×
RV1126B kernel1217 s293 sCold build, -j14, about 4.1×
S100P MCU22 s16 sCold build
S100P MCU8 s3 sIncremental build

The gains are uneven: kernels benefit substantially, while the MCU cold build saves only six seconds. Both platforms were flashed and checked on hardware. Beyond a successful build, the image contents and post-boot state still need verification.

Compile on arm64; keep x86 where packaging needs it ​

OrbStack provides Linux. An arm64 container does most compilation, while the original amd64 path remains available for compatibility and colleagues on x86 Linux. Some Rockchip rkbin tools remain x86 ELF binaries, but they are used in packaging; that does not require emulating the whole kernel build.

These commands depend on adaptations already made in the projects. Setting a variable alone will not port an arbitrary vendor SDK. The recorded default remains amd64:

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

The rkbin tools — including mkimage, loaderimage, trust_merger, boot_merger, firmwareMerger and resource_tool — need individual handling. In the recorded setup, OrbStack Rosetta ran statically linked x86 binaries, while dynamic binaries used qemu-user, multiarch and x86 runtime libraries.

Three failures that were easy to misread ​

1. Broken ADB does not necessarily mean a missing USB driver ​

After flashing S100P, the log reported udc: failed to start g_comp: -19. It looked like a UDC bind failure, but the investigation led to image package selection and library paths, not simply a missing driver patch.

FindingFinal change
Online packaging deleted newer local debs and substituted older remote onesDownload only missing packages and retain the newest Debian Version
Old hobot-configs did not create /etc/ld.so.conf.d/hobot.conf; adbd exited 127Write the library-path configuration after installation and run ldconfig
sudoers ownership on virtiofs broke sudo in postinstStop relying on that implicit fix; bake it into the image through fix_rootfs_ld_path()

After a full reflash, ADB recovered automatically on cold boot. This case made me check “artifact generated” separately from “artifact contains the right contents.”

2. The filesystem can damage sources before compilation ​

Default macOS APFS is case-insensitive. Paired Linux netfilter files such as xt_mark.c and xt_MARK.c collide, so put sources on a case-sensitive APFS volume before working on toolchains.

LayerRV1126BS100P
Mac source directoryCase-sensitive volumeCase-sensitive volume
Container workspaceDocker named volume (btrfs in the record)Direct bind mount, exposed as virtiofs
Reasoncheck-sdk allows selected filesystems and rejects virtiofsNo such check, but permissions and ownership still differ

The inspected check-sdk did not check host architecture; it checked FSTYPE and tool availability. Reading a virtiofs rejection as “x86 builds only” sends the investigation in the wrong direction.

3. An arm64 target does not imply an arm64-hosted compiler ​

The SDK hard-coded aarch64-none-linux-gnu-*, but checks of ARM 11.3 / 12.2 / 13.3 download locations and the D-Robotics archive did not find the required aarch64-hosted variant. The solution used Ubuntu GCC inside the container with symlinks carrying the expected prefix, preserving the SDK conventions for CROSS_COMPILE and --host.

RV1126B also needed an “aarch64 host → aarch64 target” branch in get_toolchain. The MCU is different: RISC-V still needs a cross-compiler built for the host, and scons reads rtconfig.py; setting CROSS_COMPILE alone did not select it.

What worked, and what does it not prove? ​

PlatformCompleted build scopeOther recorded times / artifacts
S100PMCU, kernel, deb-all, full image and fastboot flashing18 debs: 7.6 min; image: 4.6 min; emmc_disk.simg 8.85GB
RV1126Bkernel, buildroot, recovery, update.img and the AMP board RT-Thread RISC-V MCUbuildroot about 70 min; recovery about 37 min; update.img 1.4GB

This is not a universal port for every Linux SDK. Closed-source host tools, old bootstrap compilers, rootfs packaging and first boot may retain architecture or filesystem dependencies. Keeping the amd64 path is useful; measure savings for the builds you actually run.

Appendix — packaging, MCU and flashing details

Match S100P image tools to the board ​

ProblemRecorded fix
deb-all lacks a rootfs sysrootRun image-prepare first to download the 2.5GB samplefs
virtiofs rejects tar --same-owner; container root maps to uid 501Detect virtiofs and skip owner correction
e2fsprogs 1.46 mkfs.ext4 -d reports ENOENT on symlinksUse 1.47 with -E no_copy_xattrs
Default orphan_file in 1.47 prevents first-boot resizing with board-side 1.46Add -O ^orphan_file to mke2fs

RV1126B — successful compilation can hide address mismatches ​

ProblemRecorded fix
RT_HW_CACHE_FLUSH undeclaredInclude <rthw.h> in sensor_acq.c
Undefined rpmsg / timesync symbolsChange ITS rtt_config from evb1 to rv1126b_mcu_dev
RISC-V toolchain still selects x86Select linux-arm64 / linux-x86 by host in rtconfig.py
Firmware at 245KB exceeds 232KB reserve, causing location counter backwardsExpand hpmcu to 256KB and move shared memory by 0x6000
Linux does not yield uart2 to MCUSwitch DTS from amp-mcu to mcu-dev
Go 1.4 bootstrap lacks aarch64 supportUse prebuilt Go 1.19 for stage1
rkaiq j2s carries redundant x86 flags such as -m64Remove flags inappropriate for the host architecture
rsync exclusion rockdev/ also matches a tool subdirectoryAnchor it at the root as '/rockdev/'

That AMP version duplicated addresses in link.lds, ITS, DTS and three source locations, so all six needed updating. Do not treat 0x6000 as a generic patch for other firmware. Native GCC 11.4 also triggered -Wmisleading-indentation in rtl8733bu; the recorded workaround used KCFLAGS=-Wno-error against CONFIG_WERROR=y. That is a compatibility workaround, not a fix for the warning.

Keep the platform-specific flashing tools distinct ​

PlatformDownload mode and tools
RV1126Badb reboot loader, with a recorded 5–18s wait for enumeration (VID 0x2207); use upgrade_tool / rkdeveloptool, and grant execute permission to extracted Mac tools
S100PSend one Ctrl+C(0x03) roughly every 100ms on AP serial; at Hobot$, enter fastboot 0; use Horizon fastboot, flash_all.sh -m all

On S100P, Ctrl+C every 10ms floods the U-Boot input buffer instead of stopping boot. Use ANDROID_SERIAL when multiple boards are connected. If the board is elsewhere, follow the transfer-and-flash-remotely approach in Remote Development Environment.

Keep toolchains available for repeatable downloads ​

Important toolchains were archived on the cloud. Fetch scripts select by uname -m, download and verify SHA256 before the build entry uses them. The recorded public download rate of about 24 MB/s is only that transfer, not a guarantee. A buildroot upstream once ran at about 1KB/s, so large archives were downloaded into dl/; download speed and compilation speed are separate issues.

Small container failureWhat to inspect
Proxy connection to 127.0.0.1 refusedIt addresses the container; use host.docker.internal for the host proxy
No username for uid 501Create a matching user through Dockerfile ARGs
Docker metadata fetch times outCheck proxy access to auth.docker.io; not all downloads use the same route
Old error persists after a source editBuildroot .stamp_extracted prevents re-extraction; remove the relevant package build directory and rebuild
Something unclear here, or want to talk about similar work?Message me →