DF-2293 / prep_guest.sh
#!/bin/sh # prep_guest.sh -- one-time guest preparation for the fwdev.c rig. # Files are expected in /root/fw (pushed from the host). set -e cd /root/fw # 1. install harness into the kernel source tree (guest /usr/src is the # build scratch; the host-side sys/ tree is never modified) install -m 644 fwharness.c fwharness.h /usr/src/sys/bus/firewire/ grep -q fwharness.c /usr/src/sys/conf/files || \ printf 'bus/firewire/fwharness.c\toptional fwharness\n' >> /usr/src/sys/conf/files if [ ! -f /usr/src/sys/config/FWH ]; then cp /usr/src/sys/config/X86_64_GENERIC /usr/src/sys/config/FWH printf '\n# fwdev.c audit rig (DF-2293..96)\ndevice\t\tfwharness\n' \ >> /usr/src/sys/config/FWH fi # 2. panic behavior: auto-reboot, no ddb grep -q debugger_on_panic /etc/sysctl.conf || \ echo 'debug.debugger_on_panic=0' >> /etc/sysctl.conf sysctl debug.debugger_on_panic=0 # 3. operator-group test user pw useradd -n opuser -m -G operator -w none 2>/dev/null || true id opuser # 4. build userland PoCs cc -O -Wall -o poc_2293 poc_2293.c cc -O -Wall -o poc_2294 poc_2294.c cc -O -Wall -o poc_2295 poc_2295.c cc -O -Wall -o poc_2296 poc_2296.c cc -O -Wall -o fwhctl fwhctl.c ls -l poc_2293 poc_2294 poc_2295 poc_2296 fwhctl echo PREP_OK |