Set clocks to max speed on startup
Otherwise, the GPU and CPU autoscale, which makes it hard to hit our
timing.
Change-Id: If3443da2eb662f086750301ddc5acda2a9b34798
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/frc971/orin/build_rootfs.py b/frc971/orin/build_rootfs.py
index ceed056..3575772 100755
--- a/frc971/orin/build_rootfs.py
+++ b/frc971/orin/build_rootfs.py
@@ -988,7 +988,8 @@
"gstreamer1.0-nice", "usbutils", "locales", "trace-cmd", "clinfo",
"jq", "strace", "sysstat", "lm-sensors", "can-utils", "xfsprogs",
"gstreamer1.0-tools", "bridge-utils", "net-tools", "apt-file",
- "parted", "xxd", "libv4l-dev", "file", "pkexec", "libxkbfile1"
+ "parted", "xxd", "libv4l-dev", "file", "pkexec", "libxkbfile1",
+ "gdb"
])
target(["apt-get", "clean"])
@@ -1043,6 +1044,7 @@
'cuda-nvcc-headers-11-8',
'nsight-systems-cli',
'nsight-systems-cli-qdstrmimporter',
+ 'tegra-tools-jetson-clocks',
]
yocto_packages = list_yocto_packages()
packages = list_packages()
@@ -1098,6 +1100,8 @@
copyfile("pi:pi", "600", "home/pi/.ssh/authorized_keys")
target_mkdir("root:root", "700", "root/bin")
copyfile("root:root", "644", "etc/systemd/system/grow-rootfs.service")
+ copyfile("root:root", "644",
+ "etc/systemd/system/jetson-clocks.service")
copyfile("root:root", "500", "root/bin/change_hostname.sh")
copyfile("root:root", "700", "root/trace.sh")
copyfile("root:root", "440", "etc/sudoers")
@@ -1114,6 +1118,7 @@
target(["systemctl", "enable", "systemd-networkd"])
target(["systemctl", "enable", "grow-rootfs"])
+ target(["systemctl", "enable", "jetson-clocks"])
target(["apt-file", "update"])
diff --git a/frc971/orin/contents/etc/systemd/system/jetson-clocks.service b/frc971/orin/contents/etc/systemd/system/jetson-clocks.service
new file mode 100644
index 0000000..9e67379
--- /dev/null
+++ b/frc971/orin/contents/etc/systemd/system/jetson-clocks.service
@@ -0,0 +1,16 @@
+[Install]
+WantedBy=multi-user.target
+
+[Unit]
+Description=Service to pin the device to max clock rate
+
+[Service]
+Type=oneshot
+
+# Turn the GPU on
+ExecStart=bash -c 'echo 1 > /dev/nvgpu/igpu0/power'
+# Set all the clocks to max frequency
+ExecStart=/usr/bin/jetson_clocks
+
+TimeoutSec=0
+RemainAfterExit=yes