Skip to content

Commit

Permalink
feat: add BananaPi M2 Zero (mainsail-crew#247)
Browse files Browse the repository at this point in the history
* feat: add bananapi m2 zero

Adding new SBC BananaPi M2 Zero

Signed-off-by: Stephan Wendel <me@stephanwe.de>

---------

Signed-off-by: Stephan Wendel <me@stephanwe.de>
  • Loading branch information
KwadFan authored and miklschmidt committed Feb 25, 2024
1 parent c6a5e66 commit 414a96c
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
12 changes: 12 additions & 0 deletions config/armbian/bananapim2zero
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions src/modules/armbian/config
Original file line number Diff line number Diff line change
Expand Up @@ -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"
38 changes: 38 additions & 0 deletions src/modules/armbian/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 414a96c

Please sign in to comment.