-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initscripts-nilrt: add a script to free up dump-related EFI variables…
… on boot The kernel can insert crash information into EFI variables (via efi-pstore) for later retrieval (typically by systemd-pstore). However, if nothing ever retreives and cleans up those variables, they can build up and inhibit the provisioning process. Since this release of NI Linux RT is still using sysvinit and not systemd, it does not have systemd-pstore; therefore it does not have a means to meaningfully process the crash information from efi-pstore. Thus we opt to simply clean up the state to avoid filling the EFI variable store. Signed-off-by: Brandon Streiff <brandon.streiff@ni.com> Natinst-AzDO-ID: 1154633
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
### BEGIN INIT INFO | ||
# Provides: nicleanefivars | ||
# Required-Start: $mountvirtfs | ||
# Required-Stop: | ||
# Default-Start: S | ||
# Default-Stop: | ||
# Short-Description: nicleanefivars | ||
# Description: This is a script that cleans old efi-pstore information. | ||
### END INIT INFO | ||
|
||
# Previous kernels may have stored kernel crash information in EFI for | ||
# systemd to retrieve later. However, this version of NI Linux RT does | ||
# not use systemd and therefore does not have a way to meaningfully | ||
# utilize this information. In order to prevent future issues due to | ||
# exhaustion of EFI variable storage, erase all prior dump information. | ||
|
||
NAME=nicleanefivars | ||
SCRIPTNAME=/etc/init.d/$NAME | ||
|
||
EFI_CRASH_CLEANUP=y | ||
|
||
# Read configuration variable file if it is present | ||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME | ||
|
||
# no-op if EFI_CRASH_CLEANUP=n is set in /etc/default/nicleanefivars | ||
case "$EFI_CRASH_CLEANUP" in | ||
[Nn]*) | ||
exit 0 | ||
;; | ||
esac | ||
|
||
case "$1" in | ||
start) | ||
LINUX_EFI_CRASH_GUID="cfc8fc79-be2e-4ddc-97f0-9f98bfe298a0" | ||
find /sys/firmware/efi/efivars -name "*-${LINUX_EFI_CRASH_GUID}" -exec /bin/rm {} + | ||
;; | ||
stop|status|reload|restart|force-reload) | ||
;; | ||
*) | ||
echo "Usage: $SCRIPTNAME {start}" >&2 | ||
exit 3 | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters