pkgsrc/sysutils/intel-microcode-netbsd/files/intel-microcode.sh
khorben 5dc272fad5 intel-microcode-netbsd: fix for the RC script
intel-microcode-netbsd does not contain a daemon, it simply calls
cpuctl(8) to upload the microcode to the CPU. However the RC script only
handles the starting sequence. This change avoids an irrelevant message
upon reboot, and avoids a meaningless error condition.

ok Riastradh@
2020-07-20 21:43:19 +00:00

40 lines
592 B
Bash

#!@RCD_SCRIPTS_SHELL@
# PROVIDE: microcode
# REQUIRE: mountall
#
# attempts microcode update on all CPU cores (for Intel x86)
#
$_rc_subr_loaded . /etc/rc.subr
name=microcode
rcvar=$name
start_cmd="microcode_start"
stop_cmd=":"
_microcode_baremetal()
{
ncpu=`/sbin/sysctl -n hw.ncpu`
for i in `/usr/bin/jot - 0 \`expr $ncpu - 1\` 1`; do
/usr/sbin/cpuctl ucode $i || true
done
}
_microcode_xen()
{
/usr/sbin/cpuctl ucode || true
}
microcode_start()
{
if [ -e /kern/xen/privcmd ]; then
_microcode_xen
else
_microcode_baremetal
fi
}
load_rc_config $name
run_rc_command "$1"