aboutsummaryrefslogtreecommitdiff
path: root/scripts/os/freebsd/80-microcode
blob: 954ebd28979a54f2873dab4e21e412e94644638a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

: ${microcode_name:='intel-ucode.bin'}

# Only run this file on baremetal hosts.
if [ "$BOXCONF_VIRTUALIZATION_TYPE" != none ]; then
  return
fi

if [ "${enable_microcode_updates:-}" = false ]; then
  set_loader_conf cpu_microcode_load=NO
  sysrc -v microcode_update_enable=NO
else
  pkg install -y cpu-microcode

  if [ "${microcode_after_boot:-}" = true ]; then
    set_loader_conf cpu_microcode_load=NO
    sysrc -v microcode_update_enable=YES
  else
    sysrc -v microcode_update_enable=NO
    set_loader_conf \
      cpu_microcode_load=YES \
      cpu_microcode_name="/boot/firmware/${microcode_name}"
  fi
fi