Skip to contentSkip to conversation

update/improve intel-microcode and iucode-tool

PATCH New Carlos Santos 2 participants 9 messages Nov 4, 2018 – Nov 12, 2018

lore
Share & tools
lore
#0 lore raw

cover update/improve intel-microcode and iucode-tool

Patch 1 enables MICROCODE_INTEL if intel-microcode is selected, since otherwise it's impossible to load microcode (by means of iucode-tools).

Patch 2 updates intel-microcode to the latest version and moves its installation path from /usr/share/misc/ to /lib/firmware/, along with the files installed by linux-firmware. That path is also used by other Linux distros (e.g. Ubuntu). Notice that the package now installs 100 binary files under /lib/firmware/intel-ucode/ instead of a big text file at /usr/share/misc/intel-microcode.dat.

Patch 3 updates iucode-tool to the latest version.

Patch 4 updates the iucode-tool init script. That's what I was doing initially. All other patches are just a consequence ot the "plucking a feather brings a hen" effect.

Patches 1, 2 and 3 can be applied in any order (I tested this) but patch 4 is on top of patch 2.

Carlos Santos (4):
linux: enable MICROCODE_INTEL if intel-microcode is selected
intel-microcode: bump to version 20180807a
iucode-tool: bump to version 2.3.1
iucode-tool: rewrite init script

 linux/linux.mk                               |  3 ++
 package/intel-microcode/intel-microcode.hash |  4 +-
 package/intel-microcode/intel-microcode.mk   | 16 +++-----
 package/iucode-tool/S00iucode-tool           | 39 ++++++++++++--------
 package/iucode-tool/iucode-tool.hash         |  2 +-
 package/iucode-tool/iucode-tool.mk           |  2 +-
 6 files changed, 36 insertions(+), 30 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/4 linux: enable MICROCODE_INTEL if intel-microcode is selected

We already turn on kernel features for several packages, so let's do it for intel-microcode too, otherwise it's impossible to load the microcode (by means of iucode-tools).

---
 linux/linux.mk | 3 +++
 1 file changed, 3 insertions(+)
linux/linux.mk +3 -0
index 476ff16329..b0cdbe933d 100644
@@ -323,6 +323,9 @@ define LINUX_KCONFIG_FIXUP_CMDS
 	$(if $(BR2_PACKAGE_AUDIT),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_NET,$(@D)/.config)
 		$(call KCONFIG_ENABLE_OPT,CONFIG_AUDIT,$(@D)/.config))
+	$(if $(BR2_PACKAGE_INTEL_MICROCODE),
+		$(call KCONFIG_ENABLE_OPT,CONFIG_MICROCODE,$(@D)/.config)
+		$(call KCONFIG_ENABLE_OPT,CONFIG_MICROCODE_INTEL,$(@D)/.config))
 	$(if $(BR2_PACKAGE_KTAP),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_DEBUG_FS,$(@D)/.config)
 		$(call KCONFIG_ENABLE_OPT,CONFIG_ENABLE_DEFAULT_TRACERS,$(@D)/.config)
Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/4 linux: enable MICROCODE_INTEL if intel-microcode is selected

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

We already turn on kernel features for several packages, so let's do it for intel-microcode too, otherwise it's impossible to load the microcode (by means of iucode-tools).

Committed to next, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 2/4 intel-microcode: bump to version 20180807a

In reply to Carlos Santos

The big "intel-microcode.dat" text file is gone. Only binary files are provided, in the "intel-ucode" directory. Install it at /lib/firmware/, like linux-firmware does, and update the iucode-tool init script to use that path.

We don't install the microcode under "intel-ucode-with-caveats", since it needs special commits in the Linux kernel (see "relnotes" for more information).

Tested on an equipment with Intel C3000 processor.

---
 package/intel-microcode/intel-microcode.hash |  4 ++--
 package/intel-microcode/intel-microcode.mk   | 16 +++++-----------
 package/iucode-tool/S00iucode-tool           |  4 ++--
 3 files changed, 9 insertions(+), 15 deletions(-)
package/intel-microcode/intel-microcode.hash +2 -2
index 999b27299d..183ba5aeec 100644
@@ -1,3 +1,3 @@
 # Locally computed
-sha256 0b381face2df1b0a829dc4fa8fa93f47f39e11b1c9c22ebd44f8614657c1e779  microcode-20180312.tgz
-sha256 6d4deb65ca688d930e188bf93f78430f134097b161e6df4a2ef00728e14965e3  license.txt
+sha256 46ab18699ec42eb6cc01ee1846ec4d7ca979766dee2156f92d69e2f6df548137  microcode-20180807a.tgz
+sha256 c4698c6105d59fec11ad0929e77a003445c560c7706c089990030acbf10c9372  license
package/intel-microcode/intel-microcode.mk +5 -11
index e3134b6408..2113873509 100644
@@ -4,23 +4,17 @@
 #
 ################################################################################
 
-INTEL_MICROCODE_VERSION = 20180312
+INTEL_MICROCODE_VERSION = 20180807a
 INTEL_MICROCODE_SOURCE = microcode-$(INTEL_MICROCODE_VERSION).tgz
-INTEL_MICROCODE_SITE = http://downloadmirror.intel.com/27591/eng
+INTEL_MICROCODE_SITE = https://downloadmirror.intel.com/28087/eng
 INTEL_MICROCODE_STRIP_COMPONENTS = 0
 INTEL_MICROCODE_LICENSE = PROPRIETARY
-INTEL_MICROCODE_LICENSE_FILES = license.txt
+INTEL_MICROCODE_LICENSE_FILES = license
 INTEL_MICROCODE_REDISTRIBUTE = NO
 
-define INTEL_MICROCODE_EXTRACT_LICENSE
-	head -n 33 $(@D)/microcode.dat > $(@D)/license.txt
-endef
-
-INTEL_MICROCODE_POST_EXTRACT_HOOKS += INTEL_MICROCODE_EXTRACT_LICENSE
-
 define INTEL_MICROCODE_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 0644 $(@D)/microcode.dat \
-		$(TARGET_DIR)/usr/share/misc/intel-microcode.dat
+	$(INSTALL) -D -m 0644 -t $(TARGET_DIR)/lib/firmware/intel-ucode \
+		$(@D)/intel-ucode/*
 endef
 
 $(eval $(generic-package))
package/iucode-tool/S00iucode-tool +2 -2
index 0c1e409de2..a97b33c045 100644
@@ -3,12 +3,12 @@
 # Upload microcode into the processor.
 #
 
-microcode_file="/usr/share/misc/intel-microcode.dat"
+MICROCODE_DIR="/lib/firmware/intel-ucode"
 
 case "$1" in
   start)
 	echo "Starting iucode-tool:"
-	/usr/sbin/iucode_tool -k $microcode_file
+	/usr/sbin/iucode_tool -k "$MICROCODE_DIR"
 	echo "done"
 	;;
   stop)
Signature · 1 line
2.17.1
#4 lore raw

PATCH 2/4 intel-microcode: bump to version 20180807a

Quoted 69 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

The big "intel-microcode.dat" text file is gone. Only binary files are provided, in the "intel-ucode" directory. Install it at /lib/firmware/, like linux-firmware does, and update the iucode-tool init script to use that path.

We don't install the microcode under "intel-ucode-with-caveats", since it needs special commits in the Linux kernel (see "relnotes" for more information).

Tested on an equipment with Intel C3000 processor.

---
 package/intel-microcode/intel-microcode.hash |  4 ++--
 package/intel-microcode/intel-microcode.mk   | 16 +++++-----------
 package/iucode-tool/S00iucode-tool           |  4 ++--
 3 files changed, 9 insertions(+), 15 deletions(-)
package/intel-microcode/intel-microcode.hash +2 -2
index 999b27299d..183ba5aeec 100644
@@ -1,3 +1,3 @@
 # Locally computed
-sha256 0b381face2df1b0a829dc4fa8fa93f47f39e11b1c9c22ebd44f8614657c1e779  microcode-20180312.tgz
-sha256 6d4deb65ca688d930e188bf93f78430f134097b161e6df4a2ef00728e14965e3  license.txt
+sha256 46ab18699ec42eb6cc01ee1846ec4d7ca979766dee2156f92d69e2f6df548137  microcode-20180807a.tgz
+sha256 c4698c6105d59fec11ad0929e77a003445c560c7706c089990030acbf10c9372  license
package/intel-microcode/intel-microcode.mk +5 -11
index e3134b6408..2113873509 100644
@@ -4,23 +4,17 @@
 #
 ################################################################################
 
-INTEL_MICROCODE_VERSION = 20180312
+INTEL_MICROCODE_VERSION = 20180807a
 INTEL_MICROCODE_SOURCE = microcode-$(INTEL_MICROCODE_VERSION).tgz
-INTEL_MICROCODE_SITE = http://downloadmirror.intel.com/27591/eng
+INTEL_MICROCODE_SITE = https://downloadmirror.intel.com/28087/eng
 INTEL_MICROCODE_STRIP_COMPONENTS = 0
 INTEL_MICROCODE_LICENSE = PROPRIETARY
-INTEL_MICROCODE_LICENSE_FILES = license.txt
+INTEL_MICROCODE_LICENSE_FILES = license
 INTEL_MICROCODE_REDISTRIBUTE = NO
 
-define INTEL_MICROCODE_EXTRACT_LICENSE
-	head -n 33 $(@D)/microcode.dat > $(@D)/license.txt
-endef
-
-INTEL_MICROCODE_POST_EXTRACT_HOOKS += INTEL_MICROCODE_EXTRACT_LICENSE
-
 define INTEL_MICROCODE_INSTALL_TARGET_CMDS
-	$(INSTALL) -D -m 0644 $(@D)/microcode.dat \
-		$(TARGET_DIR)/usr/share/misc/intel-microcode.dat
+	$(INSTALL) -D -m 0644 -t $(TARGET_DIR)/lib/firmware/intel-ucode \
+		$(@D)/intel-ucode/*
 endef
 
 $(eval $(generic-package))
package/iucode-tool/S00iucode-tool +0 -0
index 0c1e409de2..a97b33c045 100644
@@ -3,12 +3,12 @@
 # Upload microcode into the processor.

package/iucode-tool/S00iucode-tool line 11

Quoted 10 lines
package/iucode-tool/S00iucode-tool +2 -2
 #
 
-microcode_file="/usr/share/misc/intel-microcode.dat"
+MICROCODE_DIR="/lib/firmware/intel-ucode"
 
 case "$1" in
   start)
 	echo "Starting iucode-tool:"
-	/usr/sbin/iucode_tool -k $microcode_file
+	/usr/sbin/iucode_tool -k "$MICROCODE_DIR"

Is iucode_tool even needed when the microcode us located under /lib/firmware/intel-ucode? From a quick look in the kernel it seems like it is loading it directly with request_firmware().

Committed to next, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 3/4 iucode-tool: bump to version 2.3.1

In reply to Carlos Santos

Brings several fixes and enhancements. Check the change log at

    https://gitlab.com/iucode-tool/iucode-tool/raw/v2.3.1/ChangeLog

Tested on an equipment with Intel C3000 processor.

---
 package/iucode-tool/iucode-tool.hash | 2 +-
 package/iucode-tool/iucode-tool.mk   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
package/iucode-tool/iucode-tool.hash +1 -1
index 1dab8de978..6d8fb635d0 100644
@@ -1,3 +1,3 @@
 # Locally computed
-sha256 9810daf925b8a9ca244adc4e1916bcab65601c9ebe87e91c2281f78055982971  iucode-tool_2.2.tar.xz
+sha256 12b88efa4d0d95af08db05a50b3dcb217c0eb2bfc67b483779e33d498ddb2f95  iucode-tool_2.3.1.tar.xz
 sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6  COPYING
package/iucode-tool/iucode-tool.mk +1 -1
index 38f9da438e..e900888d7d 100644
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-IUCODE_TOOL_VERSION = 2.2
+IUCODE_TOOL_VERSION = 2.3.1
 IUCODE_TOOL_SOURCE = iucode-tool_$(IUCODE_TOOL_VERSION).tar.xz
 IUCODE_TOOL_SITE = https://gitlab.com/iucode-tool/releases/raw/master
 ifeq ($(BR2_PACKAGE_ARGP_STANDALONE),y)
Signature · 1 line
2.17.1
#7 lore raw

PATCH 4/4 iucode-tool: rewrite init script

In reply to Carlos Santos

- Indent with tabs.
- Use a function for start.
- Use a dummy function that reports OK for stop, restart and reload.
- Pass "-q" to iucode_tool to inhipt usual output taht would otherwise interfere with the operation status report.

---
 package/iucode-tool/S00iucode-tool | 37 +++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 14 deletions(-)
package/iucode-tool/S00iucode-tool +23 -14
index a97b33c045..eb9f93ad6e 100644
@@ -5,19 +5,28 @@
 
 MICROCODE_DIR="/lib/firmware/intel-ucode"
 
+start() {
+	printf 'Starting iucode-tool: '
+	/usr/sbin/iucode_tool -q -k "$MICROCODE_DIR"
+	status="$?"
+	if [ "$status" = 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+dummy() {
+	echo "$1" | sed 's/^./\U&\E/;s/p/pp/;s/$/ing iucode-tool: OK/'
+}
+
 case "$1" in
-  start)
-	echo "Starting iucode-tool:"
-	/usr/sbin/iucode_tool -k "$MICROCODE_DIR"
-	echo "done"
-	;;
-  stop)
-	;;
-  restart|reload)
-	;;
-  *)
-	echo "Usage: $0 {start|stop|restart}"
-	exit 1
+	start)
+		start;;
+	stop|restart|reload)
+		dummy "$1";;
+	*)
+		echo "Usage: $0 {start|stop|restart}"
+		exit 1
 esac
-
-exit $?
Signature · 1 line
2.17.1
#8 lore raw

PATCH 4/4 iucode-tool: rewrite init script

Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Carlos" == Carlos Santos <[email protected]> writes:

- Indent with tabs.
- Use a function for start.
- Use a dummy function that reports OK for stop, restart and reload.
- Pass "-q" to iucode_tool to inhipt usual output taht would otherwise

s/inhipt/inhibit/
s/taht/that/

Quoted 19 lines

interfere with the operation status report.

---
 package/iucode-tool/S00iucode-tool | 37 +++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 14 deletions(-)
package/iucode-tool/S00iucode-tool +4 -0
index a97b33c045..eb9f93ad6e 100644
@@ -5,19 +5,28 @@
 
 MICROCODE_DIR="/lib/firmware/intel-ucode"
 
+start() {
+	printf 'Starting iucode-tool: '
+	/usr/sbin/iucode_tool -q -k "$MICROCODE_DIR"
+	status="$?"

package/iucode-tool/S00iucode-tool line 21

Quoted 10 lines
package/iucode-tool/S00iucode-tool +10 -0
+	if [ "$status" = 0 ]; then
+		echo "OK"
+	else
+		echo "FAIL"
+	fi
+	return "$status"
+}
+
+dummy() {
+	echo "$1" | sed 's/^./\U&\E/;s/p/pp/;s/$/ing iucode-tool: OK/'

This is IMHO not very readable, and busybox sed doesn't like it:

# echo 'stop' | sed 's/^./\U&\E/;s/p/pp/;s/$/ing iucode-tool: OK/'
UsEtopping iucode-tool: OK

So I've dropped this and committed to next, thanks.

Quoted 11 lines
package/iucode-tool/S00iucode-tool +2 -8
+}
+
 case "$1" in
-  start)
-	echo "Starting iucode-tool:"
-	/usr/sbin/iucode_tool -k "$MICROCODE_DIR"
-	echo "done"
-	;;
-  stop)
-	;;
-  restart|reload)

package/iucode-tool/S00iucode-tool line 30

Quoted 10 lines
package/iucode-tool/S00iucode-tool +6 -4
-	;;
-  *)
-	echo "Usage: $0 {start|stop|restart}"
-	exit 1
+	start)
+		start;;
+	stop|restart|reload)
+		dummy "$1";;
+	*)
+		echo "Usage: $0 {start|stop|restart}"

You forgot to document "reload".

Signature · 1 line
Bye, Peter Korsgaard