Appearance
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.
| Build | Rosetta emulation | Native arm64 | Recorded scope |
|---|---|---|---|
| S100P kernel | 63.5 min | 9.1 min | Cold build, about 7× |
| RV1126B kernel | 1217 s | 293 s | Cold build, -j14, about 4.1× |
| S100P MCU | 22 s | 16 s | Cold build |
| S100P MCU | 8 s | 3 s | Incremental 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:
| Platform | Native kernel build entry |
|---|---|
| RV1126B | RV1126B_BUILD_PLATFORM=linux/arm64 scripts/docker/build.sh kernel |
| S100P | S100_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.
| Finding | Final change |
|---|---|
| Online packaging deleted newer local debs and substituted older remote ones | Download only missing packages and retain the newest Debian Version |
Old hobot-configs did not create /etc/ld.so.conf.d/hobot.conf; adbd exited 127 | Write the library-path configuration after installation and run ldconfig |
| sudoers ownership on virtiofs broke sudo in postinst | Stop 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.
| Layer | RV1126B | S100P |
|---|---|---|
| Mac source directory | Case-sensitive volume | Case-sensitive volume |
| Container workspace | Docker named volume (btrfs in the record) | Direct bind mount, exposed as virtiofs |
| Reason | check-sdk allows selected filesystems and rejects virtiofs | No 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?
| Platform | Completed build scope | Other recorded times / artifacts |
|---|---|---|
| S100P | MCU, kernel, deb-all, full image and fastboot flashing | 18 debs: 7.6 min; image: 4.6 min; emmc_disk.simg 8.85GB |
| RV1126B | kernel, buildroot, recovery, update.img and the AMP board RT-Thread RISC-V MCU | buildroot 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
| Problem | Recorded fix |
|---|---|
| deb-all lacks a rootfs sysroot | Run image-prepare first to download the 2.5GB samplefs |
virtiofs rejects tar --same-owner; container root maps to uid 501 | Detect virtiofs and skip owner correction |
e2fsprogs 1.46 mkfs.ext4 -d reports ENOENT on symlinks | Use 1.47 with -E no_copy_xattrs |
Default orphan_file in 1.47 prevents first-boot resizing with board-side 1.46 | Add -O ^orphan_file to mke2fs |
RV1126B — successful compilation can hide address mismatches
| Problem | Recorded fix |
|---|---|
RT_HW_CACHE_FLUSH undeclared | Include <rthw.h> in sensor_acq.c |
| Undefined rpmsg / timesync symbols | Change ITS rtt_config from evb1 to rv1126b_mcu_dev |
| RISC-V toolchain still selects x86 | Select linux-arm64 / linux-x86 by host in rtconfig.py |
| Firmware at 245KB exceeds 232KB reserve, causing location counter backwards | Expand hpmcu to 256KB and move shared memory by 0x6000 |
| Linux does not yield uart2 to MCU | Switch DTS from amp-mcu to mcu-dev |
| Go 1.4 bootstrap lacks aarch64 support | Use prebuilt Go 1.19 for stage1 |
rkaiq j2s carries redundant x86 flags such as -m64 | Remove flags inappropriate for the host architecture |
rsync exclusion rockdev/ also matches a tool subdirectory | Anchor 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
| Platform | Download mode and tools |
|---|---|
| RV1126B | adb reboot loader, with a recorded 5–18s wait for enumeration (VID 0x2207); use upgrade_tool / rkdeveloptool, and grant execute permission to extracted Mac tools |
| S100P | Send 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 failure | What to inspect |
|---|---|
Proxy connection to 127.0.0.1 refused | It addresses the container; use host.docker.internal for the host proxy |
| No username for uid 501 | Create a matching user through Dockerfile ARGs |
| Docker metadata fetch times out | Check proxy access to auth.docker.io; not all downloads use the same route |
| Old error persists after a source edit | Buildroot .stamp_extracted prevents re-extraction; remove the relevant package build directory and rebuild |