git: 8972ab311c75 - main - sysutils/cpu-microcode*: support early loading of AMD ucode
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 23 Feb 2024 17:29:17 UTC
The branch main has been updated by chs:
URL: https://cgit.FreeBSD.org/ports/commit/?id=8972ab311c750984f6936ea93e80642beb7f792a
commit 8972ab311c750984f6936ea93e80642beb7f792a
Author: Chuck Silvers <chs@FreeBSD.org>
AuthorDate: 2024-02-23 17:14:47 +0000
Commit: Chuck Silvers <chs@FreeBSD.org>
CommitDate: 2024-02-23 17:29:13 +0000
sysutils/cpu-microcode*: support early loading of AMD ucode
Install the AMD ucode in /boot/firmware for early loading just like
is done for intel. Update the instructions for early loading to
reflect that AMD is now supported too.
Sponsored By: Netflix
Reviewed by: jrm
Differential Revision: https://reviews.freebsd.org/D44025
---
sysutils/cpu-microcode-amd/Makefile | 11 ++++++++++-
sysutils/cpu-microcode-rc/files/pkg-message.in | 21 +++++++++++++--------
sysutils/cpu-microcode/Makefile | 3 ++-
3 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/sysutils/cpu-microcode-amd/Makefile b/sysutils/cpu-microcode-amd/Makefile
index 27c726759236..838e5ade7302 100644
--- a/sysutils/cpu-microcode-amd/Makefile
+++ b/sysutils/cpu-microcode-amd/Makefile
@@ -1,5 +1,6 @@
PORTNAME= microcode
PORTVERSION= 20231019
+PORTREVISION= 1
CATEGORIES= sysutils
MASTER_SITES= https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/amd-ucode/
PKGNAMEPREFIX= cpu-
@@ -24,6 +25,8 @@ ONLY_FOR_ARCHS= amd64 i386
RUN_DEPENDS= ${LOCALBASE}/etc/rc.d/microcode_update:sysutils/cpu-microcode-rc
DATADIR= ${PREFIX}/share/cpucontrol
+FWDIR= /boot/firmware
+
EXTRACT_CMD= ${CP}
EXTRACT_BEFORE_ARGS= # empty
EXTRACT_AFTER_ARGS= .
@@ -31,12 +34,18 @@ NO_ARCH= yes
NO_BUILD= yes
NO_WRKSUBDIR= yes
-PLIST_FILES= ${DISTFILES:S/^/${DATADIR}\//g:C/\?.*//}
+PLIST_FILES= ${DISTFILES:S/^/${DATADIR}\//g:C/\?.*//} \
+ ${FWDIR}/amd-ucode.bin
_REV= 06afd7f939c5b245b2af9e0fee13026f2aaf77fa
+post-extract:
+ ${CAT} ${WRKSRC}/microcode_amd* > ${WRKSRC}/amd-ucode.bin
+
do-install:
${MKDIR} ${STAGEDIR}${DATADIR}/
+ ${MKDIR} ${STAGEDIR}${FWDIR}
+ ${INSTALL_DATA} ${WRKSRC}/amd-ucode.bin ${STAGEDIR}${FWDIR}/
.for f in ${DISTFILES}
${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DATADIR}/${f:C/\?.*//}
.endfor
diff --git a/sysutils/cpu-microcode-rc/files/pkg-message.in b/sysutils/cpu-microcode-rc/files/pkg-message.in
index 8984694e5476..10c1816da5f7 100644
--- a/sysutils/cpu-microcode-rc/files/pkg-message.in
+++ b/sysutils/cpu-microcode-rc/files/pkg-message.in
@@ -4,23 +4,28 @@
This port includes an RC script, which is one of two methods to update
the CPU microcode on a FreeBSD system.
-1. The first method does not require the RC script included here and is
- only supported with Intel processors. It is the preferred method,
- because it ensures that any CPU features introduced by a microcode
- update are visible to the kernel by applying the update before the
- kernel performs CPU feature detection.
+1. Early loading.
+ This method does not use the RC script included here.
+ This is the preferred method, because it ensures that any CPU features
+ added or removed by a microcode update are visible to the kernel by
+ applying the update before the kernel performs CPU feature detection.
- To enable updates using the first method, add the following lines to
+ To enable updates using early loading, add the following lines to
/boot/loader.conf:
cpu_microcode_load="YES"
+
+ and the appropriate one of these lines:
+
cpu_microcode_name="/boot/firmware/intel-ucode.bin"
+ cpu_microcode_name="/boot/firmware/amd-ucode.bin"
The microcode update will be loaded when the system is rebooted.
-2. The second method, which uses the RC script included here, can be
- enabled by adding the following line to /etc/rc.conf:
+2. Late loading.
+ This method, which does use the RC script included here, is enabled by
+ adding the following line to /etc/rc.conf:
microcode_update_enable="YES"
diff --git a/sysutils/cpu-microcode/Makefile b/sysutils/cpu-microcode/Makefile
index 1661c015fd2b..a6075a1cc5b8 100644
--- a/sysutils/cpu-microcode/Makefile
+++ b/sysutils/cpu-microcode/Makefile
@@ -1,5 +1,6 @@
PORTNAME= microcode
PORTVERSION= 1.0
+PORTREVISION= 1
CATEGORIES= sysutils
PKGNAMEPREFIX= cpu-
@@ -8,7 +9,7 @@ COMMENT= Meta-package for CPU microcode updates
ONLY_FOR_ARCHS= amd64 i386
-RUN_DEPENDS= ${LOCALBASE}/share/cpucontrol/microcode_amd.bin:sysutils/cpu-microcode-amd \
+RUN_DEPENDS= /boot/firmware/amd-ucode.bin:sysutils/cpu-microcode-amd \
/boot/firmware/intel-ucode.bin:sysutils/cpu-microcode-intel
USES= metaport