configs/sipeed_licheepi_4a: add new board

Add support for the LicheePi 4A with mainline component:
 - Linux Kernel 6.12

The following components are provided by vendor:
 - U-Boot 2020.01
 - OpenSBI v0.9

Board homepage and more usable wiki:
 - https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/1_intro.html

th1520-boot-firmware is selected from the package sipeed-lpi4abin.
This is inspired from lone0's fork of buildroot for th1520.[1]

[1] https://github.com/lone0/buildroot-th1520

Signed-off-by: Kanak Shilledar <kanakshilledar@gmail.com>
[Julien: Tested on cpu board version 51601
  on base board version 51602]
Tested-by: Julien Olivain <ju.o@free.fr>
[Julien:
  - add Signed-off-by line in commit log
  - reorder defconfig entries with "make savedefconfig"
  - fixed post-image.sh shellcheck warnings
    (found with "make check-package")
  - add extra info in readme.txt
  - change linux-headers.hash to a symlink
  - change linux.hash comment to take hash from upstream
]
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Kanak Shilledar
2025-03-09 18:32:32 +05:30
committed by Julien Olivain
parent 29861832a3
commit 1ab37899ae
10 changed files with 183 additions and 0 deletions

View File

@@ -2056,6 +2056,8 @@ F: package/libqb/
F: package/usbguard/
N: Kanak Shilledar <kanakshilledar@gmail.com>
F: board/sipeed/licheepi_4a/
F: configs/sipeed_licheepi_4a_defconfig
F: package/sipeed-lpi4abin/
N: Karoly Kasza <kaszak@gmail.com>

View File

@@ -0,0 +1,4 @@
label linux
kernel /Image
devicetree /th1520-lichee-pi-4a.dtb
append console=ttyS0,115200 root=/dev/mmcblk0p4 rootfstype=ext4 rootwait rw earlycon clk_ignore_unused init=/sbin/init

View File

@@ -0,0 +1,7 @@
image boot.ext4 {
ext4 {
label = "boot"
}
size = 64M
}

View File

@@ -0,0 +1 @@
../linux/linux.hash

View File

@@ -0,0 +1,2 @@
# From https://www.kernel.org/pub/linux/kernel/v6.x/sha256sums.asc
sha256 beb902a5f69d9e57710112203db38111dad6d30556ea8ce389284c8077fe944d linux-6.12.18.tar.xz

View File

@@ -0,0 +1,2 @@
# Locally computed
sha256 2510c0e867b4f8c28579def9a21e97fa2e8de95b8c7d66bb8b6642202bcee3b4 opensbi-61d7484c752a5e4c464d5dc18e21d9ac67fbbefa-git4.tar.gz

View File

@@ -0,0 +1,2 @@
# Locally computed
sha256 6158b9c6faee41a1e790ad4ba2e1b3e18a122ecdb5749fa77c7495a2d1c56262 uboot-b5ee6e549a7b5ff382a14021a5d6a3c94017bddd-git4.tar.gz

View File

@@ -0,0 +1,24 @@
#!/bin/sh
set -e
BOARD_DIR="$(dirname "$0")"
GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
trap 'rm -rf "${ROOTPATH_TMP}"' EXIT
ROOTPATH_TMP="$(mktemp -d)"
rm -rf "${GENIMAGE_TMP}"
cp "${BINARIES_DIR}"/Image "${BINARIES_DIR}"/*.dtb "${BINARIES_DIR}"/fw_dynamic.bin "${ROOTPATH_TMP}"
cp -a "${BINARIES_DIR}"/bootbins/* "${ROOTPATH_TMP}"
cp -a "${BOARD_DIR}"/extlinux "${ROOTPATH_TMP}"
genimage \
--rootpath "${ROOTPATH_TMP}" \
--tmppath "${GENIMAGE_TMP}" \
--inputpath "${BINARIES_DIR}" \
--outputpath "${BINARIES_DIR}" \
--config "${GENIMAGE_CFG}"
exit $?

View File

@@ -0,0 +1,97 @@
Intro
=====
This directory contains a Buildroot configuration for building a
LicheePi 4A image. For more information, see the board wiki page [1].
How to build it
===============
Configure Buildroot
-------------------
make sipeed_licheepi_4a_defconfig
Build the boot and rootfs
-------------------------
Note: you will need to have access to the network, since Buildroot
will download the packages' sources.
You may now build your rootfs with:
make
(This may take a while, consider getting yourself a coffee ;-) )
Result of the build
-------------------
After building, you should obtain this tree:
output/images/
+-- boot.ext4
+-- rootfs.ext2
+-- rootfs.ext4 -> rootfs.ext2
+-- rootfs.tar
+-- u-boot.bin
+-- u-boot-with-spl.bin
+-- fw_dynamic.bin
`-- Image
How to flash the board
======================
Once the build process is finished you will have to flash the
correspoding images to the respective partitions in the eMMC.
LicheePi 4A uses fastboot to flash the images.
The board needs to be booted in "Burning Mode". For that, check first
the boot switches (SW1, SW2) on the base board are set up on the
"eMMC" mode (this is the factory default). Then, boot the board while
pressing the "BOOT" button. See [2].
Note that the board can be booted by either:
- attaching the USB-C power cable, or
- pressing the "RESET" button (near the USB-C power connector) if the
power cable is already connected to the host computer.
The board should be enumerated from the host computer. This can be
confirmed with "lsusb". The board should be listed as:
ID 2345:7654 T-HEAD USB download gadget
The device should also be listed by the "fastboot devices" command:
???????????? Android Fastboot
The board can be flashed with the commands:
fastboot flash ram output/images/u-boot-with-spl.bin
fastboot reboot
fastboot flash uboot output/images/u-boot-with-spl.bin
fastboot flash boot output/images/boot.ext4
fastboot flash root output/images/rootfs.ext2
Boot the board
==============
Connect the console on the System Serial Port on pins
U0-RX, U0-TX and GND. For more details, see [3].
When resetting or powering up the board on the USB-C port, the U-Boot
prompt and Linux console will appear on this System Serial Port.
References
==========
[1] https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/1_intro.html
[2] https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/4_burn_image.html#How-to-enter-burning-mode
[3] https://wiki.sipeed.com/hardware/en/lichee/th1520/lpi4a/6_peripheral.html#System-Serial-Port

View File

@@ -0,0 +1,42 @@
BR2_riscv=y
BR2_RISCV_ISA_RVC=y
BR2_RISCV_ISA_RVV=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
BR2_GLOBAL_PATCH_DIR="board/sipeed/licheepi_4a/patches"
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_TARGET_GENERIC_HOSTNAME="licheepi4a"
BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the LicheePi 4A"
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/sipeed/licheepi_4a/post-image.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.18"
BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="thead/th1520-lichee-pi-4a"
BR2_PACKAGE_LINUX_FIRMWARE=y
BR2_PACKAGE_LINUX_FIRMWARE_RTL_RTW88=y
BR2_PACKAGE_SIPEED_LPI4ABIN=y
BR2_PACKAGE_IW=y
BR2_PACKAGE_WIRELESS_REGDB=y
BR2_PACKAGE_WIRELESS_TOOLS=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_PASSPHRASE=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_OPENSBI=y
BR2_TARGET_OPENSBI_CUSTOM_GIT=y
BR2_TARGET_OPENSBI_CUSTOM_REPO_URL="https://github.com/revyos/thead-opensbi.git"
BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION="61d7484c752a5e4c464d5dc18e21d9ac67fbbefa"
BR2_TARGET_OPENSBI_PLAT="generic"
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BOARDNAME="light_lpi4a"
BR2_TARGET_UBOOT_CUSTOM_GIT=y
BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/revyos/thead-u-boot.git"
BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="b5ee6e549a7b5ff382a14021a5d6a3c94017bddd"
BR2_TARGET_UBOOT_SPL=y
BR2_TARGET_UBOOT_SPL_NAME="u-boot-with-spl.bin"
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y