1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= AMD and Intel CPUs microcode updates
12 SPKGS[standard]= single
14 OPTIONS_AVAILABLE= none
15 OPTIONS_STANDARD= none
17 RUN_DEPENDS= devcpu-data-intel:single:standard
18 devcpu-data-amd:single:standard
20 FPC_EQUIVALENT= sysutils/devcpu-data
25 RC_SUBR= microcode_update:single
26 SUB_FILES= pkg-message-single
27 SUB_LIST= DATADIR="{{PREFIX}}/share/cpucontrol"
29 [FILE:154:descriptions/desc.single]
30 This port supplies microcode updates for use with cpuctl(4) microcode
31 update facility. These could be used to keep your processor's firmware
36 fd85b6b769efd029dec6a2c07106fd18fb4dcb548b7bc4cde09295a8344ef6d7 4782451 intel-Intel-Linux-Processor-Microcode-Data-Files-microcode-20210608.tar.gz
37 156eef8950f28436e045c1d5ac6e4738d99c07a6737d35bf966901f4b260abb3 28827 amd64-microcode.20191228.tar.xz
40 [FILE:2458:files/microcode_update.in]
43 # PROVIDE: microcode_update
44 # REQUIRE: root mountcritlocal
49 # Add the following line to /etc/rc.conf to enable flow-capture:
50 # microcode_update_enable (bool): Set it to "YES" to update microcode on startup
51 # Set to "NO" by default.
52 # microcode_update_datadir (str): Directory, microcode updates stored in.
53 # Default is "%%DATADIR%%"
54 # microcode_update_cpus (str): A list of cpus to update on startup, or "ALL" for all.
55 # Example: microcode_update_cpus="0 1"
56 # Set to "ALL" by default.
57 # microcode_update_flags (str): Flags for cpucontrol(8).
61 name="microcode_update"
62 rcvar=microcode_update_enable
64 start_precmd="microcode_update_prepare"
65 start_cmd="microcode_update_start"
66 requires_modules="cpuctl"
68 CMT="/usr/sbin/cpucontrol"
70 microcode_update_prepare()
72 if ! kldstat -q -m cpuctl; then
73 if ! kldload cpuctl > /dev/null 2>&1; then
74 warn "Can't load cpuctl module."
80 microcode_update_start()
82 echo "Updating CPU Microcode..."
83 if [ "${microcode_update_cpus}" = "ALL" ]; then
84 ncpu=`/sbin/sysctl -n hw.ncpu`
87 cpus=${microcode_update_cpus}
90 ${CMT} -u ${microcode_update_flags} \
91 -d "${microcode_update_datadir}" /dev/cpuctl${i} 2>&1 | \
92 logger -p daemon.notice -t microcode_update || \
93 (echo "Microcode Update Failed." && exit 1)
95 if [ "${microcode_update_cpus}" = "ALL" ]; then
96 CPUCONTROL_UPDATED=$(cpucontrol -h 2>&1 | grep -q -- -e; echo $?)
97 if [ ${CPUCONTROL_UPDATED} -ne 0 ]; then
98 echo "Please update your system in order to update CPU microcode."
100 ${CMT} -e /dev/cpuctl0 >/dev/null 2>&1
101 if [ $? -ne 0 ]; then
102 echo "Re-evalulation of CPU flags Failed."
113 if [ -n "${microcode_cpus}" ]; then
114 if [ -n "${microcode_update_cpus}" ]; then
115 echo "Warning: Ignoring deprecated rc variable, microcode_cpus."
117 echo "Warning: rc variable microcode_cpus is deprecated.
118 Warning: Set microcode_udpate_cpus instead."
119 microcode_update_cpus="${microcode_cpus}"
123 : ${microcode_update_enable="NO"}
124 : ${microcode_update_datadir="%%DATADIR%%"}
125 : ${microcode_update_cpus="ALL"}
126 : ${microcode_update_flags=""}
131 [FILE:1638:files/pkg-message-single.in]
132 This port includes an RC script, which is one of two methods to update the
133 CPU microcode on a FreeBSD system.
135 1. The first method, which does not require the RC script included in this
136 port is currently only supported on FreeBSD 12.0 or later and Intel i386
137 and amd64 processors. It is the preferred method when available because
138 it ensures that any CPU features introduced by a microcode update are
139 visible to the kernel by applying the update before the kernel performs
140 CPU feature detection.
142 To enable updates using the first method, add the following lines to
145 cpu_microcode_load="YES"
146 cpu_microcode_name="/boot/firmware/intel-ucode.bin"
148 The microcode update will be loaded when the system is rebooted.
151 2. The second method, which uses the RC script included in this port can
152 be enabled by adding the following line to /etc/rc.conf:
154 microcode_update_enable="YES"
156 The microcode update is then applied upon reboot or when the microcode
157 update service is run via:
159 # service microcode_update start
161 If the CPU requires a microcode update, a console message such as the
162 following will appear:
164 Updating CPU Microcode...
165 %%DATADIR%%/m32306c3_00000022.fw: updating cpu /dev/cpuctl0 from rev 0x17 to rev 0x22... done.
166 %%DATADIR%%/m32306c3_00000022.fw: updating cpu /dev/cpuctl2 from rev 0x17 to rev 0x22... done.
167 %%DATADIR%%/m32306c3_00000022.fw: updating cpu /dev/cpuctl4 from rev 0x17 to rev 0x22... done.
168 %%DATADIR%%/m32306c3_00000022.fw: updating cpu /dev/cpuctl6 from rev 0x17 to rev 0x22... done.
171 It is safe to enable both methods.