sonic-build
by @rustiqly
Build SONiC (Software for Open Networking in the Cloud) switch images from sonic-buildimage. Use when building VS/ASIC images, configuring build parallelism/...
cd 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.
All knobs in rules/config. Override in rules/config.user (gitignored, persists across rebases).
Key Knobs
| 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 |
Recommended rules/config.user
SONIC_CONFIG_BUILD_JOBS = 4
BUILD_SKIP_TEST = y
SONIC_BUILD_MEMORY = 24g
DEFAULT_BUILD_LOG_TIMESTAMP = simple
clawhub install sonic-build