From 57027e5995a70db1427f4e34abea7d5b16983cde Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Mon, 2 Oct 2023 21:45:14 +0200 Subject: [PATCH 1/6] feat: add bananapi m2 zero Adding new SBC BananaPi M2 Zero Signed-off-by: Stephan Wendel --- config/armbian/bananapim2zero | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 config/armbian/bananapim2zero diff --git a/config/armbian/bananapim2zero b/config/armbian/bananapim2zero new file mode 100644 index 000000000..7be808e1a --- /dev/null +++ b/config/armbian/bananapim2zero @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Shebang for better file detection +# shellcheck enable=require-variable-braces + +BASE_ARCH="arm64" + +# Image source +DOWNLOAD_URL_CHECKSUM="${DOWNLOAD_BASE_URL}/armbian-bananapi_m2_zero_bullseye.img.xz.sha256" +DOWNLOAD_URL_IMAGE="${DOWNLOAD_BASE_URL}/armbian-bananapi_m2_zero_bullseye.img.xz" + +# export Variables +export BASE_ARCH +export DOWNLOAD_URL_CHECKSUM +export DOWNLOAD_URL_IMAGE From bb69d82e82ff6047b2e284f9335011f4257bd351 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Mon, 2 Oct 2023 21:57:31 +0200 Subject: [PATCH 2/6] fix: fix architecture Signed-off-by: Stephan Wendel --- config/armbian/bananapim2zero | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/armbian/bananapim2zero b/config/armbian/bananapim2zero index 7be808e1a..cdd09bd79 100644 --- a/config/armbian/bananapim2zero +++ b/config/armbian/bananapim2zero @@ -2,7 +2,7 @@ # Shebang for better file detection # shellcheck enable=require-variable-braces -BASE_ARCH="arm64" +# BASE_ARCH="arm64" not an 64bit CPU? WTF? # Image source DOWNLOAD_URL_CHECKSUM="${DOWNLOAD_BASE_URL}/armbian-bananapi_m2_zero_bullseye.img.xz.sha256" From 0a637b74a43349b1d9b613cf9a673d4ecd533460 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Mon, 2 Oct 2023 22:47:05 +0200 Subject: [PATCH 3/6] chore: clean BASE_ARCH variable Signed-off-by: Stephan Wendel --- config/armbian/bananapim2zero | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/armbian/bananapim2zero b/config/armbian/bananapim2zero index cdd09bd79..e22a42b26 100644 --- a/config/armbian/bananapim2zero +++ b/config/armbian/bananapim2zero @@ -2,8 +2,6 @@ # Shebang for better file detection # shellcheck enable=require-variable-braces -# BASE_ARCH="arm64" not an 64bit CPU? WTF? - # Image source DOWNLOAD_URL_CHECKSUM="${DOWNLOAD_BASE_URL}/armbian-bananapi_m2_zero_bullseye.img.xz.sha256" DOWNLOAD_URL_IMAGE="${DOWNLOAD_BASE_URL}/armbian-bananapi_m2_zero_bullseye.img.xz" From 82cb5e34b6d8c0502fdf7a69053e3c50c593d639 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Sat, 21 Oct 2023 13:21:24 +0200 Subject: [PATCH 4/6] chore: disable OTG serial console by default Signed-off-by: Stephan Wendel --- src/modules/armbian/start_chroot_script | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/modules/armbian/start_chroot_script b/src/modules/armbian/start_chroot_script index 8a8235846..1b70fea90 100644 --- a/src/modules/armbian/start_chroot_script +++ b/src/modules/armbian/start_chroot_script @@ -113,3 +113,16 @@ echo_green "Enable SPI interface on Orange Pi SBC's ... DONE!" echo_green "Remove 'unattended-upgrades' service ..." sudo apt-get remove --purge --yes unattended-upgrades ## END Step 7 + +## Step 8: Disable OTG serial console on "bananapim2zero" +if [[ "$(is_board_type)" == "bananapim2zero" ]]; then + echo_green "Disable OTG Serial console for 'bananapim2zero' SBC's ..." + if [[ ! -d /etc/modprobe.d ]]; then + mkdir -p /etc/modprobe.d + fi + if [[ -d /etc/modprobe.d ]]; then + echo "blacklist serial_g" >> /etc/modprobe.d/blacklist.conf + fi + echo_green "Disable OTG Serial console for 'bananapim2zero' SBC's ... [DONE]" +fi +## END Step 8 From 43fe27c52c30d0e710f7cca93d813e90268d1706 Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Sat, 21 Oct 2023 14:59:36 +0200 Subject: [PATCH 5/6] feat: make OTG serial configurable Added a configuration variable to make disabling of OTG serial connection configurable. If it is not disabled OTG functionality is not working with the OTG usb port. Disabled by default Signed-off-by: Stephan Wendel --- src/modules/armbian/config | 4 ++++ src/modules/armbian/start_chroot_script | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/armbian/config b/src/modules/armbian/config index c36fa8a01..25c0603cd 100644 --- a/src/modules/armbian/config +++ b/src/modules/armbian/config @@ -16,3 +16,7 @@ bash-completion" [[ -n "$ARMBIAN_CONFIG_TXT_FILE" ]] || ARMBIAN_CONFIG_TXT_FILE="/boot/armbianEnv.txt" [[ -n "$ARMBIAN_CONFIG_BAK_FILE" ]] || ARMBIAN_CONFIG_BAK_FILE="/boot/armbianEnv.txt.backup" [[ -n "$ARMBIAN_MODULES_FILE" ]] || ARMBIAN_MODULES_FILE="/etc/modules" + +## BananaPi M2 Zero specific +### Disable OTG Serial Interface? (true/false) +[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL" ]] || ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL="true" diff --git a/src/modules/armbian/start_chroot_script b/src/modules/armbian/start_chroot_script index 1b70fea90..e6fcd17b4 100644 --- a/src/modules/armbian/start_chroot_script +++ b/src/modules/armbian/start_chroot_script @@ -115,7 +115,8 @@ sudo apt-get remove --purge --yes unattended-upgrades ## END Step 7 ## Step 8: Disable OTG serial console on "bananapim2zero" -if [[ "$(is_board_type)" == "bananapim2zero" ]]; then +if [[ "$(is_board_type)" == "bananapim2zero" ]] \ +&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL}" == "true" ]]; then echo_green "Disable OTG Serial console for 'bananapim2zero' SBC's ..." if [[ ! -d /etc/modprobe.d ]]; then mkdir -p /etc/modprobe.d From 118ca51044624463a92d31d31a57a52b535996ce Mon Sep 17 00:00:00 2001 From: Stephan Wendel Date: Sat, 21 Oct 2023 15:17:27 +0200 Subject: [PATCH 6/6] feat: add configurable UART3 and SPI Add configurable UART3 and SPI for BananaPi M2 Zero Signed-off-by: Stephan Wendel --- src/modules/armbian/config | 2 ++ src/modules/armbian/start_chroot_script | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/modules/armbian/config b/src/modules/armbian/config index 25c0603cd..87896f775 100644 --- a/src/modules/armbian/config +++ b/src/modules/armbian/config @@ -20,3 +20,5 @@ bash-completion" ## BananaPi M2 Zero specific ### Disable OTG Serial Interface? (true/false) [[ -n "$ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL" ]] || ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL="true" +[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3" ]] || ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3="true" +[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI" ]] || ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI="true" diff --git a/src/modules/armbian/start_chroot_script b/src/modules/armbian/start_chroot_script index e6fcd17b4..7a3f6a0f7 100644 --- a/src/modules/armbian/start_chroot_script +++ b/src/modules/armbian/start_chroot_script @@ -127,3 +127,27 @@ if [[ "$(is_board_type)" == "bananapim2zero" ]] \ echo_green "Disable OTG Serial console for 'bananapim2zero' SBC's ... [DONE]" fi ## END Step 8 + +## Step 9: Enable spi and/or UART3 on BananaPi M2 Zero +### Enable both +if [[ "$(is_board_type)" == "bananapim2zero" ]] \ +&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \ +&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" == "true" ]]; then + echo_green "Enable UART3 and SPI for 'bananapim2zero' SBC ..." + echo "overlays=uart3 spi-spidev" >> "${ARMBIAN_CONFIG_TXT_FILE}" +fi +### UART3 only +if [[ "$(is_board_type)" == "bananapim2zero" ]] \ +&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \ +&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" != "true" ]]; then + echo_green "Enable UART3 for 'bananapim2zero' SBC ..." + echo "overlays=uart3" >> "${ARMBIAN_CONFIG_TXT_FILE}" +fi +### SPI only +if [[ "$(is_board_type)" == "bananapim2zero" ]] \ +&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \ +&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" != "true" ]]; then + echo_green "Enable SPI for 'bananapim2zero' SBC ..." + echo "overlays=uart3" >> "${ARMBIAN_CONFIG_TXT_FILE}" +fi +## END Step 9