Skip to content

Commit 2978f16

Browse files
committed
dietpi-installer: install Orange Pi 5 Plus Ethernet udev rule on vendor kernel only
* define SBC model and kernel family explicitly for all supported models, but skip the rarely used `$arch` variable: instead obtian it right before it gets used when compiling the boot script. Exit with an error if an unknown hardware ID was passed (which should not happen, as this is checked during hardware selection before already). * add some comments about features still unsupported by mainline Linux, where vendor Linux is used * fix `$TEST_KERNEL` handling, which was trying to remove still two downloaded packags, while only one is downloaded after we merged linux-dtb into linux-image * Install zstd on all Armbian base images. We cannot easily check whether the kernel supporrts it, but all that we support do, and if they don't, there needs to be an adjusted initramfs config anyway, to prevent initramfs-tools from compressing with zstd, as installing a well known compression tool must not cause a failing boot. If it does, this is better recognized on the fresh image, than some random time later, when the admin installs zstd for some reason. * for completeness, make clear Broadcom WiFi is Cypress is Infineon nowadays * dietpi-globals: G_AGP: fix removal of uninstalled packages from the command, after `--allow-change-held-packages` was removed * dietpi-set_hardware: consider hci_uart as Bluetooth module on NanoPi M5, as it is used by the official Xunlong M.2 WiFi/BT card
1 parent 9665e98 commit 2978f16

3 files changed

Lines changed: 29 additions & 25 deletions

File tree

.build/images/dietpi-installer

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,37 +1106,38 @@ _EOF_
11061106
fi
11071107

11081108
# Select kernel, device tree and U-Boot packages
1109-
local model='odroidn2' kernel='meson64' arch='arm64' branch='current'
1109+
local model='' kernel='' branch='current'
11101110
case $G_HW_MODEL in
1111-
10) model='odroidc1' kernel='meson' arch='arm';;
1112-
11) model='odroidxu4' kernel='odroidxu4' arch='arm';;
1113-
12) model='odroidc2';;
1114-
16) model='odroidc4';;
1115-
17) model='odroidhc4';;
1111+
10) model='odroidc1' kernel='meson';;
1112+
11) model='odroidxu4' kernel='odroidxu4';;
1113+
12) model='odroidc2' kernel='meson64';;
1114+
15) model='odroidn2' kernel='meson64';;
1115+
16) model='odroidc4' kernel='meson64';;
1116+
17) model='odroidhc4' kernel='meson64';;
11161117
40) model='pine64' kernel='sunxi64';;
11171118
42) model='rockpro64' kernel='rockchip64';;
11181119
43) model='rock64' kernel='rockchip64';;
11191120
44) model='pinebook-a64' kernel='sunxi64';;
11201121
45) model='pineh64-b' kernel='sunxi64';;
11211122
46) model='pinebook-pro' kernel='rockchip64';;
11221123
47) model='nanopi-r4s' kernel='rockchip64';;
1123-
48) model='nanopi-r1' kernel='sunxi' arch='arm';;
1124-
52) model='tinkerboard' kernel='rockchip' arch='arm';;
1125-
54) model='nanopik2-s905';;
1124+
48) model='nanopi-r1' kernel='sunxi';;
1125+
52) model='tinkerboard' kernel='rockchip';;
1126+
54) model='nanopik2-s905' kernel='meson64';;
11261127
55) model='nanopi-r2s' kernel='rockchip64';;
11271128
56) model='nanopineo3' kernel='rockchip64';;
11281129
57) model='nanopineoplus2' kernel='sunxi64';;
11291130
58) model='nanopim4v2' kernel='rockchip64';;
1130-
59) model='zeropi' kernel='sunxi' arch='arm';;
1131-
60) model='nanopineo' kernel='sunxi' arch='arm';;
1132-
63) model='nanopim1' kernel='sunxi' arch='arm';;
1133-
64) model='nanopiair' kernel='sunxi' arch='arm';;
1131+
59) model='zeropi' kernel='sunxi';;
1132+
60) model='nanopineo' kernel='sunxi';;
1133+
63) model='nanopim1' kernel='sunxi';;
1134+
64) model='nanopiair' kernel='sunxi';;
11341135
65) kernel='sunxi64'
11351136
case $HW_VARIANT in
11361137
2) model='nanopineo2black';;
11371138
*) model='nanopineo2';;
11381139
esac;;
1139-
66) model='nanopim1plus' kernel='sunxi' arch='arm';;
1140+
66) model='nanopim1plus' kernel='sunxi';;
11401141
67) model='nanopik1plus' kernel='sunxi64';;
11411142
68) kernel='rockchip64'
11421143
case $HW_VARIANT in
@@ -1174,21 +1175,21 @@ _EOF_
11741175
88) model='orangepizero2w' kernel='sunxi64';;
11751176
89) model='orangepi3-lts' kernel='sunxi64';;
11761177
90) model='radxa-zero3' kernel='rockchip64';;
1177-
91) model='orangepi5-max' kernel='rk35xx' branch='vendor';;
1178+
91) model='orangepi5-max' kernel='rk35xx' branch='vendor';; # mainline Linux dts does not support onboard WiFi, and brcmfmac probably does neither
11781179
92) model='nanopi-m6' kernel='rk35xx' branch='vendor';;
11791180
93) model='orangepi5pro' kernel='rk35xx' branch='vendor';;
1180-
94) model='orangepi5-ultra' kernel='rk35xx' branch='vendor';;
1181+
94) model='orangepi5-ultra' kernel='rk35xx' branch='vendor';; # mainline Linux dts does not support onboard WiFi, and brcmfmac probably does neither
11811182
95) model='orangepicm5' kernel='rk35xx' branch='vendor';;
11821183
96) model='orangepi-4a' kernel='sunxi64' branch='edge';;
11831184
99) model='orangepi3' kernel='sunxi64';;
11841185
100) model='nanopi-r3s' kernel='rockchip64';;
11851186
101) model='nanopi-r3s-lts' kernel='rockchip64';;
11861187
102) model='nanopi-r76s' kernel='rk35xx' branch='vendor';; # mainline U-Boot does not support eMMC boot, and vendor U-Boot does not support eMMC boot with mainline Linux either. It looks like U-Boot would (needs to) load the device tree from the eMMC Linux hardcoded path /boot/dtb/rockchip/rk3576-nanopi-r75s.dtb, and that needs to be from vendor kernel. Weird ...
1187-
103) model='nanopi-m5' kernel='rk35xx' branch='vendor';;
1188+
103) model='nanopi-m5' kernel='rk35xx' branch='vendor';; # mainline Linux does not support UFS and the upper USB port
11881189
104) model='nanopi-zero2' kernel='rk35xx' branch='vendor';;
11891190
105) model='orangepi4-lts' kernel='rockchip64';;
11901191
106) model='orangepi5b' kernel='rk35xx' branch='vendor';;
1191-
*) :;;
1192+
*) G_DIETPI-NOTIFY 1 "Unknown hardware ID \"$G_HW_MODEL\". Aborting ..."; exit 1;;
11921193
esac
11931194

11941195
# Override with mainline kernel if wanted
@@ -1247,7 +1248,7 @@ fi' /boot/boot.cmd
12471248
then
12481249
G_EXEC_OUTPUT=1 G_EXEC curl -fo package.deb "https://dietpi.com/downloads/binaries/testing/linux-image-$branch-$kernel.deb"
12491250
G_EXEC_OUTPUT=1 G_EXEC dpkg -i package.deb
1250-
G_EXEC rm package[12].deb
1251+
G_EXEC rm package.deb
12511252
fi
12521253

12531254
# Install testing U-Boot build if requested
@@ -1269,6 +1270,8 @@ fi' /boot/boot.cmd
12691270
[[ -f '/boot/uEnv.txt' ]] && G_EXEC rm /boot/uEnv.txt
12701271

12711272
# Compile U-Boot script
1273+
local arch='arm'
1274+
(( $G_HW_ARCH == 3 )) && arch='arm64'
12721275
[[ -f '/boot/boot.cmd' ]] && G_EXEC mkimage -C none -A "$arch" -T script -d /boot/boot.cmd /boot/boot.scr
12731276

12741277
# Flash U-Boot
@@ -1465,7 +1468,7 @@ _EOF_
14651468
done
14661469

14671470
# Add initramfs-tools and u-boot-tools, required to convert initramfs images into legacy U-Boot format
1468-
aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools' 'u-boot-tools')
1471+
aPACKAGES_REQUIRED_INSTALL+=('initramfs-tools' 'zstd' 'u-boot-tools')
14691472

14701473
# Generate and cleanup legacy uInitrd, still needed by Armbian boot.scr, which we do not touch here
14711474
local arch='arm'
@@ -1559,7 +1562,7 @@ _EOF_
15591562
if (( $WIFI_REQUIRED ))
15601563
then
15611564
aPACKAGES_REQUIRED_INSTALL+=('firmware-atheros') # Qualcomm Atheros WiFi
1562-
aPACKAGES_REQUIRED_INSTALL+=('firmware-brcm80211') # Broadcom WiFi
1565+
aPACKAGES_REQUIRED_INSTALL+=('firmware-brcm80211') # Broadcom/Cypress/Infineon WiFi
15631566
aPACKAGES_REQUIRED_INSTALL+=('firmware-iwlwifi') # Intel WiFi
15641567
# Trixie splits the free and misc packages:
15651568
# - https://packages.debian.org/trixie/firmware-linux-free
@@ -2184,8 +2187,8 @@ SUBSYSTEM=="net", KERNEL=="eth0", KERNELS=="0000:21:00.0", RUN:="/bin/true"
21842187
SUBSYSTEM=="net", KERNEL=="eth1", KERNELS=="0000:01:00.0", NAME="to_eth0", RUN:="/bin/true"
21852188
SUBSYSTEM=="net", KERNEL=="to_eth0", RUN="/bin/ip l s dev eth0 name eth1", RUN+="/bin/ip l s dev to_eth0 name eth0", RUN+="/bin/udevadm trigger -c add /sys/class/net/eth0 /sys/class/net/eth1"
21862189
_EOF_
2187-
# Orange Pi 5 Plus
2188-
elif (( $G_HW_MODEL == 82 ))
2190+
# Orange Pi 5 Plus with vendor kernel
2191+
elif [[ $G_HW_MODEL == 82 && $kernel == 'rk35xx' ]]
21892192
then
21902193
G_DIETPI-NOTIFY 2 'Assuring persistent classic Ethernet interface names: /etc/udev/rules.d/99-dietpi-orangepi5plus.rules'
21912194
cat << '_EOF_' > /etc/udev/rules.d/99-dietpi-orangepi5plus.rules

dietpi/func/dietpi-globals

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,9 +1580,9 @@ Press any key to continue...'
15801580
G_EXEC_PRE_FUNC()
15811581
{
15821582
local apackages=()
1583-
mapfile -t apackages < <(dpkg --get-selections "${acommand[@]:4}" 2> /dev/null | mawk '{print $1}')
1583+
mapfile -t apackages < <(dpkg --get-selections "${acommand[@]:3}" 2> /dev/null | mawk '{print $1}')
15841584
# shellcheck disable=SC2015
1585-
[[ ${apackages[0]} ]] && acommand=("${acommand[@]::4}" "${apackages[@]}") || acommand=(G_DIETPI-NOTIFY 2 'None of the packages are currently installed. Aborting...')
1585+
[[ ${apackages[0]} ]] && acommand=("${acommand[@]::3}" "${apackages[@]}") || acommand=(G_DIETPI-NOTIFY 2 'None of the packages are currently installed. Aborting...')
15861586
}
15871587

15881588
G_EXEC_DESC="\e[0mAPT purge \e[33m$*\e[0m"

dietpi/func/dietpi-set_hardware

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,7 @@ _EOF_
11571157

11581158
case $G_HW_MODEL in
11591159
[0-9]) (( $G_HW_ONBOARD_WIFI )) && aBLUETOOTH_MODULES+=('hci_uart');; # RPi. This kernel module is used by other SBCs, but e.g. on ROCK 4 SE it is needed as well for WiFi: https://github.com/MichaIng/DietPi/issues/6943
1160+
103) aBLUETOOTH_MODULES+=('hci_uart');; # NanoPi M5 official M.2 WiFi card
11601161
83|88|89|99|105) aBLUETOOTH_MODULES+=('sprdbt_tty');; # Orange Pi Zero 3/Zero 2W/3 LTS/3/4 LTS
11611162
87) [[ $G_HW_REVISION == '1.1' ]] && aBLUETOOTH_MODULES+=('sprdbt_tty');; # Orange Pi 3B v1.1
11621163
*) :;;

0 commit comments

Comments
 (0)