Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radxa Zero | Add initial support with hardware ID 74 #4900

Merged
merged 6 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .meta/dietpi-survey_report
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ shopt -s extglob
[71]='BeagleBone Black'
[72]='ROCK Pi 4'
[73]='ROCK Pi S'
[74]='Radxa Zero'
)

## 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 @@
v7.8
(2021-10-13)

New SBC support:
- Radxa Zero | Initial support for this Raspberry Pi Zero form factored (but way more powerful) SBC has been added to DietPi with the hardware ID 74. Many thanks to @almirus and @dhry for helping with testing and debugging an early image: https://github.com/MichaIng/DietPi/issues/4831

Removed software:
- Subsonic | Since it is not developed anymore and due to shared library dependencies only compatible with Debian Stretch, we removed Subsonic from DietPi-Software. With Airsonic-Advanced, we'll provide a well maintained and Bullseye-compatible alternative. If you currently have Subsonic installed, it will remain. If you want to uninstall it, follow the instructions here: https://github.com/MichaIng/DietPi/pull/4895
- emonHub | Since we do not have a single reported installation, we removed emonHub from DietPi-Software. If you currently have emonHub installed, it will remain. If you want to keep using and updating it, have a look at the official repository: https://github.com/openenergymonitor/emonhub. If you want to uninstall it, follow the instructions here: https://github.com/MichaIng/DietPi/pull/4895
Expand Down
41 changes: 39 additions & 2 deletions PREP_SYSTEM_FOR_DIETPI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ _EOF_
'47' ': NanoPi R4S'
'72' ': ROCK Pi 4'
'73' ': ROCK Pi S'
'74' ': Radxa Zero'
'' '●─ x86_64 '
'21' ': x86_64 Native PC'
'20' ': x86_64 Virtual Machine'
Expand Down Expand Up @@ -721,7 +722,7 @@ Currently installed: $G_DISTRO_NAME (ID: $G_DISTRO)"; then

fi
# - Entropy daemon: Use modern rng-tools5 on all devices where it has been proven to work, else haveged: https://github.com/MichaIng/DietPi/issues/2806
if [[ $G_HW_MODEL -lt 10 || $G_HW_MODEL =~ ^(14|15|16|24|29|42|46|58|68|72)$ ]]; then # RPi, S922X, Odroid C4, RK3399 - 47 NanoPi R4S
if [[ $G_HW_MODEL -lt 10 || $G_HW_MODEL =~ ^(14|15|16|24|29|42|46|58|68|72|74)$ ]]; then # RPi, S922X, Odroid C4, RK3399 - 47 NanoPi R4S, Radxa Zero

aPACKAGES_REQUIRED_INSTALL+=('rng-tools5')

Expand Down Expand Up @@ -995,6 +996,25 @@ _EOF_
# NB: rockpis-dtbo is not required as it doubles the overlays that are already provided (among others) with the kernel package
G_AGI rockpis-rk-ubootimg linux-4.4-rock-pi-s-latest rockchip-overlay u-boot-tools

# Radxa Zero (official Radxa Debian image)
elif (( $G_HW_MODEL == 74 )) && grep -q 'apt\.radxa\.com' /etc/apt/sources.list.d/*.list; then

# Install Radxa APT repo cleanly: No Bullseye repo available yet
G_EXEC rm -Rf /etc/apt/{trusted.gpg,sources.list.d/{,.??,.[^.]}*}
G_EXEC eval "curl -sSfL https://apt.radxa.com/${DISTRO_TARGET_NAME/bullseye/buster}-stable/public.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/dietpi-radxa.gpg --yes"
G_EXEC eval "echo -e 'deb https://apt.radxa.com/${DISTRO_TARGET_NAME/bullseye/buster}-stable/ ${DISTRO_TARGET_NAME/bullseye/buster} main\n#deb https://apt.radxa.com/${DISTRO_TARGET_NAME/bullseye/buster}-testing/ ${DISTRO_TARGET_NAME/bullseye/buster} main' > /etc/apt/sources.list.d/dietpi-radxa.list"
G_AGUP

# Remove obsolete combined keyring
[[ -f '/etc/apt/trusted.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg
[[ -f '/etc/apt/trusted.gpg~' ]] && G_EXEC rm '/etc/apt/trusted.gpg~'

# Preserve all installed kernel, device tree and bootloader packages, until fixed meta packages are available: https://github.com/radxa/apt
# Additionally install bc, required to calculate the initramfs size via custom hook (by Radxa) which updates /boot/uEnv.txt accordingly on initramfs updates
# And install "file" which is used to detect whether the kernel image is compressed and in case uncompress it
# shellcheck disable=SC2046
G_AGI $(dpkg-query -Wf '${Package}\n' | grep -E '^linux-(image|dtb|u-boot)-|^u-boot') bc file

# - Generic kernel + device tree + U-Boot package auto detect
else

Expand All @@ -1018,7 +1038,9 @@ _EOF_

aPACKAGES_REQUIRED_INSTALL+=('armbian-firmware')

else
# - Do not install additional firmware on Radxa Zero for now
elif [[ $G_HW_MODEL != 74 ]]
then

# Usually no firmware should be necessary for VMs. If user manually passes though some USB device, user might need to install the firmware then.
if (( $G_HW_MODEL != 20 )); then
Expand Down Expand Up @@ -1745,6 +1767,21 @@ _EOF_
# Ensure WiFi module pre-exists
G_CONFIG_INJECT '8723bs' '8723bs' /etc/modules

# - Radxa Zero
elif (( $G_HW_MODEL == 74 ))
then
# Use ondemand CPU governor since schedutil currently causes kernel errors and hangs
G_CONFIG_INJECT 'CONFIG_CPU_GOVERNOR=' 'CONFIG_CPU_GOVERNOR=ondemand' /boot/dietpi.txt

# uEnv.txt version (Radxa Debian image)
if [[ -d '/boot/uEnv.txt' ]]
then
# Reduce console log verbosity to default 4 to mute regular USB detection info messages
G_CONFIG_INJECT 'verbosity=' 'verbosity=4' /boot/uEnv.txt

# Disable Docker optimisations, since this has some performance drawbacks, enable on Docker install instead
G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=off' /boot/uEnv.txt
fi
fi

# - Armbian special
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ Links to hardware and software manufacturers, sources and build instructions use
- [Sparky](https://github.com/sparkysbc?tab=repositories) [SBC](https://github.com/sparky-sbc/sparky-test)
- [PINE64](https://www.pine64.org/)
- [FriendlyARM](https://github.com/friendlyarm?tab=repositories)
- [Radxa](https://github.com/radxa/apt)
- [Armbian](https://github.com/armbian)
- [curl](https://github.com/curl/curl)
- [vmtouch](https://github.com/hoytech/vmtouch)
Expand Down
116 changes: 62 additions & 54 deletions dietpi/dietpi-software
Original file line number Diff line number Diff line change
Expand Up @@ -7255,9 +7255,18 @@ _EOF_
G_EXEC_NOHALT=1 G_EXEC rm install.sh

# Do not enter into a server restart loop on failure
[[ -d '/etc/systemd/system/k3s.service.d' ]] || G_EXEC mkdir -p /etc/systemd/system/k3s.service.d
[[ -d '/etc/systemd/system/k3s.service.d' ]] || G_EXEC mkdir /etc/systemd/system/k3s.service.d
echo -e '[Service]\nRestart=on-success' > /etc/systemd/system/k3s.service.d/dietpi.conf

# Enable cgroups used by Docker and alike
if [[ -f '/boot/boot.cmd' ]] && grep -q 'docker_optimizations' /boot/boot.cmd
then
# Armbian
[[ -f '/boot/armbianEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/armbianEnv.txt
# Radxa Zero
[[ -f '/boot/uEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/uEnv.txt
fi

fi

software_id=141 # Spotify Connect Web
Expand Down Expand Up @@ -7836,6 +7845,42 @@ If you want to update ${aSOFTWARE_NAME[$software_id]}, please use its internal u
# APT package
G_AGI docker-ce

# Change Docker service type to "simple": https://github.com/MichaIng/DietPi/issues/2238#issuecomment-439474766
[[ -d '/lib/systemd/system/docker.service.d' ]] || G_EXEC mkdir /lib/systemd/system/docker.service.d
G_EXEC eval "echo -e '[Service]\nType=simple' > /lib/systemd/system/docker.service.d/dietpi-simple.conf"

# Config: https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
# - Move Docker containers to dietpi_userdata
# - Log to systemd-journald (journalctl) by default with reduced log level: https://github.com/MichaIng/DietPi/issues/2388
# + containerd: https://github.com/docker/docker.github.io/issues/9091
[[ -d '/mnt/dietpi_userdata/docker-data' ]] || G_EXEC mkdir /mnt/dietpi_userdata/docker-data
if [[ -f '/etc/docker/daemon.json' ]]
then
GCI_PRESERVE=1 G_CONFIG_INJECT '"data-root":' ' "data-root": "/mnt/dietpi_userdata/docker-data",' /etc/docker/daemon.json '^\{([[:space:]]|$)'
GCI_PRESERVE=1 G_CONFIG_INJECT '"log-driver":' ' "log-driver": "journald",' /etc/docker/daemon.json '^\{([[:space:]]|$)'
GCI_PRESERVE=1 G_CONFIG_INJECT '"log-level":' ' "log-level": "warn",' /etc/docker/daemon.json '^\{([[:space:]]|$)'
GCI_PRESERVE=1 G_CONFIG_INJECT '"debug":' ' "debug": false,' /etc/docker/daemon.json '^\{([[:space:]]|$)'
else
[[ -d '/etc/docker' ]] || G_EXEC mkdir /etc/docker
echo '{
"data-root": "/mnt/dietpi_userdata/docker-data",
"log-driver": "journald",
"log-level": "warn",
"debug": false
}' > /etc/docker/daemon.json
fi
G_CONFIG_INJECT '\[debug\]' '[debug]' /etc/containerd/config.toml
GCI_PRESERVE=1 G_CONFIG_INJECT 'level[[:blank:]]*=' ' level = "warn"' /etc/containerd/config.toml '^\[debug\]'

# Enable cgroups used by Docker and alike
if [[ -f '/boot/boot.cmd' ]] && grep -q 'docker_optimizations' /boot/boot.cmd
then
# Armbian
[[ -f '/boot/armbianEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/armbianEnv.txt
# Radxa Zero
[[ -f '/boot/uEnv.txt' ]] && G_CONFIG_INJECT 'docker_optimizations=' 'docker_optimizations=on' /boot/uEnv.txt
fi

fi

software_id=134 # Docker Compose
Expand Down Expand Up @@ -13069,43 +13114,6 @@ MINIO_VOLUMES="/mnt/dietpi_userdata/minio-data"
_EOF_
fi

software_id=162 # Docker
if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then

Banner_Configuration

# Set Docker service to "simple": https://github.com/MichaIng/DietPi/issues/2238#issuecomment-439474766
G_EXEC mkdir -p /lib/systemd/system/docker.service.d
echo -e '[Service]\nType=simple' > /lib/systemd/system/docker.service.d/dietpi-simple.conf

# Config: https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file
# - Move Docker containers to dietpi_userdata
# - Log to systemd-journald (journalctl) by default with reduced log level: https://github.com/MichaIng/DietPi/issues/2388
# + containerd: https://github.com/docker/docker.github.io/issues/9091
G_CONFIG_INJECT '\[debug\]' '[debug]' /etc/containerd/config.toml
GCI_PRESERVE=1 G_CONFIG_INJECT 'level[[:blank:]]*=' ' level = "warn"' /etc/containerd/config.toml '^\[debug\]'
G_EXEC mkdir -p /mnt/dietpi_userdata/docker-data
if [[ -f '/etc/docker/daemon.json' ]]; then

GCI_PRESERVE=1 G_CONFIG_INJECT '"data-root":' ' "data-root": "/mnt/dietpi_userdata/docker-data",' /etc/docker/daemon.json '^\{([[:space:]]|$)'
GCI_PRESERVE=1 G_CONFIG_INJECT '"log-driver":' ' "log-driver": "journald",' /etc/docker/daemon.json '^\{([[:space:]]|$)'
GCI_PRESERVE=1 G_CONFIG_INJECT '"log-level":' ' "log-level": "warn",' /etc/docker/daemon.json '^\{([[:space:]]|$)'
GCI_PRESERVE=1 G_CONFIG_INJECT '"debug":' ' "debug": false,' /etc/docker/daemon.json '^\{([[:space:]]|$)'

else

G_EXEC mkdir -p /etc/docker
echo '{
"data-root": "/mnt/dietpi_userdata/docker-data",
"log-driver": "journald",
"log-level": "warn",
"debug": false
}' > /etc/docker/daemon.json

fi

fi

software_id=185 # Portainer
if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then

Expand Down Expand Up @@ -15661,19 +15669,19 @@ _EOF_

Banner_Uninstalling

# Remove docker, all its unused dependencies and custom repository
# Packages, repo and key
G_AGP docker-ce docker-ce-cli docker-engine
[[ -f '/etc/apt/sources.list.d/docker.list' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /etc/apt/sources.list.d/docker.list
[[ -f '/etc/apt/trusted.gpg.d/dietpi-docker.gpg' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-docker.gpg

# Remove service adjustments
[[ -d '/lib/systemd/system/docker.service.d' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /lib/systemd/system/docker.service.d
# Delete data files - dietpi
[[ -d '/mnt/dietpi_userdata/docker-data' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /mnt/dietpi_userdata/docker-data
# Remove default unused folder
[[ -d '/var/lib/docker' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /var/lib/docker
# Remove configuration file
[[ -d '/etc/docker' ]] && G_EXEC_NOEXIT=1 G_EXEC rm -R /etc/docker
[[ -f '/etc/apt/sources.list.d/docker.list' ]] && G_EXEC rm /etc/apt/sources.list.d/docker.list
[[ -f '/etc/apt/trusted.gpg.d/dietpi-docker.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-docker.gpg

# Service adjustments
[[ -d '/lib/systemd/system/docker.service.d' ]] && G_EXEC rm -R /lib/systemd/system/docker.service.d
# DietPi data dir
[[ -d '/mnt/dietpi_userdata/docker-data' ]] && G_EXEC rm -R /mnt/dietpi_userdata/docker-data
# Default data dir
[[ -d '/var/lib/docker' ]] && G_EXEC rm -R /var/lib/docker
# Config dir
[[ -d '/etc/docker' ]] && G_EXEC rm -R /etc/docker

# Set Portainer as not installed
aSOFTWARE_INSTALL_STATE[185]=0
Expand All @@ -15686,10 +15694,10 @@ _EOF_
Banner_Uninstalling

G_AGP codium
[[ -f '/etc/apt/sources.list.d/dietpi-vscodium.list' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /etc/apt/sources.list.d/dietpi-vscodium.list
[[ -f '/etc/apt/trusted.gpg.d/dietpi-vscodium.gpg' ]] && G_EXEC_NOEXIT=1 G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-vscodium.gpg
rm -f /{usr/share/applications,{root,home/*}/Desktop}/codium.desktop
rm -Rf /{root,home/*}/{.config/VSCodium,.vscode-oss}
[[ -f '/etc/apt/sources.list.d/dietpi-vscodium.list' ]] && G_EXEC rm /etc/apt/sources.list.d/dietpi-vscodium.list
[[ -f '/etc/apt/trusted.gpg.d/dietpi-vscodium.gpg' ]] && G_EXEC rm /etc/apt/trusted.gpg.d/dietpi-vscodium.gpg
G_EXEC rm -f /{usr/share/applications,{root,home/*}/Desktop}/codium.desktop
G_EXEC rm -Rf /{root,home/*}/{.config/VSCodium,.vscode-oss}

fi

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 @@ -17,6 +17,7 @@
# - MAX_G_HW_ARCH=10
# - MAX_G_DISTRO=7
#
# G_HW_MODEL 74 Radxa Zero
# G_HW_MODEL 73 ROCK Pi S
# G_HW_MODEL 72 ROCK Pi 4
# G_HW_MODEL 70 Sparky SBC
Expand Down Expand Up @@ -304,7 +305,11 @@

G_HW_MODEL=$(mawk 'NR==1' $FP_G_HW_MODEL_IDENTIFIER)

if (( $G_HW_MODEL == 73 )); then
if (( $G_HW_MODEL == 74 )); then

G_HW_MODEL_NAME='Radxa Zero'

elif (( $G_HW_MODEL == 73 )); then

G_HW_MODEL_NAME='ROCK Pi S'

Expand Down