[arch-commits] Commit in intel-ucode/repos (9 files)

Allan McRae allan at archlinux.org
Thu May 10 01:15:37 UTC 2012


    Date: Wednesday, May 9, 2012 @ 21:15:37
  Author: allan
Revision: 158794

db-move: moved intel-ucode from [core] to [extra] (any)

Added:
  intel-ucode/repos/extra-any/LICENSE
    (from rev 158792, intel-ucode/repos/core-any/LICENSE)
  intel-ucode/repos/extra-any/PKGBUILD
    (from rev 158792, intel-ucode/repos/core-any/PKGBUILD)
  intel-ucode/repos/extra-any/intel-microcode2ucode.c
    (from rev 158792, intel-ucode/repos/core-any/intel-microcode2ucode.c)
  intel-ucode/repos/extra-any/intel-ucode.install
    (from rev 158792, intel-ucode/repos/core-any/intel-ucode.install)
Deleted:
  intel-ucode/repos/core-any/
  intel-ucode/repos/extra-any/LICENSE
  intel-ucode/repos/extra-any/PKGBUILD
  intel-ucode/repos/extra-any/intel-microcode2ucode.c
  intel-ucode/repos/extra-any/intel-ucode.install

-------------------------+
 LICENSE                 |  246 +++++++++++++++++-----------------
 PKGBUILD                |   62 ++++----
 intel-microcode2ucode.c |  326 +++++++++++++++++++++++-----------------------
 intel-ucode.install     |   16 +-
 4 files changed, 325 insertions(+), 325 deletions(-)

Deleted: extra-any/LICENSE
===================================================================
--- extra-any/LICENSE	2012-05-10 01:15:36 UTC (rev 158793)
+++ extra-any/LICENSE	2012-05-10 01:15:37 UTC (rev 158794)
@@ -1,123 +0,0 @@
-INTEL SOFTWARE LICENSE AGREEMENT
-
-IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
-Do not use or load this software and any associated materials (collectively,
-the "Software") until you have carefully read the following terms and
-conditions. By loading or using the Software, you agree to the terms of this
-Agreement. If you do not wish to so agree, do not install or use the Software.
-
-LICENSES: Please Note:
-- If you are a network administrator, the "Site License" below shall
-apply to you.
-- If you are an end user, the "Single User License" shall apply to you.
-- If you are an original equipment manufacturer (OEM), the "OEM License"
-shall apply to you.
-
-SITE LICENSE. You may copy the Software onto your organization's computers
-for your organization's use, and you may make a reasonable number of
-back-up copies of the Software, subject to these conditions:
-
-1. This Software is licensed for use only in conjunction with Intel
-component products. Use of the Software in conjunction with non-Intel
-component products is not licensed hereunder.
-2. You may not copy, modify, rent, sell, distribute or transfer any part
-of the Software except as provided in this Agreement, and you agree to
-prevent unauthorized copying of the Software.
-3. You may not reverse engineer, decompile, or disassemble the Software.
-4. You may not sublicense or permit simultaneous use of the Software by
-more than one user.
-5. The Software may include portions offered on terms in addition to those
-set out here, as set out in a license accompanying those portions.
-
-SINGLE USER LICENSE. You may copy the Software onto a single computer for
-your personal, noncommercial use, and you may make one back-up copy of the
-Software, subject to these conditions:
-
-1. This Software is licensed for use only in conjunction with Intel
-component products. Use of the Software in conjunction with non-Intel
-component products is not licensed hereunder.
-2. You may not copy, modify, rent, sell, distribute or transfer any part
-of the Software except as provided in this Agreement, and you agree to
-prevent unauthorized copying of the Software.
-3. You may not reverse engineer, decompile, or disassemble the Software.
-4. You may not sublicense or permit simultaneous use of the Software by
-more than one user.
-5. The Software may include portions offered on terms in addition to those
-set out here, as set out in a license accompanying those portions.
-
-OEM LICENSE: You may reproduce and distribute the Software only as an
-integral part of or incorporated in Your product or as a standalone
-Software maintenance update for existing end users of Your products,
-excluding any other standalone products, subject to these conditions:
-
-1. This Software is licensed for use only in conjunction with Intel
-component products. Use of the Software in conjunction with non-Intel
-component products is not licensed hereunder.
-2. You may not copy, modify, rent, sell, distribute or transfer any part
-of the Software except as provided in this Agreement, and you agree to
-prevent unauthorized copying of the Software.
-3. You may not reverse engineer, decompile, or disassemble the Software.
-4. You may only distribute the Software to your customers pursuant to a
-written license agreement. Such license agreement may be a "break-the-
-seal" license agreement. At a minimum such license shall safeguard
-Intel's ownership rights to the Software.
-5. The Software may include portions offered on terms in addition to those
-set out here, as set out in a license accompanying those portions.
-
-NO OTHER RIGHTS. No rights or licenses are granted by Intel to You, expressly
-or by implication, with respect to any proprietary information or patent,
-copyright, mask work, trademark, trade secret, or other intellectual property
-right owned or controlled by Intel, except as expressly provided in this
-Agreement.
-
-OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Title to all copies of the Software
-remains with Intel or its suppliers. The Software is copyrighted and
-protected by the laws of the United States and other countries, and
-international treaty provisions. You may not remove any copyright notices
-from the Software. Intel may make changes to the Software, or to items
-referenced therein, at any time without notice, but is not obligated to
-support or update the Software. Except as otherwise expressly provided, Intel
-grants no express or implied right under Intel patents, copyrights,
-trademarks, or other intellectual property rights. You may transfer the
-Software only if the recipient agrees to be fully bound by these terms and if
-you retain no copies of the Software.
-
-LIMITED MEDIA WARRANTY. If the Software has been delivered by Intel on
-physical media, Intel warrants the media to be free from material physical
-defects for a period of ninety days after delivery by Intel. If such a defect
-is found, return the media to Intel for replacement or alternate delivery of
-the Software as Intel may select.
-
-EXCLUSION OF OTHER WARRANTIES. EXCEPT AS PROVIDED ABOVE, THE SOFTWARE IS
-PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND
-INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A
-PARTICULAR PURPOSE. Intel does not warrant or assume responsibility for the
-accuracy or completeness of any information, text, graphics, links or other
-items contained within the Software.
-
-LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS BE LIABLE
-FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, LOST PROFITS,
-BUSINESS INTERRUPTION, OR LOST INFORMATION) ARISING OUT OF THE USE OF OR
-INABILITY TO USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS PROHIBIT EXCLUSION OR
-LIMITATION OF LIABILITY FOR IMPLIED WARRANTIES OR CONSEQUENTIAL OR INCIDENTAL
-DAMAGES, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE
-OTHER LEGAL RIGHTS THAT VARY FROM JURISDICTION TO JURISDICTION.
-
-TERMINATION OF THIS AGREEMENT. Intel may terminate this Agreement at any time
-if you violate its terms. Upon termination, you will immediately destroy the
-Software or return all copies of the Software to Intel.
-
-APPLICABLE LAWS. Claims arising under this Agreement shall be governed by the
-laws of California, excluding its principles of conflict of laws and the
-United Nations Convention on Contracts for the Sale of Goods. You may not
-export the Software in violation of applicable export laws and regulations.
-Intel is not obligated under any other agreements unless they are in writing
-and signed by an authorized representative of Intel.
-
-GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED
-RIGHTS." Use, duplication, or disclosure by the Government is subject to
-restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its
-successor. Use of the Software by the Government constitutes acknowledgment
-of Intel's proprietary rights therein. Contractor or Manufacturer is Intel
-2200 Mission College Blvd., Santa Clara, CA 95052. 

Copied: intel-ucode/repos/extra-any/LICENSE (from rev 158792, intel-ucode/repos/core-any/LICENSE)
===================================================================
--- extra-any/LICENSE	                        (rev 0)
+++ extra-any/LICENSE	2012-05-10 01:15:37 UTC (rev 158794)
@@ -0,0 +1,123 @@
+INTEL SOFTWARE LICENSE AGREEMENT
+
+IMPORTANT - READ BEFORE COPYING, INSTALLING OR USING.
+Do not use or load this software and any associated materials (collectively,
+the "Software") until you have carefully read the following terms and
+conditions. By loading or using the Software, you agree to the terms of this
+Agreement. If you do not wish to so agree, do not install or use the Software.
+
+LICENSES: Please Note:
+- If you are a network administrator, the "Site License" below shall
+apply to you.
+- If you are an end user, the "Single User License" shall apply to you.
+- If you are an original equipment manufacturer (OEM), the "OEM License"
+shall apply to you.
+
+SITE LICENSE. You may copy the Software onto your organization's computers
+for your organization's use, and you may make a reasonable number of
+back-up copies of the Software, subject to these conditions:
+
+1. This Software is licensed for use only in conjunction with Intel
+component products. Use of the Software in conjunction with non-Intel
+component products is not licensed hereunder.
+2. You may not copy, modify, rent, sell, distribute or transfer any part
+of the Software except as provided in this Agreement, and you agree to
+prevent unauthorized copying of the Software.
+3. You may not reverse engineer, decompile, or disassemble the Software.
+4. You may not sublicense or permit simultaneous use of the Software by
+more than one user.
+5. The Software may include portions offered on terms in addition to those
+set out here, as set out in a license accompanying those portions.
+
+SINGLE USER LICENSE. You may copy the Software onto a single computer for
+your personal, noncommercial use, and you may make one back-up copy of the
+Software, subject to these conditions:
+
+1. This Software is licensed for use only in conjunction with Intel
+component products. Use of the Software in conjunction with non-Intel
+component products is not licensed hereunder.
+2. You may not copy, modify, rent, sell, distribute or transfer any part
+of the Software except as provided in this Agreement, and you agree to
+prevent unauthorized copying of the Software.
+3. You may not reverse engineer, decompile, or disassemble the Software.
+4. You may not sublicense or permit simultaneous use of the Software by
+more than one user.
+5. The Software may include portions offered on terms in addition to those
+set out here, as set out in a license accompanying those portions.
+
+OEM LICENSE: You may reproduce and distribute the Software only as an
+integral part of or incorporated in Your product or as a standalone
+Software maintenance update for existing end users of Your products,
+excluding any other standalone products, subject to these conditions:
+
+1. This Software is licensed for use only in conjunction with Intel
+component products. Use of the Software in conjunction with non-Intel
+component products is not licensed hereunder.
+2. You may not copy, modify, rent, sell, distribute or transfer any part
+of the Software except as provided in this Agreement, and you agree to
+prevent unauthorized copying of the Software.
+3. You may not reverse engineer, decompile, or disassemble the Software.
+4. You may only distribute the Software to your customers pursuant to a
+written license agreement. Such license agreement may be a "break-the-
+seal" license agreement. At a minimum such license shall safeguard
+Intel's ownership rights to the Software.
+5. The Software may include portions offered on terms in addition to those
+set out here, as set out in a license accompanying those portions.
+
+NO OTHER RIGHTS. No rights or licenses are granted by Intel to You, expressly
+or by implication, with respect to any proprietary information or patent,
+copyright, mask work, trademark, trade secret, or other intellectual property
+right owned or controlled by Intel, except as expressly provided in this
+Agreement.
+
+OWNERSHIP OF SOFTWARE AND COPYRIGHTS. Title to all copies of the Software
+remains with Intel or its suppliers. The Software is copyrighted and
+protected by the laws of the United States and other countries, and
+international treaty provisions. You may not remove any copyright notices
+from the Software. Intel may make changes to the Software, or to items
+referenced therein, at any time without notice, but is not obligated to
+support or update the Software. Except as otherwise expressly provided, Intel
+grants no express or implied right under Intel patents, copyrights,
+trademarks, or other intellectual property rights. You may transfer the
+Software only if the recipient agrees to be fully bound by these terms and if
+you retain no copies of the Software.
+
+LIMITED MEDIA WARRANTY. If the Software has been delivered by Intel on
+physical media, Intel warrants the media to be free from material physical
+defects for a period of ninety days after delivery by Intel. If such a defect
+is found, return the media to Intel for replacement or alternate delivery of
+the Software as Intel may select.
+
+EXCLUSION OF OTHER WARRANTIES. EXCEPT AS PROVIDED ABOVE, THE SOFTWARE IS
+PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND
+INCLUDING WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, OR FITNESS FOR A
+PARTICULAR PURPOSE. Intel does not warrant or assume responsibility for the
+accuracy or completeness of any information, text, graphics, links or other
+items contained within the Software.
+
+LIMITATION OF LIABILITY. IN NO EVENT SHALL INTEL OR ITS SUPPLIERS BE LIABLE
+FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, LOST PROFITS,
+BUSINESS INTERRUPTION, OR LOST INFORMATION) ARISING OUT OF THE USE OF OR
+INABILITY TO USE THE SOFTWARE, EVEN IF INTEL HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS PROHIBIT EXCLUSION OR
+LIMITATION OF LIABILITY FOR IMPLIED WARRANTIES OR CONSEQUENTIAL OR INCIDENTAL
+DAMAGES, SO THE ABOVE LIMITATION MAY NOT APPLY TO YOU. YOU MAY ALSO HAVE
+OTHER LEGAL RIGHTS THAT VARY FROM JURISDICTION TO JURISDICTION.
+
+TERMINATION OF THIS AGREEMENT. Intel may terminate this Agreement at any time
+if you violate its terms. Upon termination, you will immediately destroy the
+Software or return all copies of the Software to Intel.
+
+APPLICABLE LAWS. Claims arising under this Agreement shall be governed by the
+laws of California, excluding its principles of conflict of laws and the
+United Nations Convention on Contracts for the Sale of Goods. You may not
+export the Software in violation of applicable export laws and regulations.
+Intel is not obligated under any other agreements unless they are in writing
+and signed by an authorized representative of Intel.
+
+GOVERNMENT RESTRICTED RIGHTS. The Software is provided with "RESTRICTED
+RIGHTS." Use, duplication, or disclosure by the Government is subject to
+restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its
+successor. Use of the Software by the Government constitutes acknowledgment
+of Intel's proprietary rights therein. Contractor or Manufacturer is Intel
+2200 Mission College Blvd., Santa Clara, CA 95052. 

Deleted: extra-any/PKGBUILD
===================================================================
--- extra-any/PKGBUILD	2012-05-10 01:15:36 UTC (rev 158793)
+++ extra-any/PKGBUILD	2012-05-10 01:15:37 UTC (rev 158794)
@@ -1,31 +0,0 @@
-# $Id$
-# Maintainer: Thomas Bächler <thomas at archlinux.org>
-
-pkgname=intel-ucode
-pkgver=20111110
-pkgrel=1
-pkgdesc="Microcode update files for Intel CPUs"
-arch=('any')
-url="http://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22"
-replaces=('microcode_ctl')
-license=('custom')
-install=${pkgname}.install
-source=(http://downloadmirror.intel.com/20728/eng/microcode-${pkgver}.tgz
-        LICENSE
-        intel-microcode2ucode.c)
-sha256sums=('16f532cdf9cce03e01e714619ad9406a465aa965bbd1288035398db79921cbc1'
-            '6983e83ec10c6467fb9101ea496e0443f0574c805907155118e2c9f0bbea97b6'
-            'c51b1b1d8b4b28e7d5d007917c1e444af1a2ff04a9408aa9067c0e57d70164de')
-
-build() {
-  cd "$srcdir"
-  gcc -Wall ${CFLAGS} -o intel-microcode2ucode intel-microcode2ucode.c
-  ./intel-microcode2ucode ./microcode.dat
-}
-
-package() {
-  cd "$srcdir"
-  install -d -m755 "${pkgdir}"/lib/firmware/intel-ucode/
-  cp intel-ucode/* "${pkgdir}"/lib/firmware/intel-ucode/
-  install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
-}

Copied: intel-ucode/repos/extra-any/PKGBUILD (from rev 158792, intel-ucode/repos/core-any/PKGBUILD)
===================================================================
--- extra-any/PKGBUILD	                        (rev 0)
+++ extra-any/PKGBUILD	2012-05-10 01:15:37 UTC (rev 158794)
@@ -0,0 +1,31 @@
+# $Id$
+# Maintainer: Thomas Bächler <thomas at archlinux.org>
+
+pkgname=intel-ucode
+pkgver=20111110
+pkgrel=2
+pkgdesc="Microcode update files for Intel CPUs"
+arch=('any')
+url="http://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22"
+replaces=('microcode_ctl')
+license=('custom')
+install=${pkgname}.install
+source=(http://downloadmirror.intel.com/20728/eng/microcode-${pkgver}.tgz
+        LICENSE
+        intel-microcode2ucode.c)
+sha256sums=('16f532cdf9cce03e01e714619ad9406a465aa965bbd1288035398db79921cbc1'
+            '6983e83ec10c6467fb9101ea496e0443f0574c805907155118e2c9f0bbea97b6'
+            'c51b1b1d8b4b28e7d5d007917c1e444af1a2ff04a9408aa9067c0e57d70164de')
+
+build() {
+  cd "$srcdir"
+  gcc -Wall ${CFLAGS} -o intel-microcode2ucode intel-microcode2ucode.c
+  ./intel-microcode2ucode ./microcode.dat
+}
+
+package() {
+  cd "$srcdir"
+  install -d -m755 "${pkgdir}"/usr/lib/firmware/intel-ucode/
+  cp intel-ucode/* "${pkgdir}"/usr/lib/firmware/intel-ucode/
+  install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}

Deleted: extra-any/intel-microcode2ucode.c
===================================================================
--- extra-any/intel-microcode2ucode.c	2012-05-10 01:15:36 UTC (rev 158793)
+++ extra-any/intel-microcode2ucode.c	2012-05-10 01:15:37 UTC (rev 158794)
@@ -1,163 +0,0 @@
-/*
- * Convert Intel microcode.dat into individual ucode files
- * named: intel-ucode/$family-$model-$stepping
- *
- * 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>
- */
-
-
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <inttypes.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-struct microcode_header_intel {
-	unsigned int hdrver;
-	unsigned int rev;
-	unsigned int date;
-	unsigned int sig;
-	unsigned int cksum;
-	unsigned int ldrver;
-	unsigned int pf;
-	unsigned int datasize;
-	unsigned int totalsize;
-	unsigned int reserved[3];
-};
-
-union mcbuf {
-	struct microcode_header_intel hdr;
-	unsigned int i[0];
-	char c[0];
-};
-
-int main(int argc, char *argv[])
-{
-	char *filename = "/lib/firmware/microcode.dat";
-	FILE *f;
-	char line[LINE_MAX];
-	char buf[4000000];
-	union mcbuf *mc;
-	size_t bufsize, count, start;
-	int rc = EXIT_SUCCESS;
-
-	if (argv[1] != NULL)
-		filename = argv[1];
-
-	count = 0;
-	mc = (union mcbuf *) buf;
-	f = fopen(filename, "re");
-	if (f == NULL) {
-		printf("open %s: %m\n", filename);
-		rc = EXIT_FAILURE;
-		goto out;
-	}
-
-	while (fgets(line, sizeof(line), f) != NULL) {
-		if (sscanf(line, "%x, %x, %x, %x",
-		    &mc->i[count],
-		    &mc->i[count + 1],
-		    &mc->i[count + 2],
-		    &mc->i[count + 3]) != 4)
-			continue;
-		count += 4;
-	}
-	fclose(f);
-
-	bufsize = count * sizeof(int);
-	printf("%s: %lu(%luk) bytes, %zu integers\n",
-	       filename,
-	       bufsize,
-	       bufsize / 1024,
-	       count);
-
-	if (bufsize < sizeof(struct microcode_header_intel))
-		goto out;
-
-	mkdir("intel-ucode", 0750);
-
-	start = 0;
-	for (;;) {
-		size_t size;
-		unsigned int family, model, stepping;
-		unsigned int year, month, day;
-
-		mc = (union mcbuf *) &buf[start];
-
-		if (mc->hdr.totalsize)
-			size = mc->hdr.totalsize;
-		else
-			size = 2000 + sizeof(struct microcode_header_intel);
-
-		if (mc->hdr.ldrver != 1 || mc->hdr.hdrver != 1) {
-			printf("unknown version/format:\n");
-			rc = EXIT_FAILURE;
-			break;
-		}
-
-		/*
-		 *  0- 3 stepping
-		 *  4- 7 model
-		 *  8-11 family
-		 * 12-13 type
-		 * 16-19 extended model
-		 * 20-27 extended family
-		 */
-		family = (mc->hdr.sig >> 8) & 0xf;
-		if (family == 0xf)
-			family += (mc->hdr.sig >> 20) & 0xff;
-		model = (mc->hdr.sig >> 4) & 0x0f;
-		if (family == 0x06)
-			model += ((mc->hdr.sig >> 16) & 0x0f) << 4;
-		stepping = mc->hdr.sig & 0x0f;
-
-		year = mc->hdr.date & 0xffff;
-		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);
-		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);
-			rc = EXIT_FAILURE;
-			goto out;
-		}
-		fclose(f);
-		free(filename);
-
-		start += size;
-		if (start >= bufsize)
-			break;
-	}
-	printf("\n");
-out:
-	return rc;
-}

Copied: intel-ucode/repos/extra-any/intel-microcode2ucode.c (from rev 158792, intel-ucode/repos/core-any/intel-microcode2ucode.c)
===================================================================
--- extra-any/intel-microcode2ucode.c	                        (rev 0)
+++ extra-any/intel-microcode2ucode.c	2012-05-10 01:15:37 UTC (rev 158794)
@@ -0,0 +1,163 @@
+/*
+ * Convert Intel microcode.dat into individual ucode files
+ * named: intel-ucode/$family-$model-$stepping
+ *
+ * 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>
+ */
+
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <inttypes.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+struct microcode_header_intel {
+	unsigned int hdrver;
+	unsigned int rev;
+	unsigned int date;
+	unsigned int sig;
+	unsigned int cksum;
+	unsigned int ldrver;
+	unsigned int pf;
+	unsigned int datasize;
+	unsigned int totalsize;
+	unsigned int reserved[3];
+};
+
+union mcbuf {
+	struct microcode_header_intel hdr;
+	unsigned int i[0];
+	char c[0];
+};
+
+int main(int argc, char *argv[])
+{
+	char *filename = "/lib/firmware/microcode.dat";
+	FILE *f;
+	char line[LINE_MAX];
+	char buf[4000000];
+	union mcbuf *mc;
+	size_t bufsize, count, start;
+	int rc = EXIT_SUCCESS;
+
+	if (argv[1] != NULL)
+		filename = argv[1];
+
+	count = 0;
+	mc = (union mcbuf *) buf;
+	f = fopen(filename, "re");
+	if (f == NULL) {
+		printf("open %s: %m\n", filename);
+		rc = EXIT_FAILURE;
+		goto out;
+	}
+
+	while (fgets(line, sizeof(line), f) != NULL) {
+		if (sscanf(line, "%x, %x, %x, %x",
+		    &mc->i[count],
+		    &mc->i[count + 1],
+		    &mc->i[count + 2],
+		    &mc->i[count + 3]) != 4)
+			continue;
+		count += 4;
+	}
+	fclose(f);
+
+	bufsize = count * sizeof(int);
+	printf("%s: %lu(%luk) bytes, %zu integers\n",
+	       filename,
+	       bufsize,
+	       bufsize / 1024,
+	       count);
+
+	if (bufsize < sizeof(struct microcode_header_intel))
+		goto out;
+
+	mkdir("intel-ucode", 0750);
+
+	start = 0;
+	for (;;) {
+		size_t size;
+		unsigned int family, model, stepping;
+		unsigned int year, month, day;
+
+		mc = (union mcbuf *) &buf[start];
+
+		if (mc->hdr.totalsize)
+			size = mc->hdr.totalsize;
+		else
+			size = 2000 + sizeof(struct microcode_header_intel);
+
+		if (mc->hdr.ldrver != 1 || mc->hdr.hdrver != 1) {
+			printf("unknown version/format:\n");
+			rc = EXIT_FAILURE;
+			break;
+		}
+
+		/*
+		 *  0- 3 stepping
+		 *  4- 7 model
+		 *  8-11 family
+		 * 12-13 type
+		 * 16-19 extended model
+		 * 20-27 extended family
+		 */
+		family = (mc->hdr.sig >> 8) & 0xf;
+		if (family == 0xf)
+			family += (mc->hdr.sig >> 20) & 0xff;
+		model = (mc->hdr.sig >> 4) & 0x0f;
+		if (family == 0x06)
+			model += ((mc->hdr.sig >> 16) & 0x0f) << 4;
+		stepping = mc->hdr.sig & 0x0f;
+
+		year = mc->hdr.date & 0xffff;
+		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);
+		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);
+			rc = EXIT_FAILURE;
+			goto out;
+		}
+		fclose(f);
+		free(filename);
+
+		start += size;
+		if (start >= bufsize)
+			break;
+	}
+	printf("\n");
+out:
+	return rc;
+}

Deleted: extra-any/intel-ucode.install
===================================================================
--- extra-any/intel-ucode.install	2012-05-10 01:15:36 UTC (rev 158793)
+++ extra-any/intel-ucode.install	2012-05-10 01:15:37 UTC (rev 158794)
@@ -1,8 +0,0 @@
-post_install() {
-  echo
-  echo "==> To apply the microcode update on boot, load the 'microcode' module"
-  echo "==> by adding it to the MODULES array in rc.conf:"
-  echo "==>  MODULES=(... microcode)"
-  echo "==> The old 'microcode' daemon script no longer exists."
-  echo
-}

Copied: intel-ucode/repos/extra-any/intel-ucode.install (from rev 158792, intel-ucode/repos/core-any/intel-ucode.install)
===================================================================
--- extra-any/intel-ucode.install	                        (rev 0)
+++ extra-any/intel-ucode.install	2012-05-10 01:15:37 UTC (rev 158794)
@@ -0,0 +1,8 @@
+post_install() {
+  echo
+  echo "==> To apply the microcode update on boot, load the 'microcode' module"
+  echo "==> by adding it to the MODULES array in rc.conf:"
+  echo "==>  MODULES=(... microcode)"
+  echo "==> The old 'microcode' daemon script no longer exists."
+  echo
+}




More information about the arch-commits mailing list