⬢ DragonFlyBSD Kernel Audit
DF-2263 / quick.sh
← back to finding ↓ download raw
#!/bin/sh
# quick.sh -- iterate: push harness pieces, regenerate, quickkernel
# (reuses the obj tree; only changed files recompile), install, reboot.
set -e
cd "$(dirname "$0")"
ROOT=/home/maxx/dfbsd/dfbsd
CFG=$ROOT/dfbsd-qemu/config
SSH="ssh -F $CFG -o ConnectTimeout=8 -o BatchMode=yes dfbsd"
SCP="scp -F $CFG -o ConnectTimeout=8 -o BatchMode=yes"
rsh() { printf '%s\n' "$1" | $SSH /bin/sh; }

$ROOT/dfbsd-qemu/vm.sh status >/dev/null
$SCP df_pre.c df_post.c dfbsd:/usr/src/sys/bus/cam/scsi/
$SCP gen.sh dfbsd:/root/gen.sh
rsh 'sh /root/gen.sh'
echo '=== quickkernel ==='
rsh 'rm -f /root/build.ok /root/build.fail; cd /usr/src && nohup make -j4 quickkernel KERNCONF=X86_64_GENERIC > /root/qbuild.log 2>&1 < /dev/null && touch /root/build.ok || touch /root/build.fail' > /dev/null 2>&1 &
i=0
while [ $i -lt 180 ]; do
	sleep 10
	if rsh 'test -f /root/build.ok' 2>/dev/null; then break; fi
	if rsh 'test -f /root/build.fail' 2>/dev/null; then break; fi
	i=$((i + 10))
	echo "... building (${i}s)"
done
$SCP dfbsd:/root/qbuild.log quickkernel.log
rsh 'test -f /root/build.ok' || { echo 'QUICK BUILD FAILED'; grep -n "error:" quickkernel.log | head; tail -30 quickkernel.log; exit 1; }
echo '=== installkernel ==='
rsh 'cd /usr/src && make installkernel KERNCONF=X86_64_GENERIC' > installkernel.log 2>&1
tail -2 installkernel.log
echo '=== reboot ==='
rsh 'reboot' > /dev/null 2>&1 || true
sleep 15
i=0
while [ $i -lt 150 ]; do
	sleep 5
	if $ROOT/dfbsd-qemu/vm.sh status >/dev/null 2>&1; then break; fi
	i=$((i + 5))
done
sleep 5
rsh 'uname -a; sysctl -N debug.df226x.t2263b' | tail -2
echo 'QUICK BUILD OK'