diff mbox series

[PATCHv2] configs/lepotato_defconfig: new defconfig

Message ID 20240527100424.397567-1-romain.naour@smile.fr
State New
Headers show
Series [PATCHv2] configs/lepotato_defconfig: new defconfig | expand

Commit Message

Romain Naour May 27, 2024, 10:04 a.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>
Tested-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
v2: add BR2_DOWNLOAD_FORCE_CHECK_HASHES=y and hashes
    update kernel to 6.6.32 and u-boot 2024.04.
---
 DEVELOPERS                                    |  2 +
 board/librecomputer/lepotato/extlinux.conf    |  4 +
 board/librecomputer/lepotato/genimage.cfg     | 33 ++++++++
 .../patches/linux-headers/linux-headers.hash  |  2 +
 .../lepotato/patches/linux/linux.hash         |  2 +
 .../lepotato/patches/uboot/uboot.hash         |  2 +
 board/librecomputer/lepotato/post-build.sh    |  5 ++
 board/librecomputer/lepotato/post-image.sh    | 23 ++++++
 board/librecomputer/lepotato/readme.txt       | 82 +++++++++++++++++++
 configs/lepotato_defconfig                    | 52 ++++++++++++
 10 files changed, 207 insertions(+)
 create mode 100644 board/librecomputer/lepotato/extlinux.conf
 create mode 100644 board/librecomputer/lepotato/genimage.cfg
 create mode 100644 board/librecomputer/lepotato/patches/linux-headers/linux-headers.hash
 create mode 100644 board/librecomputer/lepotato/patches/linux/linux.hash
 create mode 100644 board/librecomputer/lepotato/patches/uboot/uboot.hash
 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

Peter Korsgaard May 30, 2024, 7:29 p.m. UTC | #1
>>>>> "Romain" == Romain Naour via buildroot <buildroot@buildroot.org> writes:

 > 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>
 > Signed-off-by: Romain Naour <romain.naour@smile.fr>
 > ---
 > v2: add BR2_DOWNLOAD_FORCE_CHECK_HASHES=y and hashes
 >     update kernel to 6.6.32 and u-boot 2024.04.
 > ---
 >  DEVELOPERS                                    |  2 +
 >  board/librecomputer/lepotato/extlinux.conf    |  4 +
 >  board/librecomputer/lepotato/genimage.cfg     | 33 ++++++++
 >  .../patches/linux-headers/linux-headers.hash  |  2 +
 >  .../lepotato/patches/linux/linux.hash         |  2 +
 >  .../lepotato/patches/uboot/uboot.hash         |  2 +
 >  board/librecomputer/lepotato/post-build.sh    |  5 ++
 >  board/librecomputer/lepotato/post-image.sh    | 23 ++++++
 >  board/librecomputer/lepotato/readme.txt       | 82 +++++++++++++++++++
 >  configs/lepotato_defconfig                    | 52 ++++++++++++
 >  10 files changed, 207 insertions(+)
 >  create mode 100644 board/librecomputer/lepotato/extlinux.conf
 >  create mode 100644 board/librecomputer/lepotato/genimage.cfg
 >  create mode 100644 board/librecomputer/lepotato/patches/linux-headers/linux-headers.hash
 >  create mode 100644 board/librecomputer/lepotato/patches/linux/linux.hash
 >  create mode 100644 board/librecomputer/lepotato/patches/uboot/uboot.hash
 >  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

 > +++ 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"

Is the vfat partition strictly needed or could you directly have the
rootfs as the first/single partition like we do for lafrite?

If so, that would make things a bit simpler (E.G. no post-build script,
host-mtools / host-dosfstools).
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index 52c9b84a9d..1a41edb38e 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2729,10 +2729,12 @@  F:	package/vnstat/
 N:	Romain Naour <romain.naour@gmail.com>
 F:	board/beagleboard/beagleboneai64/
 F:	board/qemu/
+F:	board/librecomputer/lepotato/
 F:	board/ti/am574x-idk/
 F:	configs/qemu_*
 F:	configs/am574x_idk_defconfig
 F:	configs/beagleboneai64_defconfig
+F:	configs/lepotato_defconfig
 F:	package/alure/
 F:	package/aubio/
 F:	package/bcc/
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/patches/linux-headers/linux-headers.hash b/board/librecomputer/lepotato/patches/linux-headers/linux-headers.hash
new file mode 100644
index 0000000000..1b188a3f4a
--- /dev/null
+++ b/board/librecomputer/lepotato/patches/linux-headers/linux-headers.hash
@@ -0,0 +1,2 @@ 
+# Locally calculated
+sha256  aaa824eaf07f61911d22b75ff090a403c3dd0bd73e23933e0bba8b5971436ce1  linux-6.6.32.tar.xz
diff --git a/board/librecomputer/lepotato/patches/linux/linux.hash b/board/librecomputer/lepotato/patches/linux/linux.hash
new file mode 100644
index 0000000000..1b188a3f4a
--- /dev/null
+++ b/board/librecomputer/lepotato/patches/linux/linux.hash
@@ -0,0 +1,2 @@ 
+# Locally calculated
+sha256  aaa824eaf07f61911d22b75ff090a403c3dd0bd73e23933e0bba8b5971436ce1  linux-6.6.32.tar.xz
diff --git a/board/librecomputer/lepotato/patches/uboot/uboot.hash b/board/librecomputer/lepotato/patches/uboot/uboot.hash
new file mode 100644
index 0000000000..97a2b4eaf9
--- /dev/null
+++ b/board/librecomputer/lepotato/patches/uboot/uboot.hash
@@ -0,0 +1,2 @@ 
+# Locally calculated
+sha256  18a853fe39fad7ad03a90cc2d4275aeaed6da69735defac3492b80508843dd4a  u-boot-2024.04.tar.bz2
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..1d4549e0c1
--- /dev/null
+++ b/configs/lepotato_defconfig
@@ -0,0 +1,52 @@ 
+# 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.32"
+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"
+BR2_GLOBAL_PATCH_DIR="board/librecomputer/lepotato/patches"
+BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
+
+# 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.04"
+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