- Documentation: https://www.kendryte.com/zh/sdkResource/230linux
- CI Images: https://download.kendryte.com/k230/release/linux_sdk_images/daily_build/
This document uses the
k230d_canmv_defconfigconfiguration as an example. If you use a different configuration, replacek230d_canmv_defconfigwith the appropriate name. All supported configurations can be found in thebuildroot-overlay/configs/directory.
git clone --depth=1 https://github.com/kendryte/k230_linux_sdk.git # Clone the source code
cd k230_linux_sdk # Enter the source directory
sudo make toolchain_and_depend
# Installs the GCC toolchain and SDK dependencies. See tools/install_toolchain_and_depend.sh for details.
This SDK has been verified on Ubuntu 22.04 and 24.04. Other versions may encounter build issues.
Only
k230d_canmv_ilp32_defconfigrequires the rv64ilp32 toolchain to be installed manually:# Only needed for k230d_canmv_ilp32_defconfig wget -c https://github.com/ruyisdk/riscv-gnu-toolchain-rv64ilp32/releases/download/2024.06.25/riscv64ilp32-elf-ubuntu-22.04-gcc-nightly-2024.06.25-nightly.tar.gz mkdir -p /opt/toolchain/riscv64ilp32-elf-ubuntu-22.04-gcc-nightly-2024.06.25/ tar -xvf riscv64ilp32-elf-ubuntu-22.04-gcc-nightly-2024.06.25-nightly.tar.gz \ -C /opt/toolchain/riscv64ilp32-elf-ubuntu-22.04-gcc-nightly-2024.06.25/
The build consists of three steps, executed in order:
make <defconfig>: Select the build configuration. Only needs to be run once; configuration files are in thebuildroot-overlay/configs/directorymake source: Download the open-source software archives required by the configuration (optional, can be skipped if the source packages have already been prepared manually)make: Perform the build
Example commands:
make k230d_canmv_defconfig && make source && make # Build k230d CanMV image (64-bit kernel and rootfs)
# make k230_canmv_defconfig && make source && make # Build k230 CanMV image
# make k230d_canmv_ilp32_defconfig && make source && make # Build k230d CanMV image (32-bit rootfs)
# make help # Show helpThe initial build takes considerable time. To skip compilation and try the Linux system directly, download the daily build image from Canaan.
output/k230d_canmv_defconfig/images/sysimage-sdcard.img.gz
k230d_canmv_defconfigis an example — replace it with your actual configuration name. Uncompress the image, burn it to a TF card, insert the card into the device, and power on.
make uboot-rebuild # Rebuild U-Boot
make uboot-dirclean # Clean U-Boot build artifactsDirectory layout:
| Directory | Description |
|---|---|
buildroot-overlay/boot/uboot/u-boot-2022.10-overlay/ |
U-Boot overlay source |
output/k230d_canmv_defconfig/build/uboot-2022.10/ |
U-Boot full source and build directory |
make linux-menuconfig # Modify kernel configuration
make linux-savedefconfig # Save kernel configuration to defconfig
make linux-rebuild # Rebuild kernel
make linux-dirclean # Clean kernel build artifactsmake menuconfig # Modify SDK configuration
make savedefconfig # Save SDK configurationsudo make debian # Generate Debian distribution image
sudo make ubuntu # Generate Ubuntu distribution imageThe initial build takes considerable time. To skip compilation, download the daily build image from Canaan.
For more information about Debian/Ubuntu, see K230 Debian/Ubuntu System Guide.
-
Source directory:
buildroot-overlay/package/ai_demo/ls buildroot-overlay/package/ai_demo/ # List all AI demos ls buildroot-overlay/package/ai_demo/face_detection/ # View face_detection source
-
Build a single demo (using
face_detectionas an example):make face_detection-dirclean # Clean build artifacts make face_detection # Build
-
Enable additional demos: By default, only
face_detectionis enabled. To enable others, use the menu:make menuconfig # Target packages → Canaan package → AI → # [*] face detection # [ ] demo mix # [ ] bytetrack # ... # [ ] face_mesh # [ ] face_parse # [ ] face_pose # [ ] face_verification
-
Run a demo: Navigate to the corresponding directory under
/root/app/on the device:cd /root/app/face_detection/ ls # face_detect_image.sh face_detection_320.kmodel # face_detect_isp.sh face_detection_640.kmodel # face_detection.elf ./face_detect_isp.sh
-
For more information, see the K230 AI Demo Guide.
For frequently asked questions, see K230 FAQ.