This repository provides a Docker-based build system for creating custom BuildRoot Linux images for the LuckFox Lyra, specifically tailored to run on the ClockworkPi PicoCalc.
Known Issues / Not Yet Working:
- Stereo hardware PWM audio - Audio output is not yet functional
- WiFi with RTL8188FU chip - WiFi driver integration is in progress but not working
These features are actively being developed. Contributions and testing are welcome!
- Docker installed on your system
- Python3 and pip to download the SDK
-
Build the Container: Run the setup script:
./setup.sh -
Run the build: Execute the build script:
./build.sh ./build.sh all
-
Get the results: After the build completes, your images will be available in the
./output/directory:update.img- Complete system image (main file to flash)boot.img- Kernel imagerootfs.img- Root filesystem imageuboot.img- U-Boot bootloaderMiniLoaderAll.bin- SPL bootloaderparameter.txt- Partition table information
-
Flash to hardware: Deploy the firmware to your PicoCalc LuckFox Lyra:
./flash.sh
Follow the prompts to flash
update.imgto your device. See FLASHING.md for detailed instructions.
The build system:
- Sets up the LuckFox Lyra SDK in an Ubuntu 22.04 container with all required dependencies
- Applies PicoCalc-specific modifications:
- Kernel configuration changes for RTC and RTL8188FU WiFi support
- Device tree updates for the PicoCalc hardware
- Buildroot configuration for SD card storage
- RTL8188FU WiFi driver patch
- Custom package configurations
- Builds the complete system using the configured toolchain
- Extracts all build artifacts to the
./output/directory for easy access - Provides flashing tools for easy deployment to hardware
Dockerfile- Docker container definitionbuild.sh- Main build script (run this)flash.sh- Firmware flashing script with safety checkssetup_usb.sh- Convenience wrapper for USB permissions setupFLASHING.md- Comprehensive flashing documentationscripts/- Build and flashing scripts:rkflash.sh- Low-level Rockchip flashing toolsetup_usb_permissions.sh- USB permissions setup script99-rockchip.rules- udev rules for USB device access
base/- Source files and configurations:build.sh- Internal build script run inside the container*.config- Kernel configuration files*.dts- Device tree source files*defconfig- Buildroot configuration*.patch- Patches for the build systempre-build-picocalc.sh- Pre-build script for additional customizations
The primary output is update.img, which contains the complete system image ready to be flashed to an SD card for use with the PicoCalc. Individual components are also provided for advanced users who need to flash specific partitions.
Once the build is complete, you can flash the firmware to your PicoCalc LuckFox Lyra:
# Quick flash (recommended)
./flash.sh
# Set up USB permissions for non-root flashing
./scripts/setup_usb_permissions.shFor detailed flashing instructions, troubleshooting, and hardware setup, see FLASHING.md.
Quick Flashing Steps:
- Insert SD card into the PicoCalc
- Boot to Linux and run
reboot loader(or use hardware boot button) - Connect USB-C cable to the LOWER USB-C port
- Run
./flash.shand follow the prompts
The build system supports applying additional overlays to extend functionality:
# Build with additional packages
./build.sh --overlay ./my-packages all
# Build specific configuration with overlay
./build.sh --overlay ./gaming-packages picocalc_luckfox_lyra_buildroot_sdmmc_defconfigOverlays follow the same directory structure as the base SDK:
my-overlay/
├── buildroot/
│ └── package/
│ ├── my-package/
│ │ ├── Config.in
│ │ └── my-package.mk
│ └── Config.in.patch # Adds package to Buildroot menu
├── kernel-6.1/
│ └── drivers/my-driver/ # Custom kernel modules
└── README.md
File Types:
- Regular files: Copied directly to the SDK
.patchfiles: Applied as patches to existing SDK files
See example-overlay/ for a complete example.
To customize the build:
- Modify files in the
src/directory - Update kernel configurations in
src/*.config - Modify device tree in
src/*.dts - Adjust Buildroot packages in
src/*defconfig - Add additional patches or scripts as needed
- Create overlays for reusable modifications
The build system provides several useful commands for development and debugging. All commands are available through ./build.sh:
Run ./build.sh --help to see all available options. Key development commands include:
# Standard build commands
./build.sh all # Build complete system
./build.sh buildroot # Build only BuildRoot components
./build.sh kernel # Build only kernel
# Development and debugging commands
./build.sh buildroot-shell # Open shell in BuildRoot environment
./build.sh shell # Open general development shell
./build.sh buildroot-config # Modify BuildRoot configuration interactively
./build.sh kernel-config # Modify kernel configuration interactivelyFor working with individual packages (especially useful when developing patches):
# Clean and rebuild a specific package
./build.sh buildroot-make:<package>-dirclean
./build.sh buildroot-make:<package>
# Example: Working with the RTL8188FU driver
./build.sh buildroot-make:rtl8188fu-dirclean # Clean package completely
./build.sh buildroot-make:rtl8188fu # Rebuild packageThe buildroot-shell command is particularly useful for development:
./build.sh buildroot-shellThis opens an interactive shell inside the BuildRoot environment where you can:
- Examine the build environment: Explore the buildroot
- Debug package builds: Check extracted source code and build logs
- Test manual compilation: Try compilation steps manually
- Inspect configurations: Review BuildRoot and kernel configurations
Inside the BuildRoot environment (or via buildroot-make:), you have access to all standard BuildRoot make targets:
# Package-specific commands
make <package>-extract # Extract package source
make <package>-patch # Apply patches to package
make <package>-configure # Configure package
make <package>-build # Build package
make <package>-install # Install package to staging
make <package>-dirclean # Clean package completely
make <package>-rebuild # Clean and rebuild package
# Configuration commands
make menuconfig # Interactive BuildRoot configuration
make savedefconfig # Save current config as defconfig
# Cleanup commands
make clean # Clean build artifacts
make distclean # Complete cleanup including downloadsWhen developing or debugging packages (like fixing patches):
- Clean the package:
./build.sh buildroot-make:rtl8188fu-dirclean - Open development shell:
./build.sh buildroot-shell - Extract and examine:
make rtl8188fu-extract && cd build/rtl8188fu-*/ - Apply patches manually:
make rtl8188fu-patch(or apply manually to debug) - Test compilation:
make rtl8188fu-build - Exit and rebuild:
exitthen./build.sh buildroot-make:rtl8188fu
- Use
buildroot-shellto examine extracted source code structure - Test patches manually before adding them to the package
- Use
dircleanto ensure clean rebuilds when testing patches - Check BuildRoot manual for advanced package development: https://buildroot.org/downloads/manual/manual.html#pkg-build-steps
- Ensure you have the correct LuckFox Lyra SDK tarball in the root directory
- Check that Docker is running and you have sufficient disk space
- Build logs are displayed during the process for debugging
- For flashing issues, see FLASHING.md troubleshooting section
- Set up USB permissions for non-root flashing:
./scripts/setup_usb_permissions.sh
This project includes automated firmware builds using GitHub Actions. When you create a new release tag:
-
Tag a release: Create and push a version tag (e.g.,
v1.0.0)git tag v1.0.0 git push origin v1.0.0
-
Automatic build: GitHub Actions will automatically:
- Build the Docker container
- Run
./setup.shto configure the build environment - Run
./build.sh allto build the complete firmware - Package all firmware files (
update.img,boot.img, etc.) - Create a GitHub release with downloadable firmware files
-
Download firmware: Users can download the built firmware directly from the GitHub releases page
The automated builds ensure consistent, reproducible firmware builds and make it easy for users to get the latest firmware without needing to set up the build environment themselves.
Based on the work from:
- PicoCalc-uf2 project
- picocalc-luckfox-lyra
- picocalc_luckfox_lyra
- LuckFox Technology for the Lyra SDK