updated the build script to patch for new freebsd kernels

This commit is contained in:
bwn-a1370
2026-09-01 14:43:10 +03:00
parent a8418431bb
commit 60a93e1f96
2 changed files with 39 additions and 9 deletions
+10 -2
View File
@@ -36,8 +36,10 @@ interface) is never disrupted.
(`patches/patch-*.c` and `patches/patch-Makefile`). Safe to re-run.
- `build.sh` — builds `if_bwn.ko` (`sys/modules/bwn`), `bhndb_pci.ko`
(`sys/modules/bhnd/bhndb_pci`), and `bwn_v4_n.ko` (from `src/firmware/`);
installs them to `/boot/modules` and `/boot/kernel`; and appends
`bwn_v4_n_load="YES"` to `/boot/loader.conf` if missing (Fix 5).
installs them to `/boot/modules` and `/boot/kernel`; appends
`bwn_v4_n_load="YES"` to `/boot/loader.conf` if missing (Fix 5); and
regenerates `/boot/kernel/linker.hints` and `/boot/modules/linker.hints`
with `kldxref` so the loader finds the new modules (no manual step).
### Manual build (equivalent to build.sh)
@@ -58,6 +60,12 @@ install -m 444 src/firmware/bwn_v4_n.ko /boot/modules/
# 4. loader.conf (Fix 5)
echo 'bwn_v4_n_load="YES"' >> /boot/loader.conf
# 5. Regenerate linker.hints so the loader indexes the new modules
# (else /boot/kernel/linker.hints stays empty -> 'linker.hints file
# truncated' warnings and modules fail to auto-load at boot).
kldxref /boot/kernel
kldxref /boot/modules
```
## Directory layout
+23 -1
View File
@@ -11,6 +11,9 @@
# 2. Builds bhndb_pci.ko(sys/modules/bhnd/bhndb_pci) -> /boot/kernel/bhndb_pci.ko
# 3. Builds bwn_v4_n.ko (src/firmware) -> /boot/modules/bwn_v4_n.ko
# 4. Adds "bwn_v4_n_load=YES" to /boot/loader.conf (Fix 5) if missing.
# 5. Regenerates /boot/kernel/linker.hints (for bhndb_pci.ko) and
# /boot/modules/linker.hints (for if_bwn.ko + bwn_v4_n.ko) with kldxref
# so the loader finds the new modules without manual intervention.
#
# All changes take effect on the NEXT reboot (modules are only loaded at
# boot). The running kernel is NOT touched, so an active SSH session (e.g.
@@ -20,6 +23,13 @@
# NO_MSI quirk), so TX interrupts are delivered and the "device timeout" /
# detach-panic / heap-corruption issues are resolved.
set -e
# Re-exec as root if we are not already (build + install + kldxref need it).
if [ "$(id -u)" -ne 0 ]; then
echo "build.sh needs root (install + kldxref); re-execing via sudo..."
exec sudo "$0" "$@"
fi
SRC="${1:-/usr/src}"
HERE="$(cd "$(dirname "$0")" && pwd)"
@@ -58,7 +68,19 @@ else
echo " already present, skipped"
fi
echo "==> Regenerating linker.hints (no manual kldxref needed)"
# The kernel hints file indexes /boot/kernel (where bhndb_pci.ko lives); the
# modules hints file indexes /boot/modules (if_bwn.ko + bwn_v4_n.ko). If either
# is stale/empty the loader prints "linker.hints file truncated" and may fail
# to auto-load modules, so rebuild both from the modules currently present.
kldxref /boot/kernel
kldxref /boot/modules
echo " /boot/kernel/linker.hints: $(wc -c < /boot/kernel/linker.hints) bytes"
echo " /boot/modules/linker.hints: $(wc -c < /boot/modules/linker.hints) bytes"
echo
echo "==> All modules built and installed. REBOOT to activate."
echo "==> All modules built, installed and indexed. REBOOT to activate."
echo " After reboot, create the interface with:"
echo " ifconfig wlan create wlandev bwn0 [wap]"
exit 0