Add script to build Bookworm rootfs with libargus support

This is the minimal amount needed to build a bookworm rootfs which boots
and is able to take pictures with the imx296 sensor

Note: the paths are pretty hard-coded right now, they need to be
improved.

Flashing is done using ./doflash_frc971.sh

Change-Id: Ibf480d3f5b0aed553ba71431f8a94a8e5290a98f
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/frc971/orin/contents/root/bin/change_hostname.sh b/frc971/orin/contents/root/bin/change_hostname.sh
new file mode 100755
index 0000000..785903e
--- /dev/null
+++ b/frc971/orin/contents/root/bin/change_hostname.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+set -xeuo pipefail
+
+HOSTNAME="$1"
+
+# TODO<Jim>: Should probably add handling for imu hostname, too
+if [[ ! "${HOSTNAME}" =~ ^pi-[0-9]*-[0-9]$ ]]; then
+  echo "Invalid hostname ${HOSTNAME}, needs to be pi-[team#]-[pi#]"
+  exit 1
+fi
+
+TEAM_NUMBER="$(echo ${HOSTNAME} | sed 's/pi-\(.*\)-.*/\1/')"
+PI_NUMBER="$(echo ${HOSTNAME} | sed 's/pi-.*-\(.*\)/\1/')"
+IP_BASE="$(echo ${TEAM_NUMBER} | sed 's/\(.*\)\(..\)/10.\1.\2/')"
+IP="${IP_BASE}.$(( 100 + ${PI_NUMBER}))"
+
+echo "Changing to team number ${TEAM_NUMBER}, IP ${IP}"
+
+sed -i "s/^Address=.*$/Address=${IP}\/24/" /etc/systemd/network/eth0.network
+sed -i "s/^Gateway=.*$/Gateway=${IP_BASE}.13/" /etc/systemd/network/eth0.network
+
+echo "${HOSTNAME}" > /etc/hostname
+
+# Make sure a 127.0.* entry exists to make things looking up localhost happy.
+if grep '^127.0.1.1' /etc/hosts > /dev/null;
+then
+  sed -i "s/\(127\.0\.1\.1\t\).*$/\1${HOSTNAME}/" /etc/hosts
+else
+  echo -e "127.0.1.1\t${HOSTNAME}" >> /etc/hosts
+fi
+
+# Put corret team number in pi's IP addresses, or add them if needed
+if grep '^10\.[0-9]*\.[0-9]*\.[0-9]*\s*pi-[0-9]*-[0-9] pi[0-9]$' /etc/hosts >/dev/null ;
+then
+  sed -i "s/^10\.[0-9]*\.[0-9]*\(\.[0-9]*\s*pi-\)[0-9]*\(-[0-9] pi[0-9]\)\(.*\)$/${IP_BASE}\1${TEAM_NUMBER}\2\3/" /etc/hosts
+else
+  for i in {1..6}; do
+      imu=""
+      # Add imu name to pi6.  Put space in this string, since extra
+      # spaces otherwise will make the above grep fail
+      if [[ ${i} == 6 ]]; then
+          imu=" imu"
+      fi
+    echo -e "${IP_BASE}.$(( i + 100 ))\tpi-${TEAM_NUMBER}-${i} pi${i}${imu}" >> /etc/hosts
+  done
+fi
+
+# Put correct team number in roborio's address, or add it if missing
+if grep '^10\.[0-9]*\.[0-9]*\.2\s*roborio$' /etc/hosts >/dev/null;
+then
+  sed -i "s/^10\.[0-9]*\.[0-9]*\(\.2\s*roborio\)$/${IP_BASE}\1/" /etc/hosts
+else
+  echo -e "${IP_BASE}.2\troborio" >> /etc/hosts
+fi
diff --git a/frc971/orin/contents/root/trace.sh b/frc971/orin/contents/root/trace.sh
new file mode 100644
index 0000000..4b69b4e
--- /dev/null
+++ b/frc971/orin/contents/root/trace.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+echo 1 > /sys/kernel/debug/tracing/tracing_on
+echo 30720 > /sys/kernel/debug/tracing/buffer_size_kb
+echo 1 > /sys/kernel/debug/tracing/events/tegra_rtcpu/enable
+echo 1 > /sys/kernel/debug/tracing/events/freertos/enable
+echo 2 > /sys/kernel/debug/camrtc/log-level
+echo 1 > /sys/kernel/debug/tracing/events/camera_common/enable
+echo > /sys/kernel/debug/tracing/trace
+
+echo file vi2_fops.c +p > /sys/kernel/debug/dynamic_debug/control
+echo file csi2_fops.c +p > /sys/kernel/debug/dynamic_debug/control
+
+echo file vi4_fops.c +p > /sys/kernel/debug/dynamic_debug/control
+echo file csi.c +p > /sys/kernel/debug/dynamic_debug/control
+echo file csi4_fops.c +p > /sys/kernel/debug/dynamic_debug/control
+echo file nvcsi.c +p > /sys/kernel/debug/dynamic_debug/control
+
+cat /sys/kernel/debug/tracing/trace /sys/kernel/debug/tracing/trace_pipe