init: Adding checks for sysfs and runtime panic_on_oom=1

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
Thierry Laurion 2024-04-01 15:20:49 -04:00
parent a051483c79
commit c73687a232
No known key found for this signature in database
GPG Key ID: 9A53E1BB3FF00461

View File

@ -24,7 +24,7 @@ if [ "$CONFIG_LINUXBOOT" = "y" ]; then
mount /sys/firmware/efi/efivars mount /sys/firmware/efi/efivars
fi fi
# Setup the pty psudeo filesystem # Setup the pty pseudo filesystem
mkdir /dev/pts mkdir /dev/pts
mount /dev/pts 2>/dev/ttyprintk mount /dev/pts 2>/dev/ttyprintk
@ -78,6 +78,23 @@ fi
TRACE "Under init" TRACE "Under init"
# make sure we have sysctl requirements
if [ ! -d /proc/sys ]; then
warn "BUG!!! The following requirements to apply runtime kernel tweaks are missing:"
warn "CONFIG_SYSCTL=y"
warn "CONFIG_PROC_SYSCTL=y"
warn "Please open an issue"
fi
if [ ! -e /proc/sys/vm/panic_on_oom ]; then
warn "BUG!!! Requirements to setup Panic when under Out Of Memory situation through PROC_SYSCTL are missing (panic_on_oom was not enabled)"
warn "Please open an issue"
else
DEBUG "Applying panic_on_oom setting to sysctl"
echo 1 > /proc/sys/vm/panic_on_oom
fi
# set CONFIG_TPM dynamically before init # set CONFIG_TPM dynamically before init
if [ ! -e /dev/tpm0 ]; then if [ ! -e /dev/tpm0 ]; then
CONFIG_TPM='n' CONFIG_TPM='n'