Raspberry Pi family: read motd board name from /proc/cpuinfo

- also adjust hostname if they are Armbian defaults
- drop rpi5b build config as they all run with one image
This commit is contained in:
Igor Pecovnik
2025-02-19 12:24:19 +01:00
committed by Igor
parent 1888a12ac7
commit 3981d58bba
4 changed files with 21 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
# Broadcom BCM2711 quad core 1-8Gb RAM SoC USB3 GBE USB-C WiFi/BT # All 64b Raspberry models from Broadcom BCM2837 - BCM271x quad core 1-16Gb RAM SoC USB3 GBE USB-C WiFi/BT
declare -g BOARD_NAME="Raspberry Pi 4" declare -g BOARD_NAME="Raspberry Pi"
declare -g BOARDFAMILY="bcm2711" declare -g BOARDFAMILY="bcm2711"
declare -g BOARD_MAINTAINER="PanderMusubi teknoid" declare -g BOARD_MAINTAINER="PanderMusubi teknoid"
declare -g KERNEL_TARGET="legacy,current,edge" declare -g KERNEL_TARGET="current,edge"
declare -g ASOUND_STATE="asound.state.rpi" declare -g ASOUND_STATE="asound.state.rpi"
declare -g KERNEL_TEST_TARGET="current" declare -g KERNEL_TEST_TARGET="current"

View File

@@ -1,7 +0,0 @@
# Broadcom BCM2712 quad core 1-8Gb RAM SoC USB3 GBE USB-C WiFi/BT
declare -g BOARD_NAME="Raspberry Pi 5"
declare -g BOARDFAMILY="bcm2711"
declare -g BOARD_MAINTAINER=""
declare -g KERNEL_TARGET="current,edge"
declare -g KERNEL_TEST_TARGET="current"
declare -g ASOUND_STATE="asound.state.rpi"

View File

@@ -92,6 +92,11 @@ fi
# Display software vendor logo # Display software vendor logo
echo -e "\e[1;91m$(figlet -f small " $VENDOR")\e[0m"; echo -e "\e[1;91m$(figlet -f small " $VENDOR")\e[0m";
# Read RPI model from cpuinfo
if [[ $BOARD == rpi4b ]]; then
BOARD_NAME=$(grep "Model" /proc/cpuinfo | sed -E 's/^Rev //; s/ Rev [0-9.]+$//' | cut -d":" -f2 | xargs)
fi
# Display version, board, and kernel version # Display version, board, and kernel version
[[ $VERSION == *trunk* ]] && VERSION=$(echo -e $VERSION | cut -d"." -f1-2 | sed "s/\$/ rolling/") [[ $VERSION == *trunk* ]] && VERSION=$(echo -e $VERSION | cut -d"." -f1-2 | sed "s/\$/ rolling/")
echo -e " \e[0;92mv${VERSION}\x1B[0m for $BOARD_NAME running Armbian Linux \e[0;92m${KERNELID^}\x1B[0m" echo -e " \e[0;92mv${VERSION}\x1B[0m for $BOARD_NAME running Armbian Linux \e[0;92m${KERNELID^}\x1B[0m"

View File

@@ -109,6 +109,19 @@ case "$1" in
[[ "${LINUXFAMILY}" == meson64 ]] && set_fixed_mac [[ "${LINUXFAMILY}" == meson64 ]] && set_fixed_mac
[[ "${BOARD}" == nanopi-r6* ]] && set_fixed_mac [[ "${BOARD}" == nanopi-r6* ]] && set_fixed_mac
# adjust hostname for rpi's
if [[ "${BOARD}" == rpi4b && "$(cat /etc/hostname)" == rpi4b ]]; then
BOARD_NAME=$(grep "Model" /proc/cpuinfo | sed -E 's/^Rev //; s/ Rev [0-9.]+$//' | cut -d":" -f2 | xargs)
[[ "$BOARD_NAME" == *"Zero 2 W"* ]] && NEW_HOSTNAME="rpizero2w"
[[ "$BOARD_NAME" == *"Pi 5 Model B"* ]] && NEW_HOSTNAME="rpi5b"
[[ "$BOARD_NAME" == *"Pi 3 Model B"* ]] && NEW_HOSTNAME="rpi3b"
[[ "$BOARD_NAME" == *"Pi 400"* ]] && NEW_HOSTNAME="rpi400"
# Update /etc/hosts to reflect the new hostname
sed -i "s/$(hostname)/$NEW_HOSTNAME/g" /etc/hosts
# Change the hostname
hostnamectl set-hostname "$NEW_HOSTNAME"
fi
# Remove KDE Neon base files upgrade pin # Remove KDE Neon base files upgrade pin
[[ -f /etc/apt/preferences.d/99-neon-base-files ]] && rm -f /etc/apt/preferences.d/99-neon-base-files [[ -f /etc/apt/preferences.d/99-neon-base-files ]] && rm -f /etc/apt/preferences.d/99-neon-base-files