freebsd-ports/sysutils/devcpu/files/devcpu.in
Stanislav Sedov cef4580bcf - Update to 0.8
- Add rcNG startup script that allows update cpucodes on startup
- Add utility to extract cpucodes from Award BIOS update images
- Add additional amd microcode upodate extracted from update images,
  provided by pav@

Thanks to netchild@ and pav@ for suggestions and information regarding
BIOS updates.
2007-02-01 21:52:14 +00:00

54 lines
1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: devcpu
# REQUIRE: root mountcritlocal
# KEYWORD: nojail
#
# Add the following line to /etc/rc.conf to enable flow-capture:
# devcpu_enable (bool): Set it to "YES" to update cpucodes on startup
# Set to "NO" by default.
# devcpu_datadir (str): Directory, cpucode updates stored in.
# Default is "%%DATADIR%%"
# devcpu_cpus (str): A list of cpus to update on startup, or "-a" for all.
# Example: devcpu_cpus="cpu0 /dev/cpu1"
# Set to "-a" by default.
. /etc/rc.subr
name="devcpu"
rcvar=`set_rcvar`
stop_cmd=":"
start_precmd="devcpu_prepare"
start_cmd="devcpu_start"
requires_modules="cpu"
CMT="%%PREFIX%%/bin/cpu_microcode_tool"
devcpu_prepare()
{
if ! kldstat -q -m cpu; then
if ! kldload cpu > /dev/null 2>&1; then
warn "Can't load cpu module."
return 1
fi
fi
}
devcpu_start()
{
echo "Updating cpucodes."
${CMT} -I "${devcpu_datadir}" ${devcpu_cpus}
}
load_rc_config $name
# Set default values
: ${devcpu_enable="NO"}
: ${devcpu_datadir="%%DATADIR%%"}
: ${devcpu_cpus="-a"}
run_rc_command "$1"