Hello community, here is the log from the commit of package microcode_ctl for openSUSE:Factory checked in at 2011-12-14 14:34:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/microcode_ctl (Old) and /work/SRC/openSUSE:Factory/.microcode_ctl.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "microcode_ctl", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/microcode_ctl/microcode_ctl.changes 2011-11-23 19:36:52.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.microcode_ctl.new/microcode_ctl.changes 2011-12-14 14:34:18.000000000 +0100 @@ -1,0 +2,15 @@ +Tue Dec 13 00:31:02 UTC 2011 - [email protected] + +- Update to microcode 20111110 +- First steps for autoloading, currently only working with systemd + * add script that generates microcode in a form understanable + by the kernel. + * add microcode.conf to modules-load.d so the module is + loaded at boot with systemd which in turn will load + updated microcode automatically. + The kernel will in the near future autoload the module when + a supported CPU is detected (WIP) + * Axe all init scripts and systemd service files. this has + to be handled in udev/kernel. (WIP) + +------------------------------------------------------------------- Old: ---- microcode-20110915.tar.bz2 microcode.init microcode_ctl.service New: ---- intel-microcode2ucode.c microcode-20111110.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ microcode_ctl.spec ++++++ --- /var/tmp/diff_new_pack.P471w7/_old 2011-12-14 14:34:19.000000000 +0100 +++ /var/tmp/diff_new_pack.P471w7/_new 2011-12-14 14:34:19.000000000 +0100 @@ -19,7 +19,7 @@ Name: microcode_ctl -%define intel_version 20110915 +%define intel_version 20111110 %define amd_version 2011-01-11 License: GPLv2+ ; "the microcode itself has this license: ..." ExclusiveArch: %ix86 x86_64 @@ -29,73 +29,58 @@ Version: 1.17 Release: 127 Source0: microcode_ctl-%{version}.tar.bz2 -Source1: microcode.init -Source2: microcode-%{intel_version}.tar.bz2 +Source2: microcode-%{intel_version}.tgz Source3: amd-ucode-%{amd_version}.tar.bz2 -Source4: microcode_ctl.service +Source5: intel-microcode2ucode.c Patch0: microcode.ctl_1.17-13.diff.gz Patch1: microcode_ctl-1.17-suse_rh_paths.patch Patch2: microcode-ctl-cloexec.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build -Requires(pre): %insserv_prereq +BuildRequires: systemd +%{?systemd_requires} %description This utility allows updating the microcode of Intel and AMD x86 and x86-64 CPUs. %prep -%setup -q -a 3 +%setup -q -a 3 -a 2 %patch0 -p1 %patch1 %patch2 %build make CFLAGS="$RPM_OPT_FLAGS -I." +cc -fwhole-program %{optflags} %{S:5} -o generate_microcode +./generate_microcode microcode.dat %install -mkdir -p ${RPM_BUILD_ROOT}/etc/init.d -install -m 0755 %SOURCE1 ${RPM_BUILD_ROOT}/etc/init.d/microcode.ctl -mkdir -p ${RPM_BUILD_ROOT}/usr/sbin -ln -s /etc/init.d/microcode.ctl ${RPM_BUILD_ROOT}/usr/sbin/rcmicrocode.ctl - %makeinstall -bunzip2 -dc %SOURCE2 > %{buildroot}/lib/firmware/microcode.dat - # AMD install -D -m 0644 amd-ucode-%{amd_version}/microcode_amd.bin $RPM_BUILD_ROOT/lib/firmware/amd-ucode/microcode_amd.bin install -D -m 0644 amd-ucode-%{amd_version}/README $RPM_BUILD_ROOT/%{_defaultdocdir}/microcode_ctl/amd/README install -D -m 0644 amd-ucode-%{amd_version}/LICENSE $RPM_BUILD_ROOT/%{_defaultdocdir}/microcode_ctl/amd/LICENSE install -D -m 0644 amd-ucode-%{amd_version}/INSTALL $RPM_BUILD_ROOT/%{_defaultdocdir}/microcode_ctl/amd/INSTALL - -install -D -m 0644 %SOURCE4 %{buildroot}/lib/systemd/system/microcode.ctl.service - -%post -# Install service on affected Intel/AMD machines by default -# Remove this after openSUSE 11.4 when the kernel can autoload microcode.ko - -if grep Intel /proc/cpuinfo > /dev/null ; then - %{fillup_and_insserv -fY microcode.ctl} -elif grep -q -i AuthenticAMD /proc/cpuinfo; then - fam=`head /proc/cpuinfo |sed -n -e 's/cpu family.*: \([0-9]\+\)/\1/p'` - # Only try to update when family >= 16 (0x10, fam 10h) - if [ $fam -ge 16 >& /dev/null ];then - %{fillup_and_insserv -fY microcode.ctl} - fi -fi +install -D -m 0755 generate_microcode %{buildroot}%{_bindir}/generate_microcode +for file in intel-ucode/*; do +install -D -m 0644 $file %{buildroot}/lib/firmware/$file +done +mkdir -p %{buildroot}/usr/lib/modules-load.d +echo 'microcode' > %{buildroot}/usr/lib/modules-load.d/microcode.conf %clean rm -rf $RPM_BUILD_ROOT; %files %defattr(-,root,root) -/lib/systemd/system/microcode.ctl.service -/lib/firmware/microcode.dat +%{_bindir}/generate_microcode /sbin/microcode_ctl -/etc/init.d/microcode.ctl -/usr/sbin/rcmicrocode.ctl %dir /lib/firmware/amd-ucode +%dir /lib/firmware/intel-ucode +/lib/firmware/intel-ucode/* /lib/firmware/amd-ucode/microcode_amd.bin %{_mandir}/man8/microcode_ctl.8.gz -%doc %{_defaultdocdir}/microcode_ctl +%{_defaultdocdir}/microcode_ctl +/usr/lib/modules-load.d/microcode.conf %changelog ++++++ intel-microcode2ucode.c ++++++ /* * 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 <[email protected]> */ #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; } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
