DragonFlyBSD Kernel Audit
DF-0002 / build.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0002 — build the KLD trigger + the user-space PoC.
# Must run on the DragonFlyBSD guest as root.
set -e
cd "$(dirname "$0")"

# 1. Build the user-space PoC.
cc -O -o fhopen_spur fhopen_spur.c

# 2. Build the kernel trigger module (needs /usr/src/sys).
export SYSDIR=/usr/src/sys
make

# 3. The .ko may land in the per-source obj dir or the source dir; copy it local.
ko=$(ls -1 df0002_trigger.ko 2>/dev/null || true)
if [ -z "$ko" ]; then
    ko=$(find /usr/obj -name df0002_trigger.ko -newer Makefile 2>/dev/null | head -1)
    [ -n "$ko" ] && cp "$ko" .
fi

ls -l fhopen_spur df0002_trigger.ko
echo BUILD_OK