pkg: add kernel updater

mono-gateway package installs an rc.syshook script which moves the U-Boot booti compatible kernel image from /boot/kernel to the FAT partition on reboot / shutdown.
This commit is contained in:
Maurice Walker 2026-04-09 03:26:09 +02:00
parent 8c3db242b3
commit fc51b3794b
3 changed files with 14 additions and 0 deletions

View file

@ -220,6 +220,7 @@ package: all
@mkdir -p ${PKG_STAGEDIR}/etc/fmc/config
@mkdir -p ${PKG_STAGEDIR}/usr/local/etc/rc.d
@mkdir -p ${PKG_STAGEDIR}/usr/local/etc/rc.syshook.d/early
@mkdir -p ${PKG_STAGEDIR}/usr/local/etc/rc.syshook.d/stop
# Kernel modules
install -m 644 ${DISTDIR}/cdx.ko ${PKG_STAGEDIR}/boot/modules/
install -m 644 ${DISTDIR}/fci.ko ${PKG_STAGEDIR}/boot/modules/
@ -251,6 +252,8 @@ package: all
install -m 755 ${PKG_RCDDIR}/mwifiex_uap ${PKG_STAGEDIR}/usr/local/etc/rc.d/
# rc.syshook early scripts
install -m 755 ${PKG_RCDDIR}/01-mono-modules ${PKG_STAGEDIR}/usr/local/etc/rc.syshook.d/early/
# rc.syshook stop scripts
install -m 755 ${PKG_RCDDIR}/20-kernel-update ${PKG_STAGEDIR}/usr/local/etc/rc.syshook.d/stop/
# OPNsense plugin files (hwmon dashboard widget)
cp -R ${OPSDIR}/plugins/hwmon/src/opnsense/ ${PKG_STAGEDIR}/usr/local/opnsense/
chmod 755 ${PKG_STAGEDIR}/usr/local/opnsense/scripts/hwmon/sensors.py

View file

@ -25,6 +25,7 @@
/usr/local/etc/rc.d/fand
/usr/local/etc/rc.d/mwifiex_uap
/usr/local/etc/rc.syshook.d/early/01-mono-modules
/usr/local/etc/rc.syshook.d/stop/20-kernel-update
@dir /usr/local/opnsense/scripts/hwmon
/usr/local/opnsense/scripts/hwmon/sensors.py
/usr/local/opnsense/service/conf/actions.d/actions_hwmon.conf

10
rc.d/20-kernel-update Normal file
View file

@ -0,0 +1,10 @@
#!/bin/sh
# move kernel to FAT partition after kernel update
if [ -f /boot/kernel/kernel.bin ]; then
INSTALLED_KERNEL=$(cat /usr/local/opnsense/version/kernel)
if [ "${INSTALLED_KERNEL}" != "26.1.3" ]; then
cp /boot/msdos/kernel.img /boot/msdos/kernel.old
mv /boot/kernel/kernel.bin /boot/msdos/kernel.img
fi
fi