Restructure according to buildroot upstream. Make output gpt with PARTUUID for boot selection. Add fix for building devicetrees in 6.12.x kernels.

This commit is contained in:
Lukas Schmid 2025-01-27 21:54:10 +01:00 committed by Lukas Schmid
parent 619c533e40
commit 080d9d5999
17 changed files with 205 additions and 124 deletions

View File

@ -0,0 +1,4 @@
LABEL default
kernel /boot/zImage
fdt /boot/sun8i-v3s-netcube-kumquat.dtb
append root=PARTUUID=%PARTUUID% rootwait console=${console} rootfstype=ext4 panic=3 ${mtdparts}

View File

@ -28,11 +28,13 @@ image nor-flash.img {
}
image sdcard.img {
hdimage {}
hdimage {
partition-table-type = "gpt"
}
partition rootfs {
partition-type = 0x83
bootable = "true"
image = "rootfs.ext4"
partition-uuid = %PARTUUID%
}
}

View File

@ -150,6 +150,11 @@
status = "okay";
};
/* Disable external 32k osc as it is broken on current revision */
&osc32k {
status = "disabled";
};
&pio {
vcc-pb-supply = <&reg_vcc3v3>;
vcc-pc-supply = <&reg_vcc3v3>;
@ -220,6 +225,11 @@
};
};
/* Disable external 32k osc as it is broken on current revision */
&rtc {
/delete-property/ clocks;
};
/* Exposed as a USB-C connector with USB-Serial converter */
&uart0 {
pinctrl-0 = <&uart0_pb_pins>;

View File

@ -0,0 +1,7 @@
#!/bin/sh
BOARD_DIR="$(dirname "$0")"
PARTUUID="$("$HOST_DIR/bin/uuidgen")"
install -d "$TARGET_DIR/boot/extlinux/"
sed "s/%PARTUUID%/$PARTUUID/g" "$BOARD_DIR/extlinux.conf" > "$TARGET_DIR/boot/extlinux/extlinux.conf"
sed "s/%PARTUUID%/$PARTUUID/g" "$BOARD_DIR/genimage.cfg" > "$BINARIES_DIR/genimage.cfg"

View File

@ -0,0 +1,71 @@
NetCube Systems Kumquat
=======================
https://kumquat.readthedocs.io/en/latest/
How to build it
===============
Configure buildroot:
$ make netcube_kumquat_defconfig
Change settings to fit your needs (optional):
$ make menuconfig
Compile everything and build the rootfs image:
$ make
Result of the build
===================
After building, the output/images directory contains:
output/images
├── allwinner
│ └── sun8i-v3s-netcube-kumquat.dtb
├── nor-flash.img
├── rootfs.ext2
├── rootfs.ext4 -> rootfs.ext2
├── sdcard.img
├── u-boot-sunxi-with-spl.bin
└── zImage
Flashing the SD card image
==========================
To install the image on a SDCard simply copy sdcard.img to the storage (e.g. SD, eMMC)
$ sudo dd if=output/images/sdcard.img of=<your-sd-device>
Flashing the SPI-NOR Flash
==========================
* Connect the USB-OTG and USB-Console
* If the board has a working U-Boot, erase it using:
- sf probe; sf erase 0 0x1000; reset;
* Write the new Image using sunxi-fel:
- sunxi-fel -p spiflash-write 0 output/images/nor-flash.img
* Reset the board into the new Bootloader
- sunxi-fel wdreset
Preparing the board
===================
* Connect the USB-Console to the board
* Insert the SD card
* Power-up the board
Booting the board
=================
By default the bootloader will search for the first valid image, starting
with the eMMC/SD. Followed by USB and Ethernet.

View File

@ -1,4 +0,0 @@
LABEL default
kernel /boot/zImage
fdt /boot/sun8i-v3s-netcube-kumquat.dtb
append root=/dev/mmcblk0p1 rootwait console=${console} rootfstype=ext4 panic=3 ${mtdparts}

View File

@ -1,68 +0,0 @@
#!/bin/sh
DAEMON="esphosted"
ESPHOSTED_ARGS=""
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
esp32_set_bootmode_flash() {
# Set mode as Flash
gpioset $(gpiofind ESP_nBOOT)=1
# Reset ESP32
gpioset $(gpiofind ESP_nRST)=0
gpioset $(gpiofind ESP_nRST)=1
}
start() {
grep -e "esp32_sdio" /proc/modules && return 0
printf 'Starting %s: ' "$DAEMON"
esp32_set_bootmode_flash
modprobe esp32_sdio $ESPHOSTED_ARGS
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
grep -e "esp32_sdio" /proc/modules || return 0
printf 'Stopping %s: ' "$DAEMON"
modprobe -r esp32_sdio
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
case "$1" in
start|stop|restart)
"$1";;
reload)
# Restart, since there is no true "reload" feature.
restart;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

View File

@ -9,4 +9,3 @@
# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mtd1 0x0000 0x40000
/dev/mtd2 0x0000 0x40000

View File

@ -0,0 +1,71 @@
#!/bin/sh
DAEMON="esphosted"
ESPHOSTED_ARGS=""
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
esp32_set_bootmode_flash() {
# Set mode as Flash
# shellcheck disable=SC2046
gpioset $(gpiofind ESP_nBOOT)=1
# Reset ESP32
# shellcheck disable=SC2046
gpioset $(gpiofind ESP_nRST)=0
# shellcheck disable=SC2046
gpioset $(gpiofind ESP_nRST)=1
}
start() {
grep -e "esp32_sdio" /proc/modules && return 0
printf 'Starting %s: ' "$DAEMON"
esp32_set_bootmode_flash
modprobe esp32_sdio "$ESPHOSTED_ARGS"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
grep -e "esp32_sdio" /proc/modules || return 0
printf 'Stopping %s: ' "$DAEMON"
modprobe -r esp32_sdio
status=$?
if [ "$status" -eq 0 ]; then
rm -f "$PIDFILE"
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
case "$1" in
start|stop|restart)
"$1";;
reload)
# Restart, since there is no true "reload" feature.
restart;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac

View File

@ -150,6 +150,11 @@
status = "okay";
};
/* Disable external 32k osc as it is broken on current revision */
&osc32k {
status = "disabled";
};
&pio {
vcc-pb-supply = <&reg_vcc3v3>;
vcc-pc-supply = <&reg_vcc3v3>;
@ -220,6 +225,11 @@
};
};
/* Disable external 32k osc as it is broken on current revision */
&rtc {
/delete-property/ clocks;
};
/* Exposed as a USB-C connector with USB-Serial converter */
&uart0 {
pinctrl-0 = <&uart0_pb_pins>;

View File

@ -2,17 +2,18 @@ BR2_arm=y
BR2_cortex_a7=y
BR2_ARM_FPU_NEON_VFPV4=y
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_OVERLAY="board/netcube/kumquat/rootfs"
BR2_ROOTFS_OVERLAY="board/netcube/kumquat/rootfs_overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/netcube/kumquat/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/netcube/kumquat/genimage.cfg"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BINARIES_DIR)/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.8.7"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.11"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/netcube/kumquat/linux_defconfig"
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/netcube/kumquat/linux.config"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-netcube-kumquat"
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/netcube/kumquat/linux-dts/*"
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/netcube/kumquat/linux-dts/sun8i-v3s-netcube-kumquat.dts"
BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME=y
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_PACKAGE_ESP_HOSTED=y
@ -26,9 +27,9 @@ BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.10"
BR2_TARGET_UBOOT_PATCH="board/netcube/kumquat/uboot-patches"
BR2_TARGET_UBOOT_PATCH="board/netcube/kumquat/patches/uboot/2024.10"
BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="board/netcube/kumquat/uboot_defconfig"
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="board/netcube/kumquat/uboot.config"
# BR2_TARGET_UBOOT_FORMAT_BIN is not set
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"

View File

@ -1,23 +1,24 @@
BR2_arm=y
BR2_cortex_a7=y
BR2_ARM_FPU_NEON_VFPV4=y
BR2_TOOLCHAIN_BUILDROOT_UCLIBC=y
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_WGET="wget --passive-ftp -nd -t 3"
BR2_TARGET_GENERIC_HOSTNAME="kumquat"
BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot on the NetCube Systems Kumquat"
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_OVERLAY="board/netcube/kumquat/rootfs"
BR2_ROOTFS_OVERLAY="board/netcube/kumquat/rootfs_overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="board/netcube/kumquat/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/netcube/kumquat/genimage.cfg"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BINARIES_DIR)/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.8.7"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.11"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/netcube/kumquat/linux_defconfig"
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/netcube/kumquat/linux.config"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-netcube-kumquat"
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/netcube/kumquat/linux-dts/*"
BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="board/netcube/kumquat/linux-dts/sun8i-v3s-netcube-kumquat.dts"
BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME=y
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
BR2_LINUX_KERNEL_INSTALL_TARGET=y
BR2_PACKAGE_ALSA_UTILS=y
@ -27,18 +28,14 @@ BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_ALSA_UTILS_APLAYMIDI=y
BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI=y
BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y
BR2_PACKAGE_BLUEZ_ALSA=y
BR2_PACKAGE_BLUEZ_ALSA_HCITOP=y
BR2_PACKAGE_BLUEZ_ALSA_RFCOMM=y
BR2_PACKAGE_FFMPEG_GPL=y
BR2_PACKAGE_FFMPEG_NONFREE=y
BR2_PACKAGE_FFMPEG_FFPLAY=y
BR2_PACKAGE_FFMPEG_FFPROBE=y
BR2_PACKAGE_MPV=y
BR2_PACKAGE_VLC=y
BR2_PACKAGE_COREMARK=y
BR2_PACKAGE_PV=y
BR2_PACKAGE_TREE=y
BR2_PACKAGE_DOSFSTOOLS=y
BR2_PACKAGE_DOSFSTOOLS_FATLABEL=y
BR2_PACKAGE_DOSFSTOOLS_FSCK_FAT=y
BR2_PACKAGE_DOSF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y
BR2_PACKAGE_SOCAT=y
BR2_PACKAGE_TCPDUMP=y
BR2_PACKAGE_WGET=y
BR2_PACKAGE_WIRELESS_REGDB=y
BR2_PACKAGE_WPA_SUPPLICANT=y
BR2_PACKAGE_WPA_SUPPLICANT_WPA3=y
BR2_PACKAGE_WPA_SUPPLICANT_CLI=y
BR2_PACKAGE_WPA_SUPPLICANT_DBUS=y
BR2_PACKAGE_OPKG=y
BR2_PACKAGE_OPKG_GPG_SIGN=y
BR2_PACKAGE_OPKG_UTILS=y
BR2_PACKAGE_HTOP=y
BR2_PACKAGE_UTIL_LINUX_BINARIES=y
BR2_PACKAGE_UTIL_LINUX_RFKILL=y
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
@ -113,9 +90,9 @@ BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_VERSION=y
BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2024.10"
BR2_TARGET_UBOOT_PATCH="board/netcube/kumquat/uboot-patches"
BR2_TARGET_UBOOT_PATCH="board/netcube/kumquat/patches/uboot/2024.10"
BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="board/netcube/kumquat/uboot_defconfig"
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="board/netcube/kumquat/uboot.config"
# BR2_TARGET_UBOOT_FORMAT_BIN is not set
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"

View File

@ -510,6 +510,7 @@ define LINUX_BUILD_CMDS
$(call KCONFIG_DISABLE_OPT,CONFIG_GCC_PLUGINS)
$(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \
cp -f $(dts) $(LINUX_ARCH_PATH)/boot/dts/
echo "dtb-y += $(notdir $(dts:%.dts=%.dtb))" >> $(LINUX_ARCH_PATH)/boot/dts/Makefile
)
$(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) all
$(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)