Add LicheePi Zero support
PATCH 1/1 Add LicheePi Zero support
PATCH 1/1 Add LicheePi Zero support
Hello,
Thanks for this contribution!
Quoted 4 lines · Michel Stempin
From
b27c30f03f0355f8401ecedacd8f5378c3a6cf02Mon Sep 17 00:00:00 2001
From: Michel Stempin <[email protected]>
Date: Tue, 20 Mar 2018 19:23:13 +0100
Subject: [PATCH 1/1] Add LicheePi Zero support
This looks odd. Could you use "git send-email" to send your patches ?
More comments below.
Quoted 6 lines
board/licheepi/post-build.sh new file +0
-0
board/licheepi/post-build.sh line 9
Quoted 9 lines
board/licheepi/post-build.sh new file +9
-0@@ -0,0 +1,13 @@ +#!/bin/sh +BOARD_DIR="$( dirname "${0}" )" +MKIMAGE="${HOST_DIR}/bin/mkimage" +MKSWAP="${HOST_DIR}/sbin/mkswap" +BOOT_CMD="${BOARD_DIR}/boot.cmd" +BOOT_CMD_H="${BINARIES_DIR}/boot.scr" + +# U-Boot script +"${MKIMAGE}" -C none -A arm -T script -d "${BOOT_CMD}" "${BOOT_CMD_H}"
This should be done using BR2_TARGET_UBOOT_BOOT_SCRIPT.
board/licheepi/post-build.sh line 13
Quoted 4 lines
board/licheepi/post-build.sh new file +4
-0+ +# Swap +sed -i '/^\/swap/d' "${TARGET_DIR}/etc/fstab" +echo "/swap none swap defaults 0 0" >> "${TARGET_DIR}/etc/fstab"
Why do you need to tweak this in the fstab ?
board/licheepi/post-image.sh
Quoted 1 line
board/licheepi/post-image.sh +0
-0
You can use support/scripts/genimage.sh instead.
Quoted 6 lines
configs/licheepi_zero_defconfig new file +0
-0
configs/licheepi_zero_defconfig line 8
Quoted 8 lines
configs/licheepi_zero_defconfig new file +8
-0@@ -0,0 +1,75 @@ +# Target options +BR2_arm=y +BR2_cortex_a7=y +BR2_ARM_FPU_VFPV4=y + +# Toolchain +# External Linaro ARM 2017.11 toolchain +BR2_TOOLCHAIN_EXTERNAL=y
Please use the internal toolchain in the defconfig, like we do in all other defconfigs.
Quoted 7 lines
configs/licheepi_zero_defconfig new file +7
-0+# System configuration +BR2_TARGET_GENERIC_HOSTNAME="licheepi-zero" +BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the LicheePi Zero" +BR2_TARGET_GENERIC_ROOT_PASSWD="licheepi" +# Run a getty (login prompt) after boot on ttyS0 @ 115200 bps +BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" +BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
configs/licheepi_zero_defconfig line 25
Quoted 10 lines
configs/licheepi_zero_defconfig new file +10
-0+# Custom scripts for image creation +BR2_ROOTFS_POST_BUILD_SCRIPT="board/licheepi/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/licheepi/post-image.sh" + +# Kernel +# Custom 4.14.14 kernel based on stable linux.4.14.y from Lichee-Pi Github repository +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/linux" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="zero-4.14.y"
This looks like a branch and not a tag or commit. You should use a tag or commit so that the build is reproducible.
configs/licheepi_zero_defconfig line 36
Quoted 11 lines
configs/licheepi_zero_defconfig new file +11
-0+# In-tree kernel configuration +BR2_LINUX_KERNEL_DEFCONFIG="licheepi_zero" +# AllWinner V3s-based DTS +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-licheepi-zero sun8i-v3s-licheepi-zero-dock" + +# Target packages + +# E2fsprogs package for resize2fs +BR2_PACKAGE_E2FSPROGS=y +BR2_PACKAGE_E2FSPROGS_RESIZE2FS=y
We don't install this package in most defconfigs, so I think you should remove it.
Quoted 17 lines
configs/licheepi_zero_defconfig new file +17
-0+ +#?Hardware handling +# Firmare +# Linux-firmware +BR2_PACKAGE_LINUX_FIRMWARE=y +# Wifi firmware +# Realtek 87xx for rtl8723bs support +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y + +# Dhcpcd package DHCP client for Wi-Fi +BR2_PACKAGE_DHCPCD=y + +# WPA_supplicant package for Wi-Fi Authentication +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y + +# Filesystem images
configs/licheepi_zero_defconfig line 63
Quoted 10 lines
configs/licheepi_zero_defconfig new file +10
-0+BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y + +# Bootloaders +# Custom U-Boot from Lichee-Pi Github repository +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_GIT=y +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/u-boot" +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="v3s-current"
Same question: is this a branch or a tag name ?
configs/licheepi_zero_defconfig line 71
Quoted 8 lines
configs/licheepi_zero_defconfig new file +8
-0+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="LicheePi_Zero" +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin" + +#?Host utilities +# Required host utilities for building an SDCard image +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_DTC=y
DTC is not needed. It might be needed by U-Boot, but in this case, you should use BR2_TARGET_UBOOT_NEEDS_DTC=y.
configs/licheepi_zero_defconfig line 74
Quoted 3 lines
configs/licheepi_zero_defconfig new file +3
-0+BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
This last line will no longer be needed once you use BR2_TARGET_UBOOT_BOOT_SCRIPT.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
PATCH 1/1 Add LicheePi Zero support
Hello Thomas,
Thank you for reviewing my patch!
Le 21/03/2018 ? 15:55, Thomas Petazzoni a ?crit?:
Quoted 11 lines
Hello,
Thanks for this contribution!
Quoted 4 lines · Michel Stempin
From
b27c30f03f0355f8401ecedacd8f5378c3a6cf02Mon Sep 17 00:00:00 2001
From: Michel Stempin <[email protected]>
Date: Tue, 20 Mar 2018 19:23:13 +0100
Subject: [PATCH 1/1] Add LicheePi Zero supportThis looks odd. Could you use "git send-email" to send your patches ?
Ok, I will configure it.
Quoted 13 lines
More comments below.
Quoted 9 lines
board/licheepi/post-build.sh new file +3
-0@@ -0,0 +1,13 @@ +#!/bin/sh +BOARD_DIR="$( dirname "${0}" )" +MKIMAGE="${HOST_DIR}/bin/mkimage"
Quoted 8 lines
board/licheepi/post-build.sh line 9
Quoted 6 lines
board/licheepi/post-build.sh new file +6
-0+MKSWAP="${HOST_DIR}/sbin/mkswap" +BOOT_CMD="${BOARD_DIR}/boot.cmd" +BOOT_CMD_H="${BINARIES_DIR}/boot.scr" + +# U-Boot script +"${MKIMAGE}" -C none -A arm -T script -d "${BOOT_CMD}" "${BOOT_CMD_H}"This should be done using
BR2_TARGET_UBOOT_BOOT_SCRIPT.
I didn't know how to use it. I have it working now, thanks.
Quoted 7 lines
board/licheepi/post-build.sh line 13
Quoted 5 lines
board/licheepi/post-build.sh new file +4
-0+ +# Swap +sed -i '/^\/swap/d' "${TARGET_DIR}/etc/fstab" +echo "/swap none swap defaults 0 0" >> "${TARGET_DIR}/etc/fstab"Why do you need to tweak this in the fstab ?
The LicheePi Zero is booting on SDCard by default, and has only limited (64MiB) SDRAM, so I tried to make it a turnkey solution by providing all the tools to resize the partition and filesystem and add swap.
I understand now that you try to keep the defconfig changes to the bare minimum, so I will remove all these extra tools.
Quoted 4 lines
board/licheepi/post-image.sh
Quoted 2 lines
board/licheepi/post-image.sh +0
-0You can use
support/scripts/genimage.shinstead.
Ok, done.
Quoted 11 lines
Quoted 11 lines
configs/licheepi_zero_defconfig new file +3
-0@@ -0,0 +1,75 @@ +# Target options +BR2_arm=y +BR2_cortex_a7=y
Quoted 8 lines
configs/licheepi_zero_defconfig line 8
Quoted 5 lines
configs/licheepi_zero_defconfig new file +5
-0+BR2_ARM_FPU_VFPV4=y + +# Toolchain +# External Linaro ARM 2017.11 toolchain +BR2_TOOLCHAIN_EXTERNAL=yPlease use the internal toolchain in the defconfig, like we do in all other defconfigs.
Ok, done.
Quoted 13 lines
Quoted 13 lines
configs/licheepi_zero_defconfig new file +12
-0+# System configuration +BR2_TARGET_GENERIC_HOSTNAME="licheepi-zero" +BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the LicheePi Zero" +BR2_TARGET_GENERIC_ROOT_PASSWD="licheepi" +# Run a getty (login prompt) after boot on ttyS0 @ 115200 bps +BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" +BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y +# Custom scripts for image creation +BR2_ROOTFS_POST_BUILD_SCRIPT="board/licheepi/post-build.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/licheepi/post-image.sh" + +# Kernel
Quoted 8 lines
configs/licheepi_zero_defconfig line 25
Quoted 5 lines
configs/licheepi_zero_defconfig new file +5
-0+# Custom 4.14.14 kernel based on stable linux.4.14.y from Lichee-Pi Github repository +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/linux" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="zero-4.14.y"This looks like a branch and not a tag or commit. You should use a tag or commit so that the build is reproducible.
OK, I will take an exact commit hash.
Quoted 15 lines
configs/licheepi_zero_defconfig line 36
Quoted 12 lines
configs/licheepi_zero_defconfig new file +11
-0+# In-tree kernel configuration +BR2_LINUX_KERNEL_DEFCONFIG="licheepi_zero" +# AllWinner V3s-based DTS +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-licheepi-zero sun8i-v3s-licheepi-zero-dock" + +# Target packages + +# E2fsprogs package for resize2fs +BR2_PACKAGE_E2FSPROGS=y +BR2_PACKAGE_E2FSPROGS_RESIZE2FS=yWe don't install this package in most defconfigs, so I think you should remove it.
Ok, removed, see above.
Quoted 22 lines
Quoted 22 lines
configs/licheepi_zero_defconfig new file +21
-0+ +#?Hardware handling +# Firmare +# Linux-firmware +BR2_PACKAGE_LINUX_FIRMWARE=y +# Wifi firmware +# Realtek 87xx for rtl8723bs support +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y + +# Dhcpcd package DHCP client for Wi-Fi +BR2_PACKAGE_DHCPCD=y + +# WPA_supplicant package for Wi-Fi Authentication +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y + +# Filesystem images +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y + +# Bootloaders
Quoted 8 lines
configs/licheepi_zero_defconfig line 63
Quoted 6 lines
configs/licheepi_zero_defconfig new file +6
-0+# Custom U-Boot from Lichee-Pi Github repository +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y +BR2_TARGET_UBOOT_CUSTOM_GIT=y +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/u-boot" +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="v3s-current"Same question: is this a branch or a tag name ?
I will take an exact commit hash as above.
Quoted 12 lines
configs/licheepi_zero_defconfig line 71
Quoted 9 lines
configs/licheepi_zero_defconfig new file +8
-0+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="LicheePi_Zero" +BR2_TARGET_UBOOT_FORMAT_CUSTOM=y +BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin" + +#?Host utilities +# Required host utilities for building an SDCard image +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_DTC=yDTC is not needed. It might be needed by U-Boot, but in this case, you should use BR2_TARGET_UBOOT_NEEDS_DTC=y.
OK, didn't know about this one, I tested it, it works!
Quoted 7 lines
configs/licheepi_zero_defconfig line 74
Quoted 4 lines
configs/licheepi_zero_defconfig new file +3
-0+BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=yThis last line will no longer be needed once you use
BR2_TARGET_UBOOT_BOOT_SCRIPT.
Yes, I remove it.
Quoted 5 lines
Thanks!
Thomas
I will create a v2 patch and resubmit it for review,
Thanks!
Michel
PATCH v2 1/1 Add LicheePi Zero support
In reply to Michel Stempin---
Changes v1 -> v2: (suggested by Thomas)
- use git send-email
- use BR2_TARGET_UBOOT_BOOT_SCRIPT
- remove fstab tweaking
- use support/scripts/genimage.sh
- use the internal toolchain in the defconfig
- use a commit for building the kernel and u-boot
- remove package resize2fs in defconfig
- remove DTC host package use BR2_TARGET_UBOOT_NEEDS_DTC
- remove BR2_PACKAGE_HOST_UBOOT_TOOLS
board/licheepi/boot.cmd | 4 +++ board/licheepi/genimage.cfg | 35 +++++++++++++++++++ board/licheepi/readme.txt | 66 ++++++++++++++++++++++++++++++++++++ configs/licheepi_zero_defconfig | 74 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 179 insertions(+) create mode 100644 board/licheepi/boot.cmd create mode 100644 board/licheepi/genimage.cfg create mode 100644 board/licheepi/readme.txt create mode 100644 configs/licheepi_zero_defconfig
board/licheepi/boot.cmd new file +4 -0
@@ -0,0 +1,4 @@ +setenv bootargs console=ttyS0,115200 panic=5 console=tty0 rootwait root=/dev/mmcblk0p2 earlyprintk rw +load mmc 0:1 0x41000000 zImage +load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb +bootz 0x41000000 - 0x41800000
board/licheepi/genimage.cfg new file +35 -0
@@ -0,0 +1,35 @@ +image boot.vfat { + vfat { + files = { + "zImage", + "sun8i-v3s-licheepi-zero-dock.dtb", + "sun8i-v3s-licheepi-zero.dtb", + "boot.scr" + } + } + size = 8M +} + +image sdcard.img { + hdimage { + } + + partition u-boot { + in-partition-table = "no" + image = "u-boot-sunxi-with-spl.bin" + offset = 8192 + size = 516096 # 512KB - 8192 + } + + partition boot { + partition-type = 0xC + bootable = "true" + image = "boot.vfat" + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext4" + size = 0 + } +}
board/licheepi/readme.txt new file +66 -0
66 lines not on this page · raw message
configs/licheepi_zero_defconfig new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 1/1 Add LicheePi Zero support
Hello Michel,
Thanks for this new iteration. I have applied it, with some changes (see below).
Quoted 5 lines · On Tue, 5 Mar 2019 23:37:06 +0100 Michel Stempin <[email protected]>…
board/licheepi/boot.cmd | 4 +++ board/licheepi/genimage.cfg | 35 +++++++++++++++++++ board/licheepi/readme.txt | 66 ++++++++++++++++++++++++++++++++++++ configs/licheepi_zero_defconfig | 74 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 179 insertions(+)
The entry in the DEVELOPERS file was missing, so I added it.
board/licheepi/readme.txt line 15
Quoted 13 lines
board/licheepi/readme.txt new file +13
-0+Intro +===== + +This directory contains a buildroot configuration for building a +LicheePi Zero. + +How to build it +=============== + +Configure Buildroot +------------------- + +There is only one LicheePi Zero defconfig files in Buildroot:
This sentence was not really useful, there is typically only one defconfig for a given board in Buildroot, so I dropped it.
Quoted 6 lines
configs/licheepi_zero_defconfig new file +0
-0
configs/licheepi_zero_defconfig line 9
Quoted 9 lines
configs/licheepi_zero_defconfig new file +9
-0@@ -0,0 +1,74 @@ +# Target options +BR2_arm=y +BR2_cortex_a7=y +BR2_ARM_FPU_VFPV4=y + +# Toolchain +# Use 4.14.x headers and C++ support +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_14=y +BR2_TOOLCHAIN_BUILDROOT_CXX=y
There was no need for C++ support, so I dropped it.
configs/licheepi_zero_defconfig line 14
Quoted 5 lines
configs/licheepi_zero_defconfig new file +5
-0+ +# System configuration +BR2_TARGET_GENERIC_HOSTNAME="licheepi-zero" +BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the LicheePi Zero" +BR2_TARGET_GENERIC_ROOT_PASSWD="licheepi"
The defconfigs we have don't typically customize the root password, so I dropped this.
configs/licheepi_zero_defconfig line 45
Quoted 10 lines
configs/licheepi_zero_defconfig new file +10
-0+#?Hardware handling +# Firmare +# Linux-firmware +BR2_PACKAGE_LINUX_FIRMWARE=y +# Wifi firmware +# Realtek 87xx for rtl8723bs support +BR2_PACKAGE_LINUX_FIRMWARE_RTL_87XX=y + +# Dhcpcd package DHCP client for Wi-Fi +BR2_PACKAGE_DHCPCD=y
Busybox already has a built-in DHCP client, which we use in other defconfigs.
Beyond that, I simplified a bit the defconfig by removing some comments that were really redundant as they were repeating exactly what the options were doing.
Thanks for your contribution!
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com