sonic-buildBuild SONiC (Software for Open Networking in the Cloud) switch images from sonic-buildimage. Use when building VS/ASIC images, configuring build parallelism/...
Install via ClawdBot CLI:
clawdbot install rustiqly/sonic-buildcd sonic-buildimage
make init
make configure PLATFORM=vs # or broadcom, mellanox, etc.
make SONIC_BUILD_JOBS=4 target/sonic-vs.img.gz
For dev builds (skip tests): add BUILD_SKIP_TEST=y.
Two-phase build via GNU Make → slave.mk → sonic-slave Docker container:
target/debs/bookworm/target/debs/trixie/Makefile invokes Makefile.work with different BLDENV per phase. The configure target creates per-distro directories.
All knobs in rules/config. Override in rules/config.user (gitignored, persists across rebases).
| Knob | Default | Recommended | Effect |
|------|---------|-------------|--------|
| SONIC_CONFIG_BUILD_JOBS | 1 | 4 | Parallel top-level package builds |
| SONIC_CONFIG_MAKE_JOBS | $(nproc) | default | Compiler threads per package |
| BUILD_SKIP_TEST | n | y (dev) | Skip unit tests |
| SONIC_BUILD_MEMORY | unset | 24g | Docker --memory — contains OOM in container |
| SONIC_DPKG_CACHE_METHOD | none | rwcache | Cache .deb packages for incremental builds |
| DEFAULT_BUILD_LOG_TIMESTAMP | none | simple | Timestamps in build logs |
| SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD | unset | y | Host Docker daemon instead of DinD |
rules/config.userSONIC_CONFIG_BUILD_JOBS = 4
BUILD_SKIP_TEST = y
SONIC_BUILD_MEMORY = 24g
DEFAULT_BUILD_LOG_TIMESTAMP = simple
Rule of thumb: JOBS × 6GB ≤ available RAM.
Why JOBS=1 is slow: 64/194 packages depend on libswsscommon (critical path bottleneck). JOBS=1 leaves most cores idle.
Without limits, parallel builds can trigger the kernel OOM killer on any host process.
# Container-scoped OOM (host stays healthy):
SONIC_BUILD_MEMORY = 24g
# Or via CLI:
make SONIC_BUILDER_EXTRA_CMDLINE="--memory=24g" ...
SONIC_DPKG_CACHE_METHOD = rwcache
SONIC_DPKG_CACHE_SOURCE = /var/cache/sonic/artifacts
SONIC_VERSION_CACHE_METHOD = cache
make target/debs/bookworm/sonic-utilities_1.2-1_all.deb
make target/docker-syncd-vs.gz
ls target/debs/bookworm/ | grep <name>
When to clean: after branch switch, rebase, or unexplained failures.
rm -rf target/* # always full clean, not selective
make configure PLATFORM=vs
make SONIC_BUILD_JOBS=4 target/sonic-vs.img.gz
Stale artifacts (.bin, squashfs) confuse make into skipping phases.
make init # after clone or pull
git submodule update --init --force src/<module> # fix corrupted submodule
SSH clone is more reliable than HTTPS (HTTPS can give HTTP 500).
For detailed troubleshooting, see references/troubleshooting.md.
See references/prerequisites.md for host setup (Docker, Python, jinjanator).
See references/vs-platform.md for VS-specific details (TAP devices, port mapping, sai.profile, oper speed).
git commit -s for DCO sign-offBUILD_SKIP_TEST=n at least onceGenerated Mar 1, 2026
Manufacturers building custom SONiC switch images for hardware platforms like Broadcom or Mellanox ASICs. This skill enables rapid iteration on firmware for new switch models, optimizing build parallelism and caching to reduce development cycle times from hours to minutes.
Cloud providers using virtual switch (VS) images to simulate network topologies in CI/CD pipelines. The skill allows creating lightweight, reproducible test environments for validating network configurations and software updates before deploying to production hardware.
Large enterprises automating the build of tailored SONiC images for in-house data center switches. This supports custom feature sets, security hardening, and integration with existing management tools, leveraging submodule management and clean build processes for reliable deployments.
Researchers prototyping new networking protocols or algorithms on SONiC-based testbeds. The skill facilitates building images with experimental code modifications, using memory protection and debugging features to isolate failures and accelerate experimentation cycles.
Telecom operators upgrading existing SONiC switch fleets with optimized images for performance or new features. This involves rebuilding specific packages like sonic-utilities, managing dependencies, and ensuring compatibility across diverse hardware platforms in live networks.
Offering pre-built, certified SONiC images as part of subscription-based switch hardware leases. Revenue comes from monthly fees that include image updates, support, and customization services, leveraging the skill's build optimization to reduce operational costs.
Providing expertise to clients for customizing and deploying SONiC in their environments. Revenue is generated through project-based contracts or hourly rates, using the skill's troubleshooting and configuration features to solve specific build or performance issues.
Operating a cloud platform where users can build and test SONiC images on-demand via web interface or API. Revenue streams include pay-per-use build credits or tiered subscriptions, capitalizing on the skill's parallelism and caching to offer fast, scalable service.
💬 Integration Tip
Integrate this skill into CI/CD pipelines by automating make commands with environment variables for parallelism and memory limits, ensuring consistent builds across development and production stages.
Automatically update Clawdbot and all installed skills once daily. Runs via cron, checks for updates, applies them, and messages the user with a summary of what changed.
Full desktop computer use for headless Linux servers. Xvfb + XFCE virtual desktop with xdotool automation. 17 actions (click, type, scroll, screenshot, drag,...
Essential Docker commands and workflows for container management, image operations, and debugging.
Tool discovery and shell one-liner reference for sysadmin, DevOps, and security tasks. AUTO-CONSULT this skill when the user is: troubleshooting network issues, debugging processes, analyzing logs, working with SSL/TLS, managing DNS, testing HTTP endpoints, auditing security, working with containers, writing shell scripts, or asks 'what tool should I use for X'. Source: github.com/trimstray/the-book-of-secret-knowledge
Deploy applications and manage projects with complete CLI reference. Commands for deployments, projects, domains, environment variables, and live documentation access.
Monitor topics of interest and proactively alert when important developments occur. Use when user wants automated monitoring of specific subjects (e.g., product releases, price changes, news topics, technology updates). Supports scheduled web searches, AI-powered importance scoring, smart alerts vs weekly digests, and memory-aware contextual summaries.