                                                      October 2, 2012



This is a very quick-and-dirty program to convert Intel's
"microcode.dat" file to a binary blob.  This conversion is necessary
since the Xen hypervisor expects data in this format and chokes on
ASCII text.  The userspace tool, "microcode_ctl" in fact works with a
"microcode.dat" file that has been encapsulated in a tar archive and
then renamed to microcode.dat and (on my system) stored in
"/lib/firmware".

I found it necessary to write this tool since the microcode update
from userspace stopped working when I installed xen, and I though the
problems I was experiencing may have been related.  Nevertheless, it's
probably a good thing to run the latest and greatest microcode for the
CPU, and until the dom0 update starts working again, it has to be
installed by the Xen hypervisor. 

The microcode.dat I used was downloaded from Intel's site recently, as
appropriate to my CPU (Intel Core i3-2330M) and brings the microcode
version to 0x28.  You can select the appropriate file for your
processor at the following link:

  http://downloadcenter.intel.com/Default.aspx?lang=eng



COMPILING:


You should simply type 'make' and the program will be built for your
system.  Tested on openSUSE 12.1 x86_64.



USAGE:


Place your microcode.dat file in the source-code directory and run
"./cvt_ucode"; command-line options are ignored.  The binary blob will
be generated in the same directory and will be called 'microcode.bin',
which you may place in your /boot directory.

Edit your grub.cfg or menu.lst entry as follows:

Within the config stanza responsible for loading Xen, append 'module
/microcode.bin' to the module list.  Add "ucode=-1" to the hypervisor
parameters, which tells xen that the microcode blob will be found at
last entry in the module list.  Indexing with a positive number starts
with 0, which is always the entry for the linux kernel.

My system uses the following entry with grub2:

menuentry 'Xen -- openSUSE 12.1 - 3.6.0-dom0' {
    recordfail
    multiboot /xen-4.2.gz placeholder ucode=-1
    module /vmlinuz-3.6.0-dom0 placeholder root=/dev/system/root resume=/dev/system/swap showopts video=intelfb
    module /initrd-3.6.0-dom0
    module /microcode.bin
}

Reboot your system and inspect /proc/cpuinfo to see that the update
has worked.  Xen boot messages related to the microcode update only
appear if there is an error.



COPYRIGHT and LICENSE:


Copyright © October 2012, Steve Thompson <stevet810@gmail.com>

This program may be used and shared freely by the Internet community
for any personal or commercial use as long as it remains unmodified.
If you modify any of the files included in this distribution, you
should redistribute the result including mention of its origin and
author.

No fitness for any specific purpose is intended or implied, only that
it seems to work fine on my system.  Your mileage may vary.
