ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/mports/trunk/sysutils/devcpu-data/files/microcode_update.in
(Generate patch)

Comparing trunk/sysutils/devcpu-data/files/microcode_update.in (file contents):
Revision 23708 by laffer1, Thu Mar 1 13:54:40 2012 UTC vs.
Revision 23709 by laffer1, Fri Jul 27 03:37:29 2018 UTC

# Line 1 | Line 1
1   #!/bin/sh
2   #
3 < # $MidnightBSD$
3 > # $FreeBSD: head/sysutils/devcpu-data/files/microcode_update.in 459084 2018-01-15 17:05:37Z swills $
4 > #
5  
6   # PROVIDE:      microcode_update
7   # REQUIRE:      root mountcritlocal
8   # KEYWORD:      nojail
9 + # BEFORE:       SERVERS
10  
11   #
12   # Add the following line to /etc/rc.conf to enable flow-capture:
# Line 15 | Line 17
17   # microcode_update_cpus (str):          A list of cpus to update on startup, or "ALL" for all.
18   #                                       Example: microcode_update_cpus_cpus="0 CPU0"
19   #                                       Set to "ALL" by default.
20 + # microcode_update_flags (str):         Flags for cpucontrol(8).
21  
22   . /etc/rc.subr
23  
# Line 39 | Line 42 | microcode_update_prepare()
42  
43   microcode_update_start()
44   {
45 <        echo "Updating cpucodes..."
45 >        echo "Updating CPU Microcode..."
46          if [ "${microcode_cpus}" = "ALL" ]; then
47                  ncpu=`/sbin/sysctl -n hw.ncpu`
48                  cpus=`jot ${ncpu} 0`;
# Line 47 | Line 50 | microcode_update_start()
50                  cpus=${microcode_cpus}
51          fi
52          for i in ${cpus}; do
53 <                ${CMT} -u -d "${microcode_update_datadir}" /dev/cpuctl${i} || \
54 <                    (echo "Failed." && exit 1)
53 >                ${CMT} -u ${microcode_update_flags} \
54 >                    -d "${microcode_update_datadir}" /dev/cpuctl${i} 2>&1 | \
55 >                    logger -p daemon.notice -t microcode_update || \
56 >                    (echo "Microcode Update Failed." && exit 1)
57          done
58 +        if [ "${microcode_cpus}" = "ALL" ]; then
59 +                CPUCONTROL_UPDATED=$(cpucontrol -h 2>&1 | grep -q -- -e; echo $?)
60 +                if [ ${CPUCONTROL_UPDATED} -ne 0 ]; then
61 +                        echo "Please update your system in order to update CPU microcode."
62 +                else
63 +                        ${CMT} -e /dev/cpuctl0 >/dev/null 2>&1
64 +                        if [ $? -ne 0 ]; then
65 +                                echo "Re-evalulation of CPU flags Failed."
66 +                                exit 1
67 +                        fi
68 +                fi
69 +        fi
70          echo "Done."
71   }
72  
# Line 59 | Line 76 | load_rc_config $name
76   : ${microcode_update_enable="NO"}
77   : ${microcode_update_datadir="%%DATADIR%%"}
78   : ${microcode_cpus="ALL"}
79 + : ${microcode_update_flags=""}
80  
81   run_rc_command "$1"

Comparing trunk/sysutils/devcpu-data/files/microcode_update.in (property cvs2svn:cvs-rev):
Revision 23708 by laffer1, Thu Mar 1 13:54:40 2012 UTC vs.
Revision 23709 by laffer1, Fri Jul 27 03:37:29 2018 UTC

# Line 1 | Line 0
1 1.1

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines