SDK Image Compilation
The Luckfox Pico-SDK is primarily developed and tested on Ubuntu LTS, with official support for Ubuntu 22.04. If you're using Ubuntu 22.04, you only need to install the necessary dependencies to start compiling. To ensure compatibility across different Ubuntu versions, we also provide a convenient Docker environment for users.
- 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. SDK Directory Overview
- Getting the Latest SDK:
git clone https://gitee.com/LuckfoxTECH/luckfox-pico.git
git clone https://github.com/LuckfoxTECH/luckfox-pico.git - Overview of the SDK directory structure:
├── build.sh -> project/build.sh # SDK build script
├── media # Media codecs, ISP algorithms, etc. (can be built as a separate SDK)
├── sysdrv # U-Boot, kernel, and rootfs (can be built as a separate SDK)
├── project # Reference applications, build configurations, and scripts
├── output # Directory for generated image files after SDK compilation
└── tools # Image packaging and flashing tools - Image Output Directory Overview:
output/
├── image
│ ├── download.bin # Device-side program for flashing tool communication (loaded only into memory)
│ ├── env.img # Contains partition table and boot parameters
│ ├── uboot.img # U-Boot image
│ ├── idblock.img # Loader image
│ ├── boot.img # Kernel image
│ ├── rootfs.img # Root filesystem image
│ └── userdata.img # User data image
└── out
├── app_out # Compiled reference application files
├── media_out # Compiled media-related files
├── rootfs_xxx # Root filesystem packaging directory
├── S20linkmount # Partition mount script
├── sysdrv_out # Compiled sysdrv files
└── userdata # User data - Explanation of SDK Configuration Files
luckfox-pico/project/cfg/BoardConfig_IPC:BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_86Panel-IPC.mk
BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_86Panel_W-IPC.mk
BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi-IPC.mk
BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi_W-IPC.mk
BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Ultra-IPC.mk
BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Ultra_W-IPC.mk
BoardConfig-EMMC-Busybox-RV1106_Luckfox_Pico_Ultra-IPC_FASTBOOT.mk
BoardConfig-SD_CARD-Buildroot-RV1103_Luckfox_Pico-IPC.mk
BoardConfig-SD_CARD-Buildroot-RV1103_Luckfox_Pico_Mini_A-IPC.mk
BoardConfig-SD_CARD-Buildroot-RV1103_Luckfox_Pico_Mini_B-IPC.mk
BoardConfig-SD_CARD-Buildroot-RV1103_Luckfox_Pico_Plus-IPC.mk
BoardConfig-SD_CARD-Buildroot-RV1103_Luckfox_Pico_WebBee-IPC.mk
BoardConfig-SD_CARD-Buildroot-RV1106_Luckfox_Pico_Max-IPC.mk
BoardConfig-SD_CARD-Buildroot-RV1106_Luckfox_Pico_Pro-IPC.mk
BoardConfig-SPI_NAND-Buildroot-RV1103_Luckfox_Pico_Mini_B-IPC.mk
BoardConfig-SPI_NAND-Buildroot-RV1103_Luckfox_Pico_Plus-IPC.mk
BoardConfig-SPI_NAND-Buildroot-RV1103_Luckfox_Pico_WebBee-IPC.mk
BoardConfig-SPI_NAND-Buildroot-RV1106_Luckfox_Pico_Max-IPC.mk
BoardConfig-SPI_NAND-Buildroot-RV1106_Luckfox_Pico_Pro-IPC.mk
BoardConfig-SPI_NAND-Busybox-RV1106_Luckfox_Pico_Pro_Max-IPC_FASTBOOT.mk
luckfox-buildroot-nocsi-oem-pre.sh
luckfox-buildroot-oem-pre.sh
luckfox-glibc-oem-pre.sh
luckfox-rv1106-tb-emmc-post.sh
luckfox-rv1106-tb-spi_nand-post.sh
luckfox-systemd-off-modem-post.sh
luckfox-userdata-pre.sh
overlay - Taking
BoardConfig-SD_CARD-Buildroot-RV1106_Luckfox_Pico_Max-IPC.mkas an example, here are key configuration items:# Config CMA size in environment
export RK_BOOTARGS_CMA_SIZE="66M"
# Kernel dts
export RK_KERNEL_DTS=rv1106g-luckfox-pico-pro-max.dts
# Target boot medium
export RK_BOOT_MEDIUM=sd_card
export RK_PARTITION_CMD_IN_ENV="32K(env),512K@32K(idblock),256K(uboot),32M(boot),512M(oem),256M(userdata),6G(rootfs),-(media)"
# Target rootfs
export LF_TARGET_ROOTFS=buildroot
# Buildroot defconfig
export RK_BUILDROOT_DEFCONFIG=luckfox_pico_defconfig
# declare overlay directory
export RK_POST_OVERLAY="overlay-luckfox-config overlay-luckfox-buildroot-init overlay-luckfox-buildroot-shadow"RK_BOOTARGS_CMA_SIZE: Memory allocated to the camera. If unused, set it to 1M.RK_KERNEL_DTS: Specifies the device tree source file.RK_BOOT_MEDIUM: Defines the target boot medium — options include sd_card (SD card), spi_nand (SPI NAND Flash), or emmc.RK_PARTITION_CMD_IN_ENV: Partition table configuration. You may modify the rootfs partition to match your SD card size.LF_TARGET_ROOTFS: Specifies the target root filesystem.RK_BUILDROOT_DEFCONFIG: Defines the Buildroot configuration file.RK_POST_OVERLAY: Points to files under the overlay folder that will be included in the image.
2. SDK Image Compilation
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.
- Install Build Dependencies:
sudo apt updatesudo apt-get install -y git ssh make gcc gcc-multilib g++-multilib module-assistant expect g++ gawk texinfo libssl-dev bison flex fakeroot cmake unzip gperf autoconf device-tree-compiler libncurses5-dev pkg-config bc python-is-python3 passwd openssl openssh-server openssh-client vim file cpio rsync curl - Please select the appropriate branch based on the actual model of your development board. Model information can be found in the Product Introduction section.
luckfox@luckfox:~/luckfox-pico$ ./build.sh lunch
You're building on Linux
Lunch menu...pick the Luckfox Pico hardware version:
选择 Luckfox Pico 硬件版本:
[0] RV1103_Luckfox_Pico
[1] RV1103_Luckfox_Pico_Mini_A
[2] RV1103_Luckfox_Pico_Mini_B
[3] RV1103_Luckfox_Pico_Plus
[4] RV1103_Luckfox_Pico_WebBee
[5] RV1106_Luckfox_Pico_Pro
[6] RV1106_Luckfox_Pico_Max
[7] RV1106_Luckfox_Pico_Ultra
[8] RV1106_Luckfox_Pico_Ultra_W
[9] RV1106_Luckfox_Pico_Pi
[10] RV1106_Luckfox_Pico_Pi_W
[11] RV1106_Luckfox_Pico_86Panel
[12] RV1106_Luckfox_Pico_86Panel_W
[13] custom
Which would you like? [0~13][default:0]: 10
Lunch menu...pick the boot medium:
选择启动媒介:
[0] EMMC
Which would you like? [0][default:0]: 0
Lunch menu...pick the system version:
选择系统版本:
[0] Buildroot
Which would you like? [0][default:0]: 0
[build.sh:info] Lunching for Default BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi_W-IPC.mk boards...
[build.sh:info] switching to board: /home/ubuntu/Luckfox/rv1106/sdk-250510-panel/luckfox-pico/project/cfg/BoardConfig_IPC/BoardConfig-EMMC-Buildroot-RV1106_Luckfox_Pico_Pi_W-IPC.mk
[build.sh:info] Running build_select_board succeeded.
luckfox@luckfox:~/luckfox-pico$ ./build.sh - Other Common Build Commands During Development:
- Build Kernel Separately:
./build.sh clean kernel
./build.sh kernel - Build uboot Separately:
./build.sh clean uboot
./build.sh uboot - Build rootfs Separately:
./build.sh clean rootfs
./build.sh rootfs - Package Firmware: (Used for packaging custom files)
./build.sh firmware
- Build Kernel Separately:
3. Packaging Custom Files into the System Image
Before packaging, the Luckfox Pico SDK uses an overlay mechanism to add specified files into the root filesystem.
- Create an
overlaydirectory: Add a custom folder underproject/cfg/BoardConfig_IPC/overlay(e.g., custom-overlay). - Add files following the root filesystem structure:
# eg: overlay-luckfox-buildroot-shadow
project/cfg/BoardConfig_IPC/overlay/custom-overlay/
└── etc
├── samba
│ ├── smb.conf
│ └── smbpasswd
├── shadow
└── ssh
└── sshd_config - Configure board support file: In
project/cfg/BoardConfig_IPC/BoardConfig.mkadd the following line:export RK_POST_OVERLAY="custom-overlay" # Replace with your actual folder name - Build and package:
./build.sh firmware # Run the build process to generate a rootfs.img that includes the overlay content.
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')