Date: Tue, 20 Mar 2018 14:56:15 +0000 (UTC) From: Eugene Grosbein <eugen@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r465088 - in head/sysutils/cpupdate: . files Message-ID: <201803201456.w2KEuFpa069353@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eugen Date: Tue Mar 20 14:56:15 2018 New Revision: 465088 URL: https://svnweb.freebsd.org/changeset/ports/465088 Log: sysutils/cpupdate: update to g20180320 Additional port changes: - move binary from /bin/ to /sbin/ as this is sysadmin's utility; - supply startup script for boot time updates started as early as possible, before configuration of network interfaces; - make code respect PREFIX; - patch source to kldload("cpuctl") automatically, if needed; - fix some compiler warning; - update pkg-descr to mention that CPU microcode updates bringing new features like IBRS require recent FreeBSD version for sake of CPUCTL_EVAL_CPU_FEATURES support. Added: head/sysutils/cpupdate/files/cpupdate.in (contents, props changed) head/sysutils/cpupdate/files/patch-cpupdate.c (contents, props changed) Modified: head/sysutils/cpupdate/Makefile head/sysutils/cpupdate/distinfo head/sysutils/cpupdate/pkg-descr Modified: head/sysutils/cpupdate/Makefile ============================================================================== --- head/sysutils/cpupdate/Makefile Tue Mar 20 13:41:32 2018 (r465087) +++ head/sysutils/cpupdate/Makefile Tue Mar 20 14:56:15 2018 (r465088) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= cpupdate -DISTVERSION= g20180302 +DISTVERSION= g20180320 CATEGORIES= sysutils MAINTAINER= eugen@FreeBSD.org @@ -11,6 +11,8 @@ COMMENT= CPU microcode update utility for x86 LICENSE= BSD2CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE +USE_RC_SUBR= ${PORTNAME} + ONLY_FOR_ARCHS= amd64 i386 ONLY_FOR_ARCHS_REASON= specific to x86 processors @@ -20,9 +22,9 @@ SUB_LIST= CPM_DIR=${CPM_DIR} INTEL_DIR=${INTEL_DIR} USE_GITHUB= yes GH_ACCOUNT= kernschmelze GH_PROJECT= ${PORTNAME} -GH_TAGNAME= 58bc0ca +GH_TAGNAME= b0df539 -PLIST_FILES= bin/${PORTNAME} man/man8/${PORTNAME}.8.gz +PLIST_FILES= sbin/${PORTNAME} man/man8/${PORTNAME}.8.gz CPM_ACCOUNT= platomav CPM_PROJECT= CPUMicrocodes @@ -41,8 +43,11 @@ INTEL_MASTER_SITES= https://downloadmirror.intel.com/2 INTEL_DISTFILES= ${INTEL_PACK}:intel INTEL_DIR= ${WRKDIR}/intel-ucode +post-patch: + ${REINPLACE_CMD} -e "s,/usr/local/share/cpupdate,${DATADIR},g" ${WRKSRC}/cpupdate.h + do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin + ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/sbin ${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.8 ${STAGEDIR}${MANPREFIX}/man/man8 .include <bsd.port.mk> Modified: head/sysutils/cpupdate/distinfo ============================================================================== --- head/sysutils/cpupdate/distinfo Tue Mar 20 13:41:32 2018 (r465087) +++ head/sysutils/cpupdate/distinfo Tue Mar 20 14:56:15 2018 (r465088) @@ -1,7 +1,7 @@ -TIMESTAMP = 1521367334 +TIMESTAMP = 1521545124 SHA256 (microcode-20180312.tgz) = 0b381face2df1b0a829dc4fa8fa93f47f39e11b1c9c22ebd44f8614657c1e779 SIZE (microcode-20180312.tgz) = 3789662 -SHA256 (kernschmelze-cpupdate-g20180302-58bc0ca_GH0.tar.gz) = a44ff576290051b68241cb8e5af8874db8dbdb1d728a349d9ba1a174a5fc2483 -SIZE (kernschmelze-cpupdate-g20180302-58bc0ca_GH0.tar.gz) = 12574 +SHA256 (kernschmelze-cpupdate-g20180320-b0df539_GH0.tar.gz) = 5edb60b1ce5534f85c83676dc475e44800f4e5a2d4df7376ba0187e9b5cc17e9 +SIZE (kernschmelze-cpupdate-g20180320-b0df539_GH0.tar.gz) = 4566043 SHA256 (platomav-CPUMicrocodes-2ece631_GH0.tar.gz) = bc45bad50b1c2bf86e0a4810d98d8e84328e84dd506d45774079bc87cfb01e15 SIZE (platomav-CPUMicrocodes-2ece631_GH0.tar.gz) = 4577042 Added: head/sysutils/cpupdate/files/cpupdate.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cpupdate/files/cpupdate.in Tue Mar 20 14:56:15 2018 (r465088) @@ -0,0 +1,29 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: cpupdate +# REQUIRE: FILESYSTEMS kldxref +# BEFORE: netif +# KEYWORD: nojail + +# Add these lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# cpupdate_enable (bool): Set to NO by default. +# Set it to YES to enable cpupdate. +# cpupdate_flags (string): Command line flags for cpupdate. +# Default is "". + +. /etc/rc.subr + +name=cpupdate +rcvar=cpupdate_enable + +load_rc_config $name + +: ${cpupdate_enable:="NO"} +: ${cpupdate_flags="-w -u"} +command=%%PREFIX%%/sbin/${name} + +run_rc_command "$1" Added: head/sysutils/cpupdate/files/patch-cpupdate.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/cpupdate/files/patch-cpupdate.c Tue Mar 20 14:56:15 2018 (r465088) @@ -0,0 +1,45 @@ +--- cpupdate.c.orig 2018-03-20 04:24:53 UTC ++++ cpupdate.c +@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); + + #include <sys/queue.h> + #include <sys/param.h> ++#include <sys/linker.h> ++#include <sys/module.h> + #include <sys/types.h> + #include <sys/stat.h> + #include <sys/ioctl.h> +@@ -99,6 +101,16 @@ usage( void) + exit(EX_USAGE); + } + ++static int ++modload( const char *name) ++{ ++ if (modfind(name) < 0) ++ if (kldload(name) < 0 || modfind(name) < 0) { ++ warn("%s: module not found", name); ++ return 0; ++ } ++ return 1; ++} + + static int + cpu_getCoreNum( void) +@@ -111,6 +123,7 @@ cpu_getCoreNum( void) + if (dirp == NULL) { + r = -1; + } else { ++ modload("cpuctl"); + while ((direntry = readdir(dirp)) != NULL) { + if (direntry->d_namlen == 0) + continue; +@@ -466,7 +479,7 @@ main( int argc, char *argv[]) + #else + if (!r) { + INFO( 10, "No updating error.\n"); +- INFO( 10, "NOTICE: This FreeBSD version does not support registering new CPU features!\n", numCores); ++ INFO( 10, "NOTICE: This FreeBSD version does not support registering new CPU features!\n"); + handler->freeucodeinfo( &cpupbuf); + } + #endif Modified: head/sysutils/cpupdate/pkg-descr ============================================================================== --- head/sysutils/cpupdate/pkg-descr Tue Mar 20 13:41:32 2018 (r465087) +++ head/sysutils/cpupdate/pkg-descr Tue Mar 20 14:56:15 2018 (r465088) @@ -3,4 +3,8 @@ x86 CPU microcode utility for BSD. As of March 2018, it is still work in progress but should do its job for most cases already. +Note: update FreeBSD to version level 1101507 for 11.x or 1200055 for 12.0 +before building/using this utility if your microcode update brings +new CPU features like Indirect Branch Restricted Speculation (IBRS). + WWW: https://github.com/kernschmelze/cpupdate
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803201456.w2KEuFpa069353>