Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add BananaPi M2 Zero #247

Merged
merged 6 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading