diff --git a/config/armbian/bananapim2zero b/config/armbian/bananapim2zero new file mode 100644 index 000000000..e22a42b26 --- /dev/null +++ b/config/armbian/bananapim2zero @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Shebang for better file detection +# shellcheck enable=require-variable-braces + +# 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 diff --git a/src/modules/armbian/config b/src/modules/armbian/config index c36fa8a01..87896f775 100644 --- a/src/modules/armbian/config +++ b/src/modules/armbian/config @@ -16,3 +16,9 @@ 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" +[[ -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 8a8235846..7a3f6a0f7 100644 --- a/src/modules/armbian/start_chroot_script +++ b/src/modules/armbian/start_chroot_script @@ -113,3 +113,41 @@ 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" ]] \ +&& [[ "${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 + 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 + +## 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