FDD-book/examples/part-07/ch34-advanced-debugging/lab03-debug-kernel/build-kernel.sh
Edson Brandi 6e6dac94fe Add book companion files under examples/
Organize companion code and materials by book part:

  part-01/      Foundations
  part-02/      Kernel & driver fundamentals
  part-03/      Character & block devices
  part-04/      Networking & storage
  part-05/      Buses & advanced topics
  part-06/      Debugging & performance
  part-07/      Real-world drivers
  appendices/   Supplementary material
  README.md     Overview and build instructions
2026-04-25 16:51:00 +00:00

46 lines
1 KiB
Bash

#!/bin/sh
#
# build-kernel.sh - walk through building a debug kernel.
#
# This script is not run automatically; it prints the commands the
# reader should run, with brief commentary. It does not change the
# system.
cat <<'EOF'
Debug kernel build procedure
============================
1. Ensure /usr/src/ is populated. If it is not:
# git clone --depth 1 -b releng/14.3 \
https://git.freebsd.org/src.git /usr/src
2. Review the existing GENERIC-DEBUG config:
$ cat /usr/src/sys/amd64/conf/GENERIC-DEBUG
3. Build the kernel:
# cd /usr/src
# make buildkernel KERNCONF=GENERIC-DEBUG
This takes twenty to forty minutes on a modest VM.
4. Install the new kernel (the previous one is kept as kernel.old):
# make installkernel KERNCONF=GENERIC-DEBUG
5. Reboot:
# shutdown -r now
6. After reboot, confirm:
$ uname -v
$ sysctl debug.kdb.supported_backends
$ sysctl debug.debugger_on_panic
7. If the new kernel fails to boot, pick "Boot kernel.old" from the
loader menu to return to the previous working kernel.
EOF