From cef4580bcfeed80ac9122c293a2bbf5eaaccf146 Mon Sep 17 00:00:00 2001 From: Stanislav Sedov Date: Thu, 1 Feb 2007 21:52:14 +0000 Subject: - 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. --- sysutils/devcpu/Makefile | 21 +++++++++++++++- sysutils/devcpu/distinfo | 6 ++--- sysutils/devcpu/files/devcpu.in | 54 +++++++++++++++++++++++++++++++++++++++++ sysutils/devcpu/pkg-message | 10 +++++++- sysutils/devcpu/pkg-plist | 2 ++ 5 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 sysutils/devcpu/files/devcpu.in (limited to 'sysutils/devcpu') diff --git a/sysutils/devcpu/Makefile b/sysutils/devcpu/Makefile index d63ccc9265b5..c531c7924f08 100644 --- a/sysutils/devcpu/Makefile +++ b/sysutils/devcpu/Makefile @@ -6,7 +6,7 @@ # PORTNAME= devcpu -PORTVERSION= 0.7 +PORTVERSION= 0.8 PORTREVISION= 0 CATEGORIES= sysutils MASTER_SITES= http://mbsd.msk.ru/dist/ @@ -15,6 +15,11 @@ MAINTAINER= stas@FreeBSD.org COMMENT= Kernel module that provides access to i386 MSRs and cpuid info USE_BZIP2= yes +USE_RC_SUBR= devcpu +USE_RUBY= yes +RUBY_NO_BUILD_DEPENDS= yes +RUBY_NO_RUN_DEPENDS= yes +RUBY_SHEBANG_FILES= tools/extract_mcodes.rb ONLY_FOR_ARCHS= i386 amd64 NO_PACKAGE= depends on kernel @@ -23,6 +28,8 @@ PLIST_SUB= KMODDIR="${KMODDIR:C,^/,,}" KMODDIR= /boot/modules MAKE_ENV+= KMODDIR="${KMODDIR}" +OPTIONS= EXTRACTOR "Install Award Bios microcode extracting utility" off + MAN4= cpu.4 MAN8= cpu_microcode_tool.8 @@ -32,6 +39,14 @@ MAN8= cpu_microcode_tool.8 IGNORE= not supported .endif +.if defined(WITH_EXTRACTOR) +RUN_DEPENDS+= ${RUBY_SITEARCHLIBDIR}/mmap.so:${PORTSDIR}/devel/ruby-mmap \ + ${RUBY_SITEARCHLIBDIR}/lhalib.so:${PORTSDIR}/archivers/ruby-lha +PLIST_SUB+= EXTRACTOR="" +.else +PLIST_SUB+= EXTRACTOR="@comment " +.endif + MAKE_ENV+= KMODDIR="${KMODDIR}" \ BINDIR="${PREFIX}/bin" @@ -57,6 +72,10 @@ post-install: ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}/ .endif +.if defined(WITH_EXTRACTOR) + ${INSTALL_SCRIPT} ${WRKSRC}/tools/extract_mcodes.rb ${PREFIX}/libexec/ +.endif + @${CAT} ${PKGMESSAGE} .include diff --git a/sysutils/devcpu/distinfo b/sysutils/devcpu/distinfo index 8fed66908c43..4b76f4c5ca3c 100644 --- a/sysutils/devcpu/distinfo +++ b/sysutils/devcpu/distinfo @@ -1,3 +1,3 @@ -MD5 (devcpu-0.7.tar.bz2) = 351f21ce145d77218ced07ba7f3c98fe -SHA256 (devcpu-0.7.tar.bz2) = 1f0f6a1f5eebe920c5ad15261d08d6f5f4d09243e8d5fbba7f14e5014bb3627a -SIZE (devcpu-0.7.tar.bz2) = 424032 +MD5 (devcpu-0.8.tar.bz2) = ff996a41ab326a0f3186e6dca95993b9 +SHA256 (devcpu-0.8.tar.bz2) = 01c94462decb99be37e6ddd1ec81782fde4c242b1304a49ab8fa064a67bfb2e6 +SIZE (devcpu-0.8.tar.bz2) = 427743 diff --git a/sysutils/devcpu/files/devcpu.in b/sysutils/devcpu/files/devcpu.in new file mode 100644 index 000000000000..957bf1942888 --- /dev/null +++ b/sysutils/devcpu/files/devcpu.in @@ -0,0 +1,54 @@ +#!/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" diff --git a/sysutils/devcpu/pkg-message b/sysutils/devcpu/pkg-message index 0e4b3b99955b..6e002a305547 100644 --- a/sysutils/devcpu/pkg-message +++ b/sysutils/devcpu/pkg-message @@ -9,9 +9,17 @@ To load it, issue Then you can access MSR registers or cpuid info via /dev/cpu%d or using 3d-party programs, e.g. x86info. -For information regarding microcode update feature refer to +For information regarding microcode update features refer to cpu_mictocode_tool(4) manpage. +You might be interested in enabling automatic microcode update on startup. +This can be achieved by adding the line devcpu_enable="YES" to /etc/rc.conf. +Refer to rcNG devcpu script for additional info. + +You can also use extract_mcodes.rb utility to extract cpucode updates +from vendor-supplied BIOS updates. The utility currently supports only +Award/Phoenix-compatible BIOS images. + Please, report any problems to maintainer. Thanks! ============================================================================= diff --git a/sysutils/devcpu/pkg-plist b/sysutils/devcpu/pkg-plist index 2d7dc1d0c909..a75b3bc85299 100644 --- a/sysutils/devcpu/pkg-plist +++ b/sysutils/devcpu/pkg-plist @@ -57,6 +57,7 @@ include/cpu.h %%DATADIR%%/MU268310.fw %%DATADIR%%/MU268602.fw %%DATADIR%%/MU26a401.fw +%%DATADIR%%/amd4.fw %%DATADIR%%/bu27_fb.fw %%DATADIR%%/d2_619.fw %%DATADIR%%/k8_ucode_0f48.fw @@ -115,6 +116,7 @@ include/cpu.h %%DATADIR%%/mu26732e.fw %%DATADIR%%/mu26a003.fw %%DATADIR%%/mu26a101.fw +%%EXTRACTOR%%libexec/extract_mcodes.rb %%PORTDOCS%%%%DOCSDIR%%/README %%PORTDOCS%%@dirrm %%DOCSDIR%% @dirrm %%DATADIR%% -- cgit v1.2.3