🛠 Construire une image mainline complète avec Buildroot (defconfig officiel du Dock)
Objectives
Buildroot contains official in-tree support for this board: the sipeed_lichee_rv_dock defconfig (board/sipeed/lichee_rv_dock) which assembles a complete mainline image — generic OpenSBI 1.2, U-Boot lichee_rv_dock (Samuel Holland's sunxi/d1 tree), kernel with the nezha defconfig and the allwinner/sun20i-d1-lichee-rv-dock.dtb device tree, plus RTL8723DS Wi-Fi/BT packages, wpa_supplicant, and bluez. This advanced tutorial covers: full build from an x86 PC, writing the sdcard.img, and customization (packages, rootfs overlay). This is THE reproducible method for a product on D1.
Hardware
- Linux build PC (8 GB+ RAM, ~15 GB disk; gcc ≥ 10; the riscv64 cross-compiler is built by Buildroot itself)
- Lichee RV Dock + quality microSD card; serial console 115200 (UART0 PB8/PB9)
- Network access on the PC (for downloading sources)
Full Code
# 1) Sources Buildroot (master ou branche stable)
git clone https://gitlab.com/buildroot.org/buildroot.git
cd buildroot
# 2) Defconfig officielle de la carte
make sipeed_lichee_rv_dock_defconfig
make menuconfig # optionnel : paquetals (dropbear, nginx, python...), kernel local
# 3) Build complet (long à la première exécution)
make -j"$(nproc)"
# 4) Image SD bootable (layout genimage : vfat /boot + ext4 racine)
ls -lh output/images/ # sdcard.img, fw_jump.bin/fw_dynamic.bin (OpenSBI),
# u-boot.bin, Image, sun20i-d1-lichee-rv-dock.dtb
lsblk # puis écrire sur la BONNE carte :
sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=4M status=progress conv=fsync
# 5) Boot : microSD sous le module, câble A-vers-C, série 115200 -> invite root.
# Vérifier la chaîne :
dmesg | grep -iE 'machine|opensbi'
ls /proc/device-tree/ | head
cat /proc/config.gz > /dev/null 2>&1 || zcat /proc/config.gz | grep THEAD
Expected Verification
output/images/sdcard.img is produced without errors; on serial boot, OpenSBI announces RISC-V SBI, U-Boot starts, the kernel loads and mounts the ext4 root; the Buildroot # prompt appears. uname -m returns riscv64, ls /sys/class/leds shows the LEDs from the upstream device tree, and ip link reveals wlan0 (RTL8723DS package included). The dtb used is indeed sun20i-d1-lichee-rv-dock (visible in the U-Boot log under "Flattened Device Tree").
Common Errors
- Building under WSL1 or with an old gcc: Buildroot requires a clean environment; prefer a recent Debian VM/container, otherwise host packages will break the build.
- Running
makewithout a defconfig: the default empty x86 config produces an unusable image; always start fromsipeed_lichee_rv_dock_defconfig. - Using
make cleanfor everything: changing a package only requiresmake <package>-rebuild+make target-package; cleaning everything wastes hours. - Writing sdcard.img to a partition on a USB drive instead of the whole disk: the partition table is inside the image, writing to a partition results in a silent boot failure.
- Modifying the kernel without telling Buildroot to rebuild it (
make linux-rebuild): the Image in output/images remains the old one. - Forgetting that the rootfs is read-only squashfs/ext4 depending on the config: to persist changes, enable the ext4 rootfs with extension or an overlay.
Other tutorials for this board
- Premier boot du Lichee RV Dock avec Ubuntu 24.04 RISC-V
- LEDs du Lichee RV Dock : LED verte et RGB WS2812 pilotée par le LEDC du D1
- Audio sur le Dock : enregistrer au micro numérique et jouer sur le haut-parleur 3 W
- Wi-Fi et Bluetooth du module RTL8723DS sur le Lichee RV Dock
- GPIO, touche utilisateur ADC et PWM sur le connecteur 2×20 du Lichee RV
- Tina Linux : l'OpenWrt vendor d'Allwinner pour le Lichee RV, installation et sysconfig
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash