English | 中文
smart-build combines board defaults with the repository-root build/.config written
by menuconfig. When no workspace machine is selected,
qemu-virt-aarch64 is used.
The machine can be selected in three ways, from highest to lowest priority:
- The subcommand's
--machineoption, where available. - The global
smart-build --machine <name>option. MACHINEin the workspacebuild/.config.- The built-in default
qemu-virt-aarch64.
Configuration is located from the project root even when invoked from a subdirectory. Each build invocation uses one merged configuration snapshot; configuration edits take effect in the next invocation.
Workspaces created with the former K230 machine name
k230d-canmv-atk-dnk230d are accepted as a legacy alias and resolved to
k230. Their build output uses build/k230/; rerun menuconfig to rewrite
the workspace configuration with the canonical name.
Example:
./smart-build build kernel --machine qemu-virt-riscv64In ./smart-build menuconfig, open the Cross toolchain menu under the selected
machine to choose a version and edit the optional custom toolchain root. Saving
configuration only records the selection; Kconfig does not perform network
downloads. If the selected toolchain is missing, an interactive build asks
before downloading it into downloads/toolchains/, or you can run
toolchain install explicitly.
TOOLCHAIN and TOOLCHAIN_VERSION select one of the compatible entries declared
by the board. TOOLCHAIN_PATH can point to a custom toolchain root; it is still
validated for the target triple, compiler prefix, sysroot, and runtime files.
The current QEMU AArch64 and RISC-V boards provide GCC 12.2.0 downloads. The
Arm vexpress board keeps its Env SDK GCC 7.3.0 default and also provides a
downloadable GCC 12.2.0 entry.
The physical k230 board uses the Env SDK GCC 12.2.0
toolchain with the riscv64-linux-musleabi- prefix. Its kernel BSP supplies
the rv64imafdc/lp64 flags. Its board defconfig selects the basic BusyBox
rootfs, so the default build adds no application packages. When a dynamic or
mixed rootfs is selected, userspace files use the same soft-float ABI and the
rootfs stage installs the musl loader, libc.so, libgcc_s.so.1, optional
libatomic.so.1, libstdc++.so.6, and every declared package .so/.so.*
file. TOOLCHAIN_PATH can override the Env SDK package root.
Use ./smart-build toolchain list to inspect the selection and installation
source. Missing downloadable versions can be installed with
./smart-build toolchain install --yes.
The Kconfig interface currently offers:
| Value | Purpose | Default package set |
|---|---|---|
minimal |
Small application rootfs | hello |
basic |
BusyBox rootfs | BusyBox and hello |
full |
Profile or manually selected packages | base, devel, or full profile |
none |
Disable the Smart rootfs | None |
Build modes are static, dynamic, and mixed where the selected rootfs type
supports them. The basic BusyBox rootfs uses static mode.
ROOTFS_IMAGE_SIZE_MB accepts 1, 4, 8, 16, 32, 64, 128, 256, 512, or 1024 MB.
For ext4, size mode can be fixed or expandable.
Only ext4 image creation is currently implemented. Do not select FAT or romfs for a real build even though they are visible in menuconfig.
The K230 board defconfig selects ROOTFS=basic, so build all builds the
common kernel and a static BusyBox-only rootfs (busybox-rootfs.img) without
additional application packages. It then verifies the board-owned firmware
components under boards/k230/firmware/ and packages them
with the in-tree K230 image backend into images/k230-sdcard.img. Component
paths, SHA-256 values, compression, and the K230 payload offset are board
metadata. No K230 SDK checkout, vendor script, or K230-specific menuconfig path
is required.
The configured root filesystem is placed in an ext4 partition at 16 MiB. The K230D
kernel defconfig enables lwext4 and the BSP ext4 rootfs mode, then mounts
sd0p0 at / during startup. RT-Thread names the first parsed MBR partition
with partition index 0. It also enables procfs and AF_UNIX local sockets for
RT-Thread Smart POSIX IPC. The kernel mounts /proc during filesystem
initialization, so BusyBox mount can report the mount table. The BusyBox rcS
script mounts /dev/shm after the root filesystem is available.
The K230D time CSR runs at 25 MHz and its OS tick is 1 kHz. MSH remains enabled,
so its normal interactive tshell startup may print msh />; this is the
RT-Thread kernel shell prompt, not a rootfs mount or network error. The LWP init
debug countdown is disabled. BusyBox ash is also started by the rootfs init
script.
When RT-Thread Smart, lwIP, and netdev are enabled, RT_LWIP_USING_LOOPBACK
defaults to enabled and registers the common IPv4 lo interface at
127.0.0.1. Disable this kernel option when the loopback netdev is not needed;
it does not provide external Ethernet connectivity.
Packages for the full rootfs are selected under its Packages menu. Package dependencies selected by metadata are added automatically. See Using packages.
Package option values are resolved and recorded in the build manifest, but not all existing build backends consume those values yet. Check the package's implementation before relying on an option to alter generated binaries.
The configure command opens configuration for domains that provide a
configuration mapping and for independent RT-Thread SCons packages that use
native Kconfig:
./smart-build configure kernel
./smart-build configure busybox
./smart-build configure bootloader
./smart-build configure package:<name>Not every board or package supplies every configure target. Unsupported targets
fail with a CONFIG error. For a native Kconfig package, the command enables
the package selection symbol, opens its RT-Thread package configuration, and
saves that package's configuration subtree to the selected board defconfig and
workspace configuration. It does not run SCons or update Env packages.
RT-Thread kernel packages are selected in the kernel menuconfig rather than the smart-build rootfs Packages menu:
./smart-build configure kernelFor ext4 kernel support, enable lwext4 and choose its version in the RT-Thread
package menu. The three included QEMU boards default to latest, which
currently resolves to the lwext4 v2.2 release. The next kernel build runs Env
pkgs --force-update using the saved selection.
These packages are separate from userspace packages under the repository's
packages/ directory. The BSP packages/pkgs.json is the ownership record for
kernel package directories. smart-build warns and removes any unrecorded direct
child containing SConscript; Env downloads the selected sources.