SDK Image Compilation
Luckfox-Lyra-SDK is primarily developed and tested on the Ubuntu 22.04 LTS system. To minimize potential compilation errors and other issues during the development process, it is recommended that users utilize the same operating system as us to ensure consistency and stability in the development environment.
- Currently, only the Ubuntu 22.04 x86_64 environment is supported. Other platform architectures are not yet compatible.
- Follow the documentation steps strictly to compile the image successfully. If you encounter errors, check your environment settings first.
1. Introduction to Luckfox-Lyra-SDK
SDK (Software Development Kit) is a collection of tools, libraries, sample code, documentation, and related support files to help developers build applications for specific platforms, operating systems, hardware, or other software. The operating system on the development board is typically customized and developed based on the SDK. The SDK provides the basic software required for the development board (kernel, drivers, Bootloader, etc.), which developers can customize to create the final system firmware that runs on the development board.
1.1 SDK Directory Explanation
The SDK project directory includes directories such as buildroot, yocto, app, kernel, u-boot, device, docs, external, and prebuilts. It uses a manifest to manage the repositories and the repo tool to manage each directory or its corresponding git projects.
SDK Directory Structure.
├── build.sh -> device/rockchip/common/scripts/build.sh ---- SDK compilation script
├── app ----------------------------- Contains upper-layer applications (mainly demo apps)
├── buildroot ----------------------- Root filesystem developed based on Buildroot (2024)
├── device ----------------- Contains chip board-level configurations and scripts/files for SDK compilation and firmware packaging
├── docs ---------------------------- Contains general development guidance documents, chip platform-related documents, Linux system development-related documents, and other reference materials
├── external --------------------- Contains third-party related repositories, including display, audio and video, cameras,networking, security, etc.
├── kernel -------------------------- Contains code for Kernel development
├── output -------------------------- Stores information on generated firmware, compilation information, XML files, host environment, etc.
├── prebuilts ----------------------- Contains cross-compilation toolchains
├── rkbin --------------------------- Contains Rockchip-related binaries and tools
├── rockdev ------------------------- Stores compiled output firmware, actually a symlink to output/firmware
├── tools --------------------------- Contains commonly used tools for Linux and Windows operating systems
├── u-boot -------------------------- Contains U-Boot code developed based on version v2017.09
└── yocto --------------------------- Contains root filesystem developed based on Yocto 5.0Image Storage Directory.
rockdev/
├── MiniLoaderAll.bin --------------- SPL bootloader, responsible for initializing the basic hardware and loading subsequent firmware
├── parameter.txt -------------------- Partition table information
├── uboot.img ------------------------ U-Boot image
├── boot.img ------------------------ Kernel image
├── rootfs.img ----------------------- Root filesystem image file
└── update.img ----------------------- Complete image file
1.2 SDK Configuration File Explanation
Lyra series SDK configuration files are located in the
device/rockchip/rk3506directory.-rw-rw-r-- 1 xt xt 1538 12月 10 19:58 amp_linux.its
-rw-rw-r-- 1 xt xt 482 12月 10 20:00 luckfox_lyra_buildroot_sdmmc_defconfig
-rw-rw-r-- 1 xt xt 527 12月 10 20:00 luckfox_lyra_buildroot_spinand_defconfig
-rw-rw-r-- 1 xt xt 487 12月 10 20:00 luckfox_lyra_plus_buildroot_sdmmc_defconfig
-rw-rw-r-- 1 xt xt 532 12月 10 20:00 luckfox_lyra_plus_buildroot_spinand_defconfig
-rw-rw-r-- 1 xt xt 344 12月 10 20:00 parameter-lyra-sdmmc.txt
-rw-rw-r-- 1 xt xt 333 12月 10 20:00 parameter-lyra-spinand.txt
drwxrwxr-x 2 xt xt 4096 12月 10 19:58 rk3506_oem
-rw-rw-r-- 1 xt xt 1053 12月 10 19:58 smp.its
-rw-rw-r-- 1 xt xt 1738 12月 10 19:58 thunderboot4recovery.its
-rw-rw-r-- 1 xt xt 1234 12月 10 19:58 thunderboot.its
-rw-rw-r-- 1 xt xt 1665 12月 10 19:58 zboot4recovery.its
-rw-rw-r-- 1 xt xt 1424 12月 10 19:58 zboot.its
2. Compiling Images in Ubuntu 22.04 Environment
Avoid using the sudo command indiscriminately during the image compilation process. Improper use may lead to file permission changes and cause the build to fail.
2.1 Setting Up the Compilation Environment
Install dependency environments.
sudo apt updatesudo apt-get update && sudo apt-get install git ssh make gcc libssl-dev \
liblz4-tool expect expect-dev g++ patchelf chrpath gawk texinfo chrpath \
diffstat binfmt-support qemu-user-static live-build bison flex fakeroot \
cmake gcc-multilib g++-multilib unzip device-tree-compiler ncurses-dev \
libgucharmap-2-90-dev bzip2 expat gpgv2 cpp-aarch64-linux-gnu libgmp-dev \
libmpc-dev bc python-is-python3 python2Configure the Python environment.
# By default, it links to python3
$ python --version
Python 3.10.12
which python2
sudo ln -sf /usr/bin/python2 /usr/bin/pythonDownload the latest SDK from the cloud link and extract the files (please do not directly copy the extraction command, as the SDK name may change with updates).
mkdir Lyra-sdk && cd Lyra-sdk
tar -xzvf luckfox-lyra-241213.tar.gzUnpack the decompressed files.
.repo/repo/repo sync -lCompile the Image.
$ ./build.sh lunch
############### Rockchip Linux SDK ###############
Manifest: luckfox_linux6.1_rk3506_release_v1.4_20250620.xml
Log colors: message notice warning error fatal
Log saved at /home/ubuntu/Luckfox/rk3506/250815/output/sessions/2025-10-28_14-54-29
You're building on Linux
Lunch menu...pick the Luckfox Lyra hardware version:
选择 Luckfox Lyra 硬件版本:
[0] RK3506G_Luckfox_Lyra
[1] RK3506G_Luckfox_Lyra_Plus
[2] RK3506B_Luckfox_Lyra_Ultra
[3] RK3506B_Luckfox_Lyra_Ultra_W
[4] RK3506B_Luckfox_Lyra_Zero_W
[5] RK3506B_Luckfox_Lyra_Pi
[6] RK3506B_Luckfox_Lyra_Pi_W
[7] custom
Which would you like? [0~7][default:0]: 4
Lunch menu...pick the boot medium:
选择启动媒介:
[0] SD_CARD
[1] SPI_NAND
Which would you like? [0~1][default:0]: 1
Lunch menu...pick the system version:
选择系统版本:
[0] Buildroot
Which would you like? [0~1][default:0]: 0
$ ./build.sh
2.2 Partial Compilation
Compile U-Boot Separately
./build.sh uboot- Generated image files:
rockdev/MiniLoaderAll.bin,rockdev/uboot.img
- Generated image files:
Compile the Kernel Separately
./build.sh kernel- Generated image file:
rockdev/boot.img
- Generated image file:
Compile the Root Filesystem Separately
./build.sh rootfs- Generated image file: rockdev/rootfs.img
Firmware Packaging
./build.sh firmware
3. Packaging Custom Files into the System Image
Before packaging, the Luckfox Lyra SDK uses an overlay mechanism to add specified files into the root filesystem.
- Create an overlay directory: add a custom folder (for example, luckfox-overlay) under SDK/buildroot/board/rockchip/rk3506.

- Add the file path to
buildroot/configs/rockchip_rk3506_luckfox_defconfig.
- Compile and package.
./build.sh firmware
4. File Sharing
File transfer between the virtual machine and Windows computer can be achieved using Samba services for file sharing. The virtual machine's filesystem can be easily accessed through the Network Neighborhood in Windows, making it very convenient.
4.1 Ubuntu Environment Configuration
Download and install Samba.
sudo apt-get update
sudo apt-get install samba -yConfigure the Samba service.
sudo vim /etc/samba/smb.conf
# Add the following content at the end of the file
[share]
comment = share folder
browseable = yes
path = /home/luckfox
create mask = 0700
directory mask = 0700
valid users = luckfox
force user = luckfox
force group = luckfox
public = yes
available = yes
writable = yes- Where "luckfox" is the hostname; fill in according to your actual hostname.
Set the sharing account password.
sudo smbpasswd -a luckfoxCheck the IP address of the virtual machine or host.
luckfox@luckfox:~/Luckfox-Pico/luckfox-pico$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.10.61 netmask 255.255.252.0 broadcast 192.168.11.255
inet6 fe80::814f:a51e:5f24:f0f7 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:d2:60:b9 txqueuelen 1000 (Ethernet)
RX packets 699559 bytes 754875799 (754.8 MB)
RX errors 0 dropped 4 overruns 0 frame 0
TX packets 53024 bytes 3278048 (3.2 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 190 bytes 24144 (24.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 190 bytes 24144 (24.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
4.2 Windows Environment
- Enter the IP address in the Windows address bar (fill in according to your actual IP address).

- The default password for the virtual machine account is "luckfox".

- Successfully log in to the virtual machine or host.

FAQ
if you encounter environment variable errors while compiling with WSL2, such as
Your PATH contains spaces, TABs, and/or newline (\n) characters. This doesn't work. Fix your PATH, you will need to remove spaces, tabs, and newlines.export PATH=$(echo "$PATH" | tr -d ' \t\n')