Skip to content

Commit 414a96c

Browse files
KwadFanmiklschmidt
authored andcommitted
feat: add BananaPi M2 Zero (mainsail-crew#247)
* 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>
1 parent c6a5e66 commit 414a96c

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

config/armbian/bananapim2zero

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# Shebang for better file detection
3+
# shellcheck enable=require-variable-braces
4+
5+
# Image source
6+
DOWNLOAD_URL_CHECKSUM="${DOWNLOAD_BASE_URL}/armbian-bananapi_m2_zero_bullseye.img.xz.sha256"
7+
DOWNLOAD_URL_IMAGE="${DOWNLOAD_BASE_URL}/armbian-bananapi_m2_zero_bullseye.img.xz"
8+
9+
# export Variables
10+
export BASE_ARCH
11+
export DOWNLOAD_URL_CHECKSUM
12+
export DOWNLOAD_URL_IMAGE

src/modules/armbian/config

+6
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@ bash-completion"
1616
[[ -n "$ARMBIAN_CONFIG_TXT_FILE" ]] || ARMBIAN_CONFIG_TXT_FILE="/boot/armbianEnv.txt"
1717
[[ -n "$ARMBIAN_CONFIG_BAK_FILE" ]] || ARMBIAN_CONFIG_BAK_FILE="/boot/armbianEnv.txt.backup"
1818
[[ -n "$ARMBIAN_MODULES_FILE" ]] || ARMBIAN_MODULES_FILE="/etc/modules"
19+
20+
## BananaPi M2 Zero specific
21+
### Disable OTG Serial Interface? (true/false)
22+
[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL" ]] || ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL="true"
23+
[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3" ]] || ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3="true"
24+
[[ -n "$ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI" ]] || ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI="true"

src/modules/armbian/start_chroot_script

+38
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,41 @@ echo_green "Enable SPI interface on Orange Pi SBC's ... DONE!"
113113
echo_green "Remove 'unattended-upgrades' service ..."
114114
sudo apt-get remove --purge --yes unattended-upgrades
115115
## END Step 7
116+
117+
## Step 8: Disable OTG serial console on "bananapim2zero"
118+
if [[ "$(is_board_type)" == "bananapim2zero" ]] \
119+
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_OTG_SERIAL}" == "true" ]]; then
120+
echo_green "Disable OTG Serial console for 'bananapim2zero' SBC's ..."
121+
if [[ ! -d /etc/modprobe.d ]]; then
122+
mkdir -p /etc/modprobe.d
123+
fi
124+
if [[ -d /etc/modprobe.d ]]; then
125+
echo "blacklist serial_g" >> /etc/modprobe.d/blacklist.conf
126+
fi
127+
echo_green "Disable OTG Serial console for 'bananapim2zero' SBC's ... [DONE]"
128+
fi
129+
## END Step 8
130+
131+
## Step 9: Enable spi and/or UART3 on BananaPi M2 Zero
132+
### Enable both
133+
if [[ "$(is_board_type)" == "bananapim2zero" ]] \
134+
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \
135+
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" == "true" ]]; then
136+
echo_green "Enable UART3 and SPI for 'bananapim2zero' SBC ..."
137+
echo "overlays=uart3 spi-spidev" >> "${ARMBIAN_CONFIG_TXT_FILE}"
138+
fi
139+
### UART3 only
140+
if [[ "$(is_board_type)" == "bananapim2zero" ]] \
141+
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \
142+
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" != "true" ]]; then
143+
echo_green "Enable UART3 for 'bananapim2zero' SBC ..."
144+
echo "overlays=uart3" >> "${ARMBIAN_CONFIG_TXT_FILE}"
145+
fi
146+
### SPI only
147+
if [[ "$(is_board_type)" == "bananapim2zero" ]] \
148+
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_UART3}" == "true" ]] \
149+
&& [[ "${ARMBIAN_CONFIG_BPI2ZERO_ENABLE_SPI}" != "true" ]]; then
150+
echo_green "Enable SPI for 'bananapim2zero' SBC ..."
151+
echo "overlays=uart3" >> "${ARMBIAN_CONFIG_TXT_FILE}"
152+
fi
153+
## END Step 9

0 commit comments

Comments
 (0)