Skip to content

Commit

Permalink
cpu-microcode-intel: Add knobs for RC RUN_DEPENDS and split files
Browse files Browse the repository at this point in the history
Split UCODE files as well as dependency on sysutils/cpu-microcode-rc
are only required for use with cpucontrol(8) and update method two
respectively. The first method needs neither so we can spare a few
MiB and a superfluous port.
Given that the automatic update method one is superior, the RC knob
should be deprecated and removed eventually. At that point, split
UCODE files still will be useful for developers and if users want
to update the microcode without a reboot (but otherwise rely on the
loader for automatic updates, i. e. method one).

Reviewed by:	jrm (w/ style suggestions)
Approved by:	jrm (upcoming maintainer)
Differential Revision:	https://reviews.freebsd.org/D41904
  • Loading branch information
sparcplug committed Nov 9, 2023
1 parent 1216489 commit d12bc36
Show file tree
Hide file tree
Showing 2 changed files with 233 additions and 217 deletions.
28 changes: 22 additions & 6 deletions sysutils/cpu-microcode-intel/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PORTNAME= microcode
DISTVERSIONPREFIX= microcode-
DISTVERSION= 20230808
PORTREVISION= 1
CATEGORIES= sysutils
PKGNAMEPREFIX= cpu-
PKGNAMESUFFIX= -intel
Expand All @@ -16,9 +17,20 @@ LICENSE_PERMS= dist-mirror no-dist-sell pkg-mirror no-pkg-sell auto-accept

ONLY_FOR_ARCHS= amd64 i386

RUN_DEPENDS= ${LOCALBASE}/etc/rc.d/microcode_update:sysutils/cpu-microcode-rc

USES= cpe

OPTIONS_DEFINE= RC SPLIT
OPTIONS_DEFAULT= ${OPTIONS_DEFINE}
OPTIONS_SUB= yes

RC_DESC= Depend on RC script port (automatic update method two)
SPLIT_DESC= Install split files (for cpucontrol(8) and RC script)

RC_IMPLIES= SPLIT
RC_RUN_DEPENDS= ${LOCALBASE}/etc/rc.d/microcode_update:sysutils/cpu-microcode-rc

SPLIT_VARS_OFF= NO_BUILD=yes

CPE_PART= o
CPE_VENDOR= intel
CPE_PRODUCT= microcode
Expand All @@ -33,16 +45,20 @@ NO_ARCH= yes
NO_WRKSUBDIR= yes

post-extract:
${CP} -p ${FILESDIR}/Makefile ${FILESDIR}/ucode-split.c ${WRKSRC}
${REINPLACE_CMD} 's|%%GH_TAGNAME%%|${GH_TAGNAME}|g' ${WRKSRC}/Makefile
${CAT} ${WRKSRC}/Intel-Linux-Processor-Microcode-Data-Files-${GH_TAGNAME}/intel-ucode/* \
${WRKSRC}/Intel-Linux-Processor-Microcode-Data-Files-${GH_TAGNAME}/intel-ucode-with-caveats/* \
> ${WRKSRC}/intel-ucode.bin

post-extract-SPLIT-on:
${CP} -p ${FILESDIR}/Makefile ${FILESDIR}/ucode-split.c ${WRKSRC}
${REINPLACE_CMD} 's|%%GH_TAGNAME%%|${GH_TAGNAME}|g' ${WRKSRC}/Makefile

do-install:
${MKDIR} ${STAGEDIR}${DATADIR}/
${INSTALL_DATA} ${WRKSRC}/mcodes/* ${STAGEDIR}${DATADIR}/
${MKDIR} ${STAGEDIR}${FWDIR}
${INSTALL_DATA} ${WRKSRC}/intel-ucode.bin ${STAGEDIR}${FWDIR}/

do-install-SPLIT-on:
${MKDIR} ${STAGEDIR}${DATADIR}/
${INSTALL_DATA} ${WRKSRC}/mcodes/* ${STAGEDIR}${DATADIR}/

.include <bsd.port.mk>

0 comments on commit d12bc36

Please sign in to comment.