I recently needed to run amdmemtweak right after boot, however the xinit.user.sh method doesn’t work for me, since I have GUI disabled, and then it doesn’t execute.
Found a solution in the meantime which works for me. It basically just creates a systemd service which runs a script at boot.
In my case I have to wait for /dev/dri/card0 device to be up before executing amdmemtweak. Of course, you should be able to see logs with: systemctl status amdmemtweak
This will create the files and enable the systemd service. Of course modify the script itself for your own needs.
cat > /home/user/run_at_boot.sh<<'EOF'
#!/usr/bin/env bash
$DEVICE="/dev/dri/card0"
# Wait for the device to be loaded
while [ ! -e $DEVICE ] ;do
echo waiting for $DEVICE
sleep 1
done
# https://forum.hiveos.farm/t/vega-56-and-vega-64-guide/22368
/hive/sbin/amdmemtweak --i 1 --CL 20 --RAS 22 --RCDRD 12 --RCDWR 12 --RC 36 --RP 12 --RRDS 3 --RRDL 5 --RTP 5 --FAW 12 --CWL 8 --WTRS 4 --WTRL 9 --WR 13 --REF 65000 --RFC 249
EOF
chmod +x /home/user/run_at_boot.sh
cat >/etc/systemd/system/amdmemtweak.service<<'EOF'
[Unit]
Description=Start amdmemtweak on boot
StartLimitIntervalSec=0
[Service]
Type=idle
ExecStart=/home/user/run_at_boot.sh
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable amdmemtweak