#!/bin/sh
# DF-2203 build.sh -- applies fix.diff to in-guest /usr/src and rebuilds amdgpu.ko
set -e
cd "$(dirname "$0")"
scp -q -F "$(dirname "$0")/../../../dfbsd-qemu/config" fix.diff dfbsd:/root/DF-2203.fix.diff
"$(dirname "$0")/../../../dfbsd-qemu/vm.sh" run_root \
  'cd /usr/src && patch -p1 --forward < /root/DF-2203.fix.diff && echo APPLIED'
"$(dirname "$0")/../../../dfbsd-qemu/vm.sh" run_root \
  'cd /usr/src/sys/dev/drm/amd/amdgpu && rm -f amdgpu_xgmi.o amdgpu.ko && make 2>&1; echo "=== AMDGPU_KO rc=$? ==="; ls -l amdgpu.ko'
