From 5d85ddc80017474cb4c3f764ef22151c0e094837 Mon Sep 17 00:00:00 2001 From: MichaIng Date: Sat, 30 Mar 2024 15:42:15 +0100 Subject: [PATCH] v9.4 - Image | Add support for Orange Pi Zero 2W --- .build/images/dietpi-build | 1 + .build/images/dietpi-installer | 40 ++++++++++++++---------------- .meta/dietpi-survey_report | 1 + CHANGELOG.txt | 3 +++ dietpi/dietpi-config | 4 +-- dietpi/func/dietpi-obtain_hw_model | 7 +++++- dietpi/func/dietpi-set_hardware | 18 +++++++------- 7 files changed, 41 insertions(+), 33 deletions(-) diff --git a/.build/images/dietpi-build b/.build/images/dietpi-build index 2464c916d4..8a1f9080dd 100755 --- a/.build/images/dietpi-build +++ b/.build/images/dietpi-build @@ -141,6 +141,7 @@ case $HW_MODEL in 85) iname='ROCK5A' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; 86) iname='ASUSTB2' HW_ARCH=3 partition_start=16 root_size=1008;; 87) iname='OrangePi3B' HW_ARCH=3 PTTYPE='gpt' partition_start=16 root_size=1008;; + 88) iname='OrangePiZero2W' HW_ARCH=3 partition_start=4 root_size=1148;; *) G_DIETPI-NOTIFY 1 "Invalid hardware model \"$HW_MODEL\" passed, aborting..."; exit 1;; esac diff --git a/.build/images/dietpi-installer b/.build/images/dietpi-installer index 018f0bdfda..9fc4ac8fec 100755 --- a/.build/images/dietpi-installer +++ b/.build/images/dietpi-installer @@ -422,6 +422,7 @@ _EOF_ '82' ': Orange Pi 5 Plus' '83.1' ': Orange Pi Zero 3' '83.2' ': Orange Pi Zero 3 (1.5 GB RAM)' + '88' ': Orange Pi Zero 2W' '86' ': ASUS Tinker Board 2' '23' ': Generic Rockchip RK3328' '24' ': Generic Rockchip RK3399' @@ -618,7 +619,7 @@ _EOF_ G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/99-dietpi-uboot" /etc/initramfs/post-update.d/99-dietpi-uboot G_EXEC sed --follow-symlinks -i 's/arm64/arm/' /etc/initramfs/post-update.d/99-dietpi-uboot - elif [[ $G_HW_MODEL =~ ^(12|15|16|40|42|43|44|45|46|47|48|52|54|55|56|57|58|59|60|62|63|64|65|66|67|68|72|73|74|76|77|78|79|80|82|83|85|86|87)$ ]] + elif [[ $G_HW_MODEL =~ ^(12|15|16|40|42|43|44|45|46|47|48|52|54|55|56|57|58|59|60|62|63|64|65|66|67|68|72|73|74|76|77|78|79|80|82|83|85|86|87|88)$ ]] then armbian_repo=1 G_EXEC mv "DietPi-$G_GITBRANCH/.build/images/U-Boot/boot.cmd" /boot/boot.cmd @@ -705,7 +706,7 @@ setenv rootuuid "true"' /boot/boot.cmd G_EXEC sed --follow-symlinks -i -e 's/ttyAML0/ttyS2/' -e '/^extraargs=/s/$/ systemd.unified_cgroup_hierarchy=0/' /boot/dietpiEnv.txt # Allwinner 64-bit - elif [[ $G_HW_MODEL =~ ^(40|44|45|57|65|67|83)$ ]] + elif [[ $G_HW_MODEL =~ ^(40|44|45|57|65|67|83|88)$ ]] then G_EXEC sed --follow-symlinks -Ei '/^setenv (kernel|fdt)_addr_r/d' /boot/boot.cmd G_CONFIG_INJECT 'setenv scriptaddr ' 'setenv scriptaddr "0x45000000"' /boot/boot.cmd @@ -718,9 +719,10 @@ setenv rootuuid "true"' /boot/boot.cmd 40|44) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=sun50i-a64' /boot/dietpiEnv.txt;; 45) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=sun50i-h6' /boot/dietpiEnv.txt;; 57|65|67) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=sun50i-h5' /boot/dietpiEnv.txt;; - 83) + 83|88) G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=sun50i-h616' /boot/dietpiEnv.txt - (( $HW_VARIANT == 2 )) && G_CONFIG_INJECT 'fdtfile=' 'fdtfile=allwinner/sun50i-h618-orangepi-zero3.dtb' /boot/dietpiEnv.txt + (( $G_HW_MODEL == 83 && $HW_VARIANT == 2 )) && G_CONFIG_INJECT 'fdtfile=' 'fdtfile=allwinner/sun50i-h618-orangepi-zero3.dtb' /boot/dietpiEnv.txt + (( $G_HW_MODEL == 88 )) && G_CONFIG_INJECT 'fdtfile=' 'fdtfile=allwinner/sun50i-h618-orangepi-zero2w.dtb' /boot/dietpiEnv.txt ;; *) :;; esac @@ -995,7 +997,7 @@ setenv rootuuid "true"' /boot/boot.cmd fi # Skip creating kernel symlinks and remove existing ones - G_DIETPI-NOTIFY 2 'Preventing obsolete kernel and initramfs symlink generation' + G_DIETPI-NOTIFY 2 'Preventing needless kernel and initramfs symlink generation' G_EXEC eval 'echo '\''do_symlinks=0'\'' > /etc/kernel-img.conf' G_EXEC rm -f /{,boot/}{initrd.img,vmlinuz}{,.old} @@ -1108,6 +1110,7 @@ _EOF_ 85) model='rock-5a' kernel='rk35xx' branch='legacy';; 86) model='tinkerboard-2' kernel='rockchip64';; 87) model='orangepi3b' kernel='rockchip64' branch='edge';; + 88) model='orangepizero2w' kernel='sunxi64';; *) :;; esac @@ -1143,13 +1146,13 @@ _EOF_ G_AGI initramfs-tools u-boot-tools armbian-firmware "${zstd[@]}" [[ ${zstd[0]} ]] && G_CONFIG_INJECT 'COMPRESS=' 'COMPRESS=zstd' /etc/initramfs-tools/initramfs.conf # Download and pre-install kernel hosted on dietpi.com where the Armbian APT repo provides a too old version - if (( $G_HW_MODEL == 83 )) + if (( $G_HW_MODEL == 88 )) then G_EXEC_OUTPUT=1 G_EXEC curl -fo package1.deb "https://dietpi.com/downloads/binaries/linux-image-$branch-$kernel.deb" G_EXEC_OUTPUT=1 G_EXEC curl -fo package2.deb "https://dietpi.com/downloads/binaries/linux-dtb-$branch-$kernel.deb" G_EXEC_OUTPUT=1 G_EXEC curl -fo package3.deb 'https://dietpi.com/downloads/binaries/armbian-firmware.deb' local uboot=() - #(( $G_HW_MODEL == 83 )) && (( $HW_VARIANT == 1 )) && { G_EXEC_OUTPUT=1 G_EXEC curl -fo package4.deb "https://dietpi.com/downloads/binaries/linux-u-boot-$model-$branch.deb"; uboot=('package4.deb'); } + (( $G_HW_MODEL == 88 )) && { G_EXEC_OUTPUT=1 G_EXEC curl -fo package4.deb "https://dietpi.com/downloads/binaries/linux-u-boot-$model-$branch.deb"; uboot=('package4.deb'); } G_EXEC_OUTPUT=1 G_EXEC dpkg -i package1.deb package2.deb package3.deb "${uboot[@]}" G_EXEC rm package1.deb package2.deb package3.deb "${uboot[@]}" fi @@ -1225,7 +1228,7 @@ _EOF_ # Skip creating kernel symlinks and remove existing ones if [[ -L '/vmlinuz' ]] then - G_DIETPI-NOTIFY 2 'Preventing obsolete kernel and initramfs symlink generation' + G_DIETPI-NOTIFY 2 'Preventing needless kernel and initramfs symlink generation' G_EXEC eval 'echo '\''do_symlinks=0'\'' > /etc/kernel-img.conf' G_EXEC rm -f /{initrd.img,vmlinuz}{,.old} fi @@ -1238,6 +1241,9 @@ _EOF_ (( $G_HW_ARCH == 3 )) || a32bit=('raspi-copies-and-fills') if findmnt -M /boot/firmware &> /dev/null then + G_DIETPI-NOTIFY 2 'Preventing needless kernel and initramfs symlink generation' + G_EXEC eval 'echo '\''do_symlinks=0'\'' > /etc/kernel-img.conf' + G_EXEC rm -f /{initrd.img,vmlinuz}{,.old} local kernel=() case $G_HW_MODEL in 0) @@ -1278,14 +1284,6 @@ _EOF_ [[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg [[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~' - # Skip creating kernel symlinks and remove existing ones - if [[ -L '/vmlinuz' ]] - then - G_DIETPI-NOTIFY 2 'Preventing obsolete kernel and initramfs symlink generation' - G_EXEC eval 'echo '\''do_symlinks=0'\'' > /etc/kernel-img.conf' - G_EXEC rm -f /{initrd.img,vmlinuz}{,.old} - fi - # Quartz64 elif [[ $G_HW_MODEL == 49 && $(findmnt -Ufnro TARGET -T /boot) == '/' ]] then @@ -1422,7 +1420,7 @@ _EOF_ # Skip creating kernel symlinks and remove existing ones if [[ -L '/vmlinuz' ]] then - G_DIETPI-NOTIFY 2 'Preventing obsolete kernel and initramfs symlink generation' + G_DIETPI-NOTIFY 2 'Preventing needless kernel and initramfs symlink generation' G_EXEC eval 'echo '\''do_symlinks=0'\'' > /etc/kernel-img.conf' G_EXEC rm -f /{initrd.img,vmlinuz}{,.old} fi @@ -1942,8 +1940,8 @@ _EOF_' then /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyS2 - # PINE A64, Pinebook, PINE H64, NenoPi NEO Plus2, ZeroPi, NanoPi NEO, NanoPi M1, NanoPi NEO Air, NenoPi NEO2, NanoPi M1 Plus, NanoPi K1 Plus, ROCK Pi S, VisionFive 2, Orange Pi Zero 3, Star64 - elif [[ $G_HW_MODEL =~ ^(40|44|45|57|59|60|63|64|65|66|67|73|81|83|84)$ ]] + # PINE A64, Pinebook, PINE H64, NenoPi NEO Plus2, ZeroPi, NanoPi NEO, NanoPi M1, NanoPi NEO Air, NenoPi NEO2, NanoPi M1 Plus, NanoPi K1 Plus, ROCK Pi S, VisionFive 2, Orange Pi Zero 3, Star64, Orange Pi Zero 2W + elif [[ $G_HW_MODEL =~ ^(40|44|45|57|59|60|63|64|65|66|67|73|81|83|84|88)$ ]] then /boot/dietpi/func/dietpi-set_hardware serialconsole enable ttyS0 @@ -2164,8 +2162,8 @@ SUBSYSTEM=="leds", KERNEL=="wan_led", ACTION=="add", ATTR{trigger}="netdev", ATT SUBSYSTEM=="leds", KERNEL=="lan1_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="eth1", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev eth1", RUN+="/bin/ip l s down dev eth1" SUBSYSTEM=="leds", KERNEL=="user_led", ACTION=="add", ATTR{trigger}="netdev", ATTR{device_name}="wlan0", ATTR{link}="1", ATTR{rx}="1", ATTR{tx}="1", RUN+="/bin/ip l s up dev wlan0", RUN+="/bin/ip l s down dev wlan0" _EOF_ - # Orange Pi 3B/Zero 3: Module does not load automatically, but we want it loaded on first boot in case firstrun setup is done via WiFi - elif [[ $G_HW_MODEL =~ ^(83|87)$ ]] + # Orange Pi 3B/Zero 3/Zero 2W: Module does not load automatically, but we want it loaded on first boot in case firstrun setup is done via WiFi + elif [[ $G_HW_MODEL =~ ^(83|87|88)$ ]] then G_EXEC eval 'echo '\''sprdwl_ng'\'' > /etc/modules-load.d/dietpi-enable_wifi.conf' fi diff --git a/.meta/dietpi-survey_report b/.meta/dietpi-survey_report index 367bbc9790..abfe2cb1b6 100755 --- a/.meta/dietpi-survey_report +++ b/.meta/dietpi-survey_report @@ -92,6 +92,7 @@ shopt -s extglob [85]='ROCK 5A' [86]='ASUS Tinker Board 2' [87]='Orange Pi 3B' + [88]='Orange Pi Zero 2W' ) ## Benchmark data arrays: aBENCH_XX[$HW_MODEL,${aBENCH_XX_INDEX[$HW_MODEL]}] diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7d3093b4fb..67635c5c9e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,6 +1,9 @@ v9.4 (2024-05-12) +New images: +- Orange Pi Zero 2W | Support for this small form factor SBC with Allwinner H618 SoC was added. + Enhancements: - General | Our scripts do now internally enforce the default umask 0022. Many config and install options rely on this, hence it can cause issues when e.g. 0027 (deny read access for "other" users) has been applied on the parent shell. This affects only the (sub)shell of our scripts, while the current and default umask of parent and of shells/consoles remains untouched. - NanoPi R5C | New images, or when flashing the new bootloader binary via dietpi-config > Advanced Options > Update MMC bootloader, support M.2 WiFi modules. diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 258900fff6..35e9c1bb13 100755 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -1094,8 +1094,8 @@ Re-enabling HDMI requires a reboot. If you need emergency HDMI output, edit the [[ -f '/etc/modprobe.d/dietpi-disable_bluetooth.conf' ]] && bluetooth_state=0 bluetooth_state_text='Off' G_WHIP_MENU_ARRAY+=('Bluetooth' ": [$bluetooth_state_text]") - # Orange Pi Zero 3 specific - if (( $G_HW_MODEL == 83 )) + # Orange Pi Zero 3/Zero 2W specific + if (( $G_HW_MODEL == 83 || $G_HW_MODEL == 88 )) then # SPI state local spi_enabled=$(grep -Ecm1 '^[[:blank:]]*overlays=(.*[[:blank:]])?spi1-cs1-spidev([[:blank:]]|$)' /boot/dietpiEnv.txt) diff --git a/dietpi/func/dietpi-obtain_hw_model b/dietpi/func/dietpi-obtain_hw_model index 9a0c8748ef..3a1bc92ecb 100755 --- a/dietpi/func/dietpi-obtain_hw_model +++ b/dietpi/func/dietpi-obtain_hw_model @@ -12,6 +12,7 @@ # - Generates /boot/dietpi/.hw_model # - Called from /boot/dietpi/preboot, called by /etc/systemd/system/dietpi-preboot.service # + # G_HW_MODEL 88 Orange Pi Zero 2W # G_HW_MODEL 87 Orange Pi 3B # G_HW_MODEL 86 ASUS Tinker Board 2 # G_HW_MODEL 85 ROCK 5A @@ -316,7 +317,11 @@ G_HW_MODEL=$(mawk 'NR==1' "$FP_G_HW_MODEL_IDENTIFIER") - if (( $G_HW_MODEL == 87 )); then + if (( $G_HW_MODEL == 88 )); then + + G_HW_MODEL_NAME='Orange Pi Zero 2W' + + elif (( $G_HW_MODEL == 87 )); then G_HW_MODEL_NAME='Orange Pi 3B' G_HW_CPUID=9 diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index 0108f1d727..51437a2925 100755 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -1113,8 +1113,8 @@ _EOF_ Unknown_Input_Mode fi - # Orange Pi Zero 3 - elif (( $G_HW_MODEL == 83 )) + # Orange Pi Zero 3/Zero 2W + elif (( $G_HW_MODEL == 83 || $G_HW_MODEL == 88 )) then if [[ $INPUT_DEVICE_VALUE == 'enable' ]] then @@ -1149,7 +1149,7 @@ _EOF_ 'hci_uart' ) - [[ $G_HW_MODEL =~ ^(83|87)$ ]] && aBLUETOOTH_MODULES+=('sprdbt_tty') # Orange Pi 3B/Zero 3 + [[ $G_HW_MODEL =~ ^(83|87|88)$ ]] && aBLUETOOTH_MODULES+=('sprdbt_tty') # Orange Pi 3B/Zero 3/Zero 2W if [[ $INPUT_DEVICE_VALUE == 'disable' ]]; then @@ -1245,8 +1245,8 @@ Do you want to continue and disable the serial login console?' || return 1 then (( $G_HW_ONBOARD_WIFI )) && G_EXEC systemctl enable hciuart - # Orange Pi 3B/Zero 3: Module does not load automatically - elif [[ $G_HW_MODEL =~ ^(83|87)$ ]] + # Orange Pi 3B/Zero 3/Zero 2W: Module does not load automatically + elif [[ $G_HW_MODEL =~ ^(83|87|88)$ ]] then modprobe -n sprdbt_tty 2> /dev/null && G_EXEC eval 'echo '\''sprdbt_tty'\'' > /etc/modules-load.d/dietpi-enable_bluetooth.conf' fi @@ -1341,8 +1341,8 @@ Do you want to continue and disable the serial login console?' || return 1 then aWIFI_MODULES+=('bcmdhd') - # + Orange Pi 3B/Zero 3 - elif [[ $G_HW_MODEL =~ ^(83|87)$ ]] + # + Orange Pi 3B/Zero 3/Zero 2W + elif [[ $G_HW_MODEL =~ ^(83|87|88)$ ]] then aWIFI_MODULES+=('sprdwl_ng') fi @@ -1388,8 +1388,8 @@ Do you want to continue and disable the serial login console?' || return 1 then G_EXEC eval 'echo -e '\''options wlan_8192eu rtw_power_mgnt=0\noptions wlan_8812au rtw_power_mgnt=0'\'' > /etc/modprobe.d/dietpi-disable_wifi_powersaving.conf' - # - Orange Pi 3B/Zero 3: Module does not load automatically - elif [[ $G_HW_MODEL =~ ^(83|87)$ ]] + # - Orange Pi 3B/Zero 3/Zero 2W: Module does not load automatically + elif [[ $G_HW_MODEL =~ ^(83|87|88)$ ]] then modprobe -n sprdwl_ng 2> /dev/null && G_EXEC eval 'echo '\''sprdwl_ng'\'' > /etc/modules-load.d/dietpi-enable_wifi.conf' fi