[arch-commits] Commit in intel-ucode/trunk (3 files)

Thomas Bächler thomas at archlinux.org
Sun Oct 12 12:14:37 UTC 2014


    Date: Sunday, October 12, 2014 @ 14:14:37
  Author: thomas
Revision: 224237

upgpkg: intel-ucode 20140913-1 - change upgrade method

Added:
  intel-ucode/trunk/intel-ucode.install
Modified:
  intel-ucode/trunk/PKGBUILD
  intel-ucode/trunk/intel-microcode2ucode.c

-------------------------+
 PKGBUILD                |   18 ++++++++++++------
 intel-microcode2ucode.c |   33 ++++++++++++---------------------
 intel-ucode.install     |   12 ++++++++++++
 3 files changed, 36 insertions(+), 27 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-10-12 09:45:25 UTC (rev 224236)
+++ PKGBUILD	2014-10-12 12:14:37 UTC (rev 224237)
@@ -2,21 +2,22 @@
 # Maintainer: Thomas Bächler <thomas at archlinux.org>
 
 pkgname=intel-ucode
-pkgver=20140624
+pkgver=20140913
 pkgrel=1
 pkgdesc="Microcode update files for Intel CPUs"
 arch=('any')
+install=$pkgname.install
 url="http://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22"
 replaces=('microcode_ctl')
 license=('custom')
 # Some random "download id" that intel has in their downloadcenter
-_dlid=23984
+_dlid=24290
 source=(http://downloadmirror.intel.com/${_dlid}/eng/microcode-${pkgver}.tgz
         LICENSE
         intel-microcode2ucode.c)
-sha256sums=('b4662ac780438a7b2d87e6d26a7066feb807f37c6e5b6fa147089f4edb02ea37'
+sha256sums=('ea6c0ee21d1fbf261f093176a78089c21411e5fe0e2c35b258cedf2b39987e15'
             '6983e83ec10c6467fb9101ea496e0443f0574c805907155118e2c9f0bbea97b6'
-            'c51b1b1d8b4b28e7d5d007917c1e444af1a2ff04a9408aa9067c0e57d70164de')
+            '03a13a966316a4d3d9c7e1b46007fd4b80911aea5ddd957ddf33ce660efe03de')
 
 build() {
   cd "$srcdir"
@@ -26,7 +27,12 @@
 
 package() {
   cd "$srcdir"
-  install -d -m755 "${pkgdir}"/usr/lib/firmware/intel-ucode/
-  cp intel-ucode/* "${pkgdir}"/usr/lib/firmware/intel-ucode/
+
+  install -d -m755 "${pkgdir}"/boot
+
+  mkdir -p kernel/x86/microcode
+  mv microcode.bin kernel/x86/microcode/GenuineIntel.bin
+  echo kernel/x86/microcode/GenuineIntel.bin | bsdcpio -o -H newc -R 0:0 > "${pkgdir}"/boot/intel-ucode.img
+  
   install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
 }

Modified: intel-microcode2ucode.c
===================================================================
--- intel-microcode2ucode.c	2014-10-12 09:45:25 UTC (rev 224236)
+++ intel-microcode2ucode.c	2014-10-12 12:14:37 UTC (rev 224237)
@@ -1,13 +1,8 @@
 /*
- * Convert Intel microcode.dat into individual ucode files
- * named: intel-ucode/$family-$model-$stepping
+ * Convert Intel microcode.dat into a single binary microcode.bin file
  *
- * The subdir intel-ucode/ is created in the current working
- * directory. We get multiple ucodes in the same file, so they
- * are appended to an existing file. Make sure the directory
- * is empty before every run of the converter.
- *
- * Kay Sievers <kay.sievers at vrfy.org>
+ * Based on code by Kay Sievers <kay.sievers at vrfy.org>
+ * Changed to create a single file by Thomas Bächler <thomas at archlinux.org>
  */
 
 
@@ -48,7 +43,7 @@
 
 int main(int argc, char *argv[])
 {
-	char *filename = "/lib/firmware/microcode.dat";
+	const char *filename = "/lib/firmware/microcode.dat";
 	FILE *f;
 	char line[LINE_MAX];
 	char buf[4000000];
@@ -89,7 +84,12 @@
 	if (bufsize < sizeof(struct microcode_header_intel))
 		goto out;
 
-	mkdir("intel-ucode", 0750);
+	f = fopen("microcode.bin", "we");
+	if (f == NULL) {
+		printf("open microcode.bin: %m\n");
+		rc = EXIT_FAILURE;
+		goto out;
+	}
 
 	start = 0;
 	for (;;) {
@@ -130,9 +130,7 @@
 		month = mc->hdr.date >> 24;
 		day = (mc->hdr.date >> 16) & 0xff;
 
-		asprintf(&filename, "intel-ucode/%02x-%02x-%02x", family, model, stepping);
 		printf("\n");
-		printf("%s\n", filename);
 		printf("signature: 0x%02x\n", mc->hdr.sig);
 		printf("flags:     0x%02x\n", mc->hdr.pf);
 		printf("revision:  0x%02x\n", mc->hdr.rev);
@@ -139,24 +137,17 @@
 		printf("date:      %04x-%02x-%02x\n", year, month, day);
 		printf("size:      %zu\n", size);
 
-		f = fopen(filename, "ae");
-		if (f == NULL) {
-			printf("open %s: %m\n", filename);
-			rc = EXIT_FAILURE;
-			goto out;
-		}
 		if (fwrite(mc, size, 1, f) != 1) {
-			printf("write %s: %m\n", filename);
+			printf("write microcode.bin: %m\n");
 			rc = EXIT_FAILURE;
 			goto out;
 		}
-		fclose(f);
-		free(filename);
 
 		start += size;
 		if (start >= bufsize)
 			break;
 	}
+	fclose(f);
 	printf("\n");
 out:
 	return rc;

Added: intel-ucode.install
===================================================================
--- intel-ucode.install	                        (rev 0)
+++ intel-ucode.install	2014-10-12 12:14:37 UTC (rev 224237)
@@ -0,0 +1,12 @@
+## arg 1:  the new package version
+## arg 2:  the old package version
+post_upgrade() {
+  if [ $(vercmp $2 20140913) -lt 0 ]; then
+    echo "Intel CPU ucode upgrades are no longer performed by the firmware loader."
+    echo "If you want to update the Intel CPU ucode on boot, add the file"
+    echo " /boot/intel-ucode.img"
+    echo "as the first initrd to your bootloader."
+    echo
+    echo "For more information, see https://wiki.archlinux.org/index.php/Microcode#Enabling_Intel_Microcode_Updates"
+  fi
+}



More information about the arch-commits mailing list