From b2958520943fbc500160194c42e56086536a2b32 Mon Sep 17 00:00:00 2001 From: imi415 Date: Mon, 28 Jun 2021 22:39:10 +0800 Subject: [PATCH] Added spidev overlay for Pine64+ --- .../pine64-a64-plus-system-agent/genimage.cfg | 1 + .../overlays/spidev.dts | 31 +++++++++++ .../post-image.sh | 54 +++++++++++++++++++ .../system_agent_orangepi_pc_defconfig | 7 +++ .../system_agent_pine64_plus_defconfig | 4 +- .../system_agent_raspberrypi_4b_defconfig | 2 + 6 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 external_tree/board/iminc/pine64-a64-plus-system-agent/overlays/spidev.dts create mode 100755 external_tree/board/iminc/pine64-a64-plus-system-agent/post-image.sh diff --git a/external_tree/board/iminc/pine64-a64-plus-system-agent/genimage.cfg b/external_tree/board/iminc/pine64-a64-plus-system-agent/genimage.cfg index a4bf245..a1c5f33 100644 --- a/external_tree/board/iminc/pine64-a64-plus-system-agent/genimage.cfg +++ b/external_tree/board/iminc/pine64-a64-plus-system-agent/genimage.cfg @@ -4,6 +4,7 @@ image boot.vfat { "Image", "sun50i-a64-pine64-plus.dtb", "boot.scr" + "overlays" } } size = 32M diff --git a/external_tree/board/iminc/pine64-a64-plus-system-agent/overlays/spidev.dts b/external_tree/board/iminc/pine64-a64-plus-system-agent/overlays/spidev.dts new file mode 100644 index 0000000..d503ff9 --- /dev/null +++ b/external_tree/board/iminc/pine64-a64-plus-system-agent/overlays/spidev.dts @@ -0,0 +1,31 @@ +// Enable spidev with GPIO as CE1. + +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun50i-a64"; + + fragment@0 { + target-path = "/aliases"; + __overlay__ { + spi0 = "/soc/spi@1c68000"; + }; + }; + + fragment@1 { + target = <&spi0>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + cs-gpios = <0>, <&pio 7 7 0>; /* PH7 */ + spidev@1 { + compatible = "linux,spidev"; + status = "okay"; + reg = <1>; + spi-max-frequency = <32000000>; + }; + }; + }; +}; diff --git a/external_tree/board/iminc/pine64-a64-plus-system-agent/post-image.sh b/external_tree/board/iminc/pine64-a64-plus-system-agent/post-image.sh new file mode 100755 index 0000000..cd6ee22 --- /dev/null +++ b/external_tree/board/iminc/pine64-a64-plus-system-agent/post-image.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +die() { + cat <&2 +Error: $@ + +Usage: ${0} -c GENIMAGE_CONFIG_FILE +EOF + exit 1 +} + +# Parse arguments and put into argument list of the script +opts="$(getopt -n "${0##*/}" -o c: -- "$@")" || exit $? +eval set -- "$opts" + +GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + +while true ; do + case "$1" in + -c) + GENIMAGE_CFG="${2}"; + shift 2 ;; + --) # Discard all non-option parameters + shift 1; + break ;; + *) + die "unknown option '${1}'" ;; + esac +done + +[ -n "${GENIMAGE_CFG}" ] || die "Missing argument" + +# Pass an empty rootpath. genimage makes a full copy of the given rootpath to +# ${GENIMAGE_TMP}/root so passing TARGET_DIR would be a waste of time and disk +# space. We don't rely on genimage to build the rootfs image, just to insert a +# pre-built one in the disk image. + +trap 'rm -rf "${ROOTPATH_TMP}"' EXIT +ROOTPATH_TMP="$(mktemp -d)" + +rm -rf "${GENIMAGE_TMP}" + +mkdir -p "${BINARIES_DIR}/overlays" + +cp "${BINARIES_DIR}/spidev.dtb" "${BINARIES_DIR}/overlays/spidev.dtbo" + +genimage \ + --rootpath "${ROOTPATH_TMP}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}" + + diff --git a/external_tree/configs/system_agent_orangepi_pc_defconfig b/external_tree/configs/system_agent_orangepi_pc_defconfig index cee74d3..439af3f 100644 --- a/external_tree/configs/system_agent_orangepi_pc_defconfig +++ b/external_tree/configs/system_agent_orangepi_pc_defconfig @@ -64,6 +64,13 @@ BR2_PACKAGE_NETWORK_MANAGER=y BR2_PACKAGE_NETWORK_MANAGER_TUI=y BR2_PACKAGE_NETWORK_MANAGER_MODEM_MANAGER=y BR2_PACKAGE_OPENSSH=y +BR2_PACKAGE_WPA_SUPPLICANT=y +BR2_PACKAGE_WPA_SUPPLICANT_AUTOSCAN=y +BR2_PACKAGE_WPA_SUPPLICANT_WPA3=y +BR2_PACKAGE_WPA_SUPPLICANT_CLI=y +BR2_PACKAGE_WPA_SUPPLICANT_WPA_CLIENT_SO=y +BR2_PACKAGE_WPA_SUPPLICANT_DBUS=y +BR2_PACKAGE_WPA_SUPPLICANT_DBUS_INTROSPECTION=y BR2_PACKAGE_BASH_COMPLETION=y BR2_PACKAGE_FILE=y BR2_PACKAGE_SUDO=y diff --git a/external_tree/configs/system_agent_pine64_plus_defconfig b/external_tree/configs/system_agent_pine64_plus_defconfig index c03fd08..4c80bb5 100644 --- a/external_tree/configs/system_agent_pine64_plus_defconfig +++ b/external_tree/configs/system_agent_pine64_plus_defconfig @@ -22,7 +22,7 @@ BR2_GENERATE_LOCALE="en_US.UTF-8" BR2_TARGET_LOCALTIME="Asia/Tokyo" BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_system_agent_PATH)/customizations/users.table" BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_system_agent_PATH)/customizations/overlay" -BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh" +BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_system_agent_PATH)/board/iminc/pine64-a64-plus-system-agent/post-image.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BR2_EXTERNAL_system_agent_PATH)/board/iminc/pine64-a64-plus-system-agent/genimage.cfg" BR2_LINUX_KERNEL=y BR2_LINUX_KERNEL_CUSTOM_VERSION=y @@ -32,6 +32,8 @@ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_system_agent_PATH)/board/imi BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_system_agent_PATH)/board/iminc/pine64-a64-plus-system-agent/linux.fragment" BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="allwinner/sun50i-a64-pine64-plus" +BR2_LINUX_KERNEL_CUSTOM_DTS_PATH="$(BR2_EXTERNAL_system_agent_PATH)/board/iminc/pine64-a64-plus-system-agent/overlays/spidev.dts" +BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y BR2_PACKAGE_LINUX_TOOLS_CPUPOWER=y BR2_PACKAGE_LINUX_TOOLS_GPIO=y BR2_PACKAGE_LINUX_TOOLS_IIO=y diff --git a/external_tree/configs/system_agent_raspberrypi_4b_defconfig b/external_tree/configs/system_agent_raspberrypi_4b_defconfig index ea0fd6a..b76da85 100644 --- a/external_tree/configs/system_agent_raspberrypi_4b_defconfig +++ b/external_tree/configs/system_agent_raspberrypi_4b_defconfig @@ -1,5 +1,7 @@ BR2_aarch64=y BR2_cortex_a72=y +BR2_ENABLE_DEBUG=y +BR2_OPTIMIZE_G=y BR2_TOOLCHAIN_BUILDROOT_GLIBC=y BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y BR2_PACKAGE_GLIBC_UTILS=y