55 lines
1.2 KiB
Markdown
55 lines
1.2 KiB
Markdown
---
|
|
page-title: "Small ODROID-XU4 (HC1) scripts ($2059139) · Snippets · Snippets · GitLab"
|
|
url: https://gitlab.com/-/snippets/2059139
|
|
date: "2023-03-13 15:14:55"
|
|
---
|
|
[](https://gitlab.com/-/snippets/2059139/raw/master/Readme.md "Open raw")[](https://gitlab.com/-/snippets/2059139/raw/master/Readme.md?inline=false "Download")
|
|
|
|
## Small ODROID-XU4 (HC1) scripts
|
|
|
|
CPU underclocking, CPU clock reset and CPU temperature display.
|
|
|
|
```
|
|
#!/usr/bin/env bash
|
|
|
|
# Reset the XU4 (HC1) CPU clocks to default.
|
|
|
|
set -euo pipefail
|
|
|
|
# Auto-restart with sudo.
|
|
if [[ $UID -ne 0 ]]; then
|
|
sudo -p 'Restarting as root, password: ' bash $0 "$@"
|
|
exit $?
|
|
fi
|
|
|
|
cpufreq-set -c 0 --max 1500000
|
|
cpufreq-set -c 4 --max 2000000
|
|
```
|
|
|
|
```
|
|
#!/usr/bin/env bash
|
|
|
|
# Monitor the XU4 (HC1) CPU temperature.
|
|
|
|
set -euo pipefail
|
|
|
|
# thermal_zone2 seems to be the highest most of the time.
|
|
while [ true ]; do awk '{printf "\r%3.1f°C", $1/1000}' /sys/class/thermal/thermal_zone2/temp; sleep 1; done
|
|
```
|
|
|
|
```
|
|
#!/usr/bin/env bash
|
|
|
|
# Underclock the XU4 (HC1) CPU.
|
|
|
|
set -euo pipefail
|
|
|
|
# Auto-restart with sudo.
|
|
if [[ $UID -ne 0 ]]; then
|
|
sudo -p 'Restarting as root, password: ' bash $0 "$@"
|
|
exit $?
|
|
fi
|
|
|
|
cpufreq-set -c 0 --max 1000000
|
|
cpufreq-set -c 4 --max 1000000
|
|
``` |