diff mbox series

configs/lepotato_defconfig: new defconfig

Message ID 20240220225025.781466-2-romain.naour@smile.fr
State New
Headers show
Series configs/lepotato_defconfig: new defconfig | expand

Commit Message

Romain Naour Feb. 20, 2024, 10:50 p.m. UTC
Add basic support for the Libre Computer "Le Potato" SBC.

https://libre.computer/products/aml-s905x-cc

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 DEVELOPERS                                 |  2 +
 board/librecomputer/lepotato/extlinux.conf |  4 ++
 board/librecomputer/lepotato/genimage.cfg  | 33 +++++++++
 board/librecomputer/lepotato/post-build.sh |  5 ++
 board/librecomputer/lepotato/post-image.sh | 23 ++++++
 board/librecomputer/lepotato/readme.txt    | 82 ++++++++++++++++++++++
 configs/lepotato_defconfig                 | 50 +++++++++++++
 7 files changed, 199 insertions(+)
 create mode 100644 board/librecomputer/lepotato/extlinux.conf
 create mode 100644 board/librecomputer/lepotato/genimage.cfg
 create mode 100755 board/librecomputer/lepotato/post-build.sh
 create mode 100755 board/librecomputer/lepotato/post-image.sh
 create mode 100644 board/librecomputer/lepotato/readme.txt
 create mode 100644 configs/lepotato_defconfig

Comments

yegorslists--- via buildroot Feb. 21, 2024, 8:27 p.m. UTC | #1
Hi Romain,

Am Dienstag, 20. Februar 2024, 23:50:25 CET schrieb Romain Naour:
> Add basic support for the Libre Computer "Le Potato" SBC.
> 
> https://libre.computer/products/aml-s905x-cc
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>

Tested-by: Kilian Zinnecker <kilian.zinnecker@mail.de>

Build test only (as I don't have the board), with ./utils/docker-run

Best regards,
Kilian
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index ff44741f9f..b44246ee5c 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2667,9 +2667,11 @@  F:	package/vnstat/
 
 N:	Romain Naour <romain.naour@gmail.com>
 F:	board/qemu/
+F:	board/librecomputer/lepotato/
 F:	board/ti/am574x-idk/
 F:	configs/qemu_*
 F:	configs/am574x_idk_defconfig
+F:	configs/lepotato_defconfig
 F:	package/alure/
 F:	package/aubio/
 F:	package/binutils/
diff --git a/board/librecomputer/lepotato/extlinux.conf b/board/librecomputer/lepotato/extlinux.conf
new file mode 100644
index 0000000000..e0fea6c7aa
--- /dev/null
+++ b/board/librecomputer/lepotato/extlinux.conf
@@ -0,0 +1,4 @@ 
+label linux
+  kernel /Image
+  devicetree /meson-gxl-s905x-libretech-cc.dtb
+  append console=ttyAML0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait
diff --git a/board/librecomputer/lepotato/genimage.cfg b/board/librecomputer/lepotato/genimage.cfg
new file mode 100644
index 0000000000..b10e5d9440
--- /dev/null
+++ b/board/librecomputer/lepotato/genimage.cfg
@@ -0,0 +1,33 @@ 
+image boot.vfat {
+	vfat {
+		files = {
+			"Image",
+			"meson-gxl-s905x-libretech-cc.dtb",
+			"extlinux"
+		}
+
+		label = "boot"
+	}
+
+	size = 64M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image="boot.vfat"
+		size = 64M
+		offset = 2M
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext2"
+		size = 128M
+		offset = 0
+	}
+}
diff --git a/board/librecomputer/lepotato/post-build.sh b/board/librecomputer/lepotato/post-build.sh
new file mode 100755
index 0000000000..8dae08a47c
--- /dev/null
+++ b/board/librecomputer/lepotato/post-build.sh
@@ -0,0 +1,5 @@ 
+#!/bin/sh
+
+BOARD_DIR="$(dirname "$0")"
+
+install -m 0644 -D "$BOARD_DIR"/extlinux.conf "$BINARIES_DIR"/extlinux/extlinux.conf
diff --git a/board/librecomputer/lepotato/post-image.sh b/board/librecomputer/lepotato/post-image.sh
new file mode 100755
index 0000000000..69fb382dc1
--- /dev/null
+++ b/board/librecomputer/lepotato/post-image.sh
@@ -0,0 +1,23 @@ 
+#!/bin/sh
+
+BOARD_DIR="$(dirname "$0")"
+
+support/scripts/genimage.sh -c "${BOARD_DIR}/genimage.cfg"
+
+AMLOGIC_DIR=${BINARIES_DIR}/amlogic-boot-fip
+FIP_DIR=${BINARIES_DIR}/fip
+
+mkdir -p "${FIP_DIR}"
+
+(cd "${AMLOGIC_DIR}" && \
+	./build-fip.sh lepotato \
+	"${BINARIES_DIR}"/u-boot.bin \
+	"${FIP_DIR}")
+
+dd if="${FIP_DIR}"/u-boot.bin.sd.bin \
+   of="${BINARIES_DIR}"/sdcard.img \
+   conv=fsync,notrunc bs=1 count=444
+
+dd if="${FIP_DIR}"/u-boot.bin.sd.bin \
+   of="${BINARIES_DIR}"/sdcard.img \
+   conv=fsync,notrunc bs=512 skip=1 seek=1
diff --git a/board/librecomputer/lepotato/readme.txt b/board/librecomputer/lepotato/readme.txt
new file mode 100644
index 0000000000..391b030e1f
--- /dev/null
+++ b/board/librecomputer/lepotato/readme.txt
@@ -0,0 +1,82 @@ 
+Libre Computer Le Potato (AML-S905X-CC)
+
+Intro
+=====
+
+Libre Computer "Le Potato" is a low cost SBC based around an Amlogic
+s905x SoC (quad A53), 2GB DDR3, Mali-450:
+
+https://libre.computer/products/aml-s905x-cc/
+
+How to build it
+===============
+
+Configure Buildroot:
+
+  $ make lepotato_defconfig
+
+Then you can edit the build options using
+
+  $ make menuconfig
+
+Compile everything and build rootfs image:
+
+  $ make
+
+Note: you will need to have access to the network, since Buildroot
+will download the packages' sources.
+
+Result of the build
+-------------------
+
+After building, you should obtain this tree:
+
+output/images/
++-- amlogic-boot-fip
++   +-- axg.inc
++   +--  build-fip.sh
++   +--  g12a.inc
++   +--  gxbb.inc
++   +--  gxl.inc
++   `-- lepotato
++       +-- acs.bin
++       +-- acs_tool.py
++       +-- aml_encrypt_gxl
++       +-- bl21.bin
++       +-- bl2.bin
++       +-- bl301.bin
++       +-- bl30.bin
++       +-- bl31.img
++       +-- blx_fix.sh
++       `-- Makefile
++-- boot.vfat
++-- extlinux
++   `-- extlinux.conf
++-- fip
++   +--  u-boot.bin
++   +--  u-boot.bin.sd.bin
++   +--  u-boot.bin.usb.bl2
++   `-- u-boot.bin.usb.tpl
++-- Image
++-- meson-gxl-s905x-libretech-cc.dtb
++-- rootfs.ext2
++-- rootfs.ext4 -> rootfs.ext2
++-- rootfs.tar
++-- sdcard.img
+`-- u-boot.bin
+
+The post-image script uses the files in the amlogic-boot-fip folder to sign
+the bootloader image before integrating it into the sdcard image.
+
+How to write the SD card or eMMC
+================================
+
+Once the build process is finished you will have an image called "sdcard.img"
+in the output/images/ directory.
+
+Copy the bootable "sdcard.img" onto an SD card or eMMC with "dd":
+
+  $ sudo dd if=output/images/sdcard.img of=/dev/sdX
+
+Insert the micro SDcard into your Le Potato and power it up. The console
+is on the serial line, 115200 8N1.
diff --git a/configs/lepotato_defconfig b/configs/lepotato_defconfig
new file mode 100644
index 0000000000..e144fd5197
--- /dev/null
+++ b/configs/lepotato_defconfig
@@ -0,0 +1,50 @@ 
+# Architecture
+BR2_aarch64=y
+BR2_cortex_a53=y
+BR2_ARM_FPU_VFPV4=y
+
+# Image
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/librecomputer/lepotato/post-build.sh"
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/librecomputer/lepotato/post-image.sh"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.17"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="amlogic/meson-gxl-s905x-libretech-cc"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+
+# For kernel modules autoloading
+BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV=y
+
+# System
+BR2_SYSTEM_DHCP="eth0"
+
+# Linux headers same as kernel, a 6.6 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y
+
+# Filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="128M"
+
+# Bootloader
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.01"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="libretech-cc"
+BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
+
+# Required tool to sign the bootloader image
+BR2_PACKAGE_HOST_AMLOGIC_BOOT_FIP=y
+BR2_PACKAGE_HOST_AMLOGIC_BOOT_FIP_DEVICE="lepotato"
+
+# Required tools to create the SD image
+BR2_PACKAGE_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+BR2_PACKAGE_HOST_DOSFSTOOLS=y