Skip to content

Commit

Permalink
v9.4
Browse files Browse the repository at this point in the history
- Image | Add support for Orange Pi Zero 2W
  • Loading branch information
MichaIng committed Apr 20, 2024
1 parent b41a92c commit 5d85ddc
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 33 deletions.
1 change: 1 addition & 0 deletions .build/images/dietpi-build
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
40 changes: 19 additions & 21 deletions .build/images/dietpi-installer
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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}

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .meta/dietpi-survey_report
Original file line number Diff line number Diff line change
Expand Up @@ -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]}]
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 2 additions & 2 deletions dietpi/dietpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion dietpi/func/dietpi-obtain_hw_model
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions dietpi/func/dietpi-set_hardware
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5d85ddc

Please sign in to comment.