From: Guido Trentalancia <guido-D1bseh+SzQhuxeB9wqlrNw@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] dracut: add support for updating the CPU microcode
Date: Sat, 16 Apr 2016 01:18:52 +0200 [thread overview]
Message-ID: <1460762332.3054.2.camel@trentalancia.net> (raw)
This is the initial version of a new "microcode" dracut module
that can be used to update the microcode on Intel(R) CPUs.
Signed-off-by: Guido Trentalancia <guido-D1bseh+SzQhuxeB9wqlrNw@public.gmane.org>
---
modules.d/00microcode/module-setup.sh | 26 ++++++++++++++++++++++++++
modules.d/99base/init.sh | 9 +++++++++
2 files changed, 35 insertions(+)
diff -pruN dracut-git/modules.d/00microcode/module-setup.sh dracut-git-microcode-update/modules.d/00microcode/module-setup.sh
--- dracut-git/modules.d/00microcode/module-setup.sh 1970-01-01 01:00:00.000000000 +0100
+++ dracut-git-microcode-update/modules.d/00microcode/module-setup.sh 2016-04-16 01:11:20.719287468 +0200
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Dracut module to update the microcode on Intel(R) CPUs
+# Copyright 2016 Guido Trentalancia <guido-D1bseh+SzQhuxeB9wqlrNw@public.gmane.org>
+
+# called by dracut
+check() {
+ [[ "$mount_needs" ]] && return 1
+
+ require_binaries microcode_ctl || return 1
+
+ return 0
+}
+
+# called by dracut
+depends() {
+ return 0
+}
+
+# called by dracut
+install() {
+ inst microcode_ctl
+
+ inst_dir /lib/firmware
+ inst /lib/firmware/microcode.dat
+}
diff -pruN dracut-git/modules.d/99base/init.sh dracut-git-microcode-update/modules.d/99base/init.sh
--- dracut-git/modules.d/99base/init.sh 2016-04-14 22:21:22.681548895 +0200
+++ dracut-git-microcode-update/modules.d/99base/init.sh 2016-04-16 01:09:58.517080944 +0200
@@ -62,6 +62,15 @@ if ! ismounted /dev/shm; then
mount -t tmpfs -o mode=1777,noexec,nosuid,nodev,strictatime tmpfs /dev/shm >/dev/null
fi
+# Update CPU microcode
+if [ -x /usr/sbin/microcode_ctl ]; then
+ MICROCODE_CTL=/usr/sbin/microcode_ctl
+elif [ -x /sbin/microcode_ctl ]; then
+ MICROCODE_CTL=/sbin/microcode_ctl
+fi
+[ $MICROCODE_CTL ] && [ ! -e /dev/cpu/microcode ] && echo "Creating microcode update device..." && mknod /dev/cpu/microcode c 10 184
+[ $MICROCODE_CTL ] && [ -e /lib/firmware/microcode.dat ] && $MICROCODE_CTL -u
+
if ! ismounted /run; then
mkdir -m 0755 /newrun
if ! str_starts "$(readlink -f /bin/sh)" "/run/"; then
next reply other threads:[~2016-04-15 23:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 23:18 Guido Trentalancia [this message]
[not found] ` <1460762332.3054.2.camel-D1bseh+SzQhuxeB9wqlrNw@public.gmane.org>
2016-04-16 6:01 ` [PATCH] dracut: add support for updating the CPU microcode Andrei Borzenkov
[not found] ` <5711D522.3090907-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-16 13:54 ` Guido Trentalancia
[not found] ` <1460814862.4296.4.camel-D1bseh+SzQhuxeB9wqlrNw@public.gmane.org>
2016-04-16 15:20 ` Alexander E. Patrakov
[not found] ` <5712582A.2090502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-04-16 21:05 ` Guido Trentalancia
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1460762332.3054.2.camel@trentalancia.net \
--to=guido-d1bseh+szqhuxeb9wqlrnw@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).