FedoraForum.org - Fedora Support Forums and Community
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2014
    Location
    Raleigh, NC, USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Libvirt + Fedora 20 + Windows 8.1 OEM + UEFI = Oh My!

    n00b's keep back! This is fairly advanced, but hopefully will save somebody a bunch of time...
    Attached Images Attached Images
    Last edited by chrisevich; 31st March 2014 at 06:11 PM.

  2. #2
    Join Date
    Mar 2014
    Location
    Raleigh, NC, USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Libvirt + Fedora 20 + Windows 8.1 OEM + UEFI = Oh My!

    HOW-TO:

    0) DON'T BOOT IT! It will try to phone-home!!!! Obtain an iso image of the original 'RTM' version of your exact flavor of Windows (google and/or your PC's manufacturer will help you). Verify the SHA256 against what MSDN says it should be!

    1) Grab a live-boot Fedora DVD

    2) Read your manual, be SURE of how to enter the boot-device menu IMMEDIATELY after power on (i.e. DO NOT LET WINDOWS BOOT!!!!)

    3) Boot the live-dvd, UNMOUNT the hard-drive filesystems (if they auto-mount).

    4) Connect up to a network and save an image of the original factory content of your disk (take a LONG time):

    Code:
    dd if=/dev/sda bs=32M | xz -9 --block-size 32M --stdout - | ssh someone@somewhere.com'cat - > /path/to/some/file.xz'
    5) From a terminal make copies of these two ACPI tables onto a USB stick or similar:

    Code:
    /sys/firmware/acpi/tables/SLIC
    /sys/firmware/acpi/tables/MSDM
    6) Your windows COA key is embedded in plain-text, in the last one. Make quick work of that with hexdump and tail:

    Code:
    hexdump -e '"%c"' /sys/firmware/acpi/tables/MSDM | tail -c 29
    That there is your COA / install key, write it down and keep in in a safe place.

    7) Note the exact size (in bytes) and the serial number of your hard-disk with 'smartctl -i /dev/sda'

    8) Note _all_ your network interfaces MAC addresses (including wireless)

    9) Reboot and install Fedora, blowing away the content of the hard-disk.

    10) Install all the development tools and libraries and the 'iasl' package

    11) Follow these instructions to setup an EDK II build environment

    12) Edit Conf/target.txt and set (assuming you have 4 CPU threads:

    Code:
    ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc
    TARGET = RELEASE
    TARGET_ARCH = X64
    MAX_CONCURRENT_THREAD_NUMBER = 5
    TOOL_CHAIN_TAG = GCC48
    13) Go into 'src/edk2/CryptoPkg/Library/OpensslLib' and follow instructions in 'Patch-HOWTO.txt'

    14) from src/edk2 build with this command:

    Code:
    OvmfPkg/build.sh -a X64 -b RELEASE -D FD_SIZE_2MB -D SECURE_BOOT_MODE_ENABLE
    15) Your new UEFI secure-boot enabled, virtio supporting firmware is here:

    Code:
    Build/OvmfX64/RELEASE_GCC48/FV/OVMF.fd
    16) Download the official M$ keys and signatures (completely legal), See attached tarball on this post (below)

    17) Use 'virt-install' to create (but don't start) a new VM

    18) Figure out your Socket/Core/Thread counts from /proc/cpuinfo

    19) Note the entire CPU section from 'virsh capabilities'

    20) Note the info from. 'dmidecode -t 0' and 'dmidecode -t 1'

    21) Copy your 'OVMF.fd' to /var/lib/libvirt/images, use qemu-img to make a copy-on-write qcow2 image your VM can write to:

    Code:
    qemu-img create -f qcow2 -o backing_file=/var/lib/libvirt/images/OVMF.fd,backing_fmt=raw /var/lib/libvirt/images/win81_bios.qcow2
    (fixup ownership, permissions, and SELinux contexts with chown/chmod/chcon)

    22) Edit your new VM's xml with 'virsh edit somename', use info from above to fill out sysinfo as follows (for example):

    Code:
    <domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
    ...
    <uuid> exact uuid from dmidecode -t 0 </uuid>
    ...
      <sysinfo type='smbios'>
        <bios>
          <entry name='vendor'>LENOVO</entry>
          <entry name='version'>8ECN91WW</entry>
          <entry name='date'>11/28/2013</entry>
          <entry name='release'>0.91</entry>
        </bios>
        <system>
          <entry name='manufacturer'>LENOVO</entry>
          <entry name='product'>20252</entry>
          <entry name='version'>Lenovo G710Lenovo G710</entry>
          <entry name='serial'> serial number from dmidecode</entry>
          <entry name='uuid'> exact from dmidecode -t 0 </entry>
          <entry name='sku'>LENOVO_MT_20252</entry>
          <entry name='family'>IDEAPAD</entry>
        </system>
      </sysinfo>
    ...
      <os>
    ...
        <smbios mode='sysinfo'/>
      </os>
      <cpu mode='custom'>
        paste in CPU section contents from #19 above
      </cpu>
    ...
        <disk type='file' device='disk'>
          <driver name='qemu' type='qcow2'/>
    ...
          <serial> disk serial number from #7 above </serial>
    ...
        </disk>
    ...
        <interface type='network'>
          <mac address=' mac you noted from #8 above '/>
    ...
        </interface>
      <qemu:commandline>
        <qemu:arg value='-acpitable'/>
        <qemu:arg value='file=/path/to/copy/acpi_table/MSDM'/>
        <qemu:arg value='-acpitable'/>
        <qemu:arg value='file=/path/to/copy/acpi_table/SLIC'/>
        <qemu:arg value='-pflash'/>
        <qemu:arg value='/var/lib/libvirt/images/win81_bios.qcow2'/>
      </qemu:commandline>
    23) use qemu-img + guestfish to make a temporary fat32 image containing the *cer files you downloaded.

    24) Make that temporary image and your Windows DVD iso image available to and boot the VM. Immediately hit escape to get into the UEFI BIOS, go under 'Device Manager' then 'Secure Boot Configuration'.

    25) Set 'Secure Boot Mode' to 'custom', then go under 'Custom Secure Boot Options'

    26) Use the menus + your temporary fat32 image to load the pk.cer, kek.cer, and all three db-?.cer files (ignore 'DBX Options')

    27) Set 'Secure Boot Mode' to 'Standard Mode' and hit space bar on 'Attempt Secure Boot'

    28) Back under 'Device Manager', go under 'OVMF Platform Configuration' and set your display resolution as you like.

    29) Use 'Boot Maintenance Manager', 'Boot From File' to boot off your Windows DVD's bootx64.efi file.

    30) Rejoice after installation when you find your windows boots and is already activated
    Attached Files Attached Files
    Last edited by chrisevich; 31st March 2014 at 04:52 PM.

  3. #3
    Join Date
    Mar 2014
    Location
    Raleigh, NC, USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Libvirt + Fedora 20 + Windows 8.1 OEM + UEFI = Oh My!

    In case anyone wonders, building 'OVMF.fd' had to be done b/c I couldn't find a pre-build binary anywhere that had both the virtio-blk drivers, 'Secure Boot' menu, and the display-resolution setting. W/o that, you'll be stuck with an 800x600 Windows :S

  4. #4
    Join Date
    Aug 2014
    Location
    cn
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Libvirt + Fedora 20 + Windows 8.1 OEM + UEFI = Oh My!

    Great article!

    Though I follows the steps, I don't have the luck to activate Windows in VM.

    One issue I found is that unlike seabios UEFI (from http://sourceforge.net/projects/edk2/) won't fetch the acpi tables from qemu. So the SLIC/MSDM acpi tables won't present in Windows VM.

    Is there any chance you used a different UEFI src?

  5. #5
    Join Date
    Mar 2014
    Location
    Raleigh, NC, USA
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Libvirt + Fedora 20 + Windows 8.1 OEM + UEFI = Oh My!

    Quote Originally Posted by sh2ne
    Great article!

    Though I follows the steps, I don't have the luck to activate Windows in VM.

    One issue I found is that unlike seabios UEFI (from http://sourceforge.net/projects/edk2/) won't fetch the acpi tables from qemu. So the SLIC/MSDM acpi tables won't present in Windows VM.

    Is there any chance you used a different UEFI src?
    I have a horrible time posting URLs in these forumns (it always denies me ). The set of instructions I followed for getting and setting up the edk2 build are here: http-colon-slash-slash tianocore -dot- sourceforge -dot- net -slash- wiki -slash Step-by-step_instructions#Step-by-step_Instructions.

    I also chatted with some Fedora devs after the fact, and learned that injecting the tables doesn't work yet in qemu (I didn't bother verifying once I saw 'windows is activated' message). Though I read today there are still ongoing efforts to make it work and be cleaner in the libvirt XML.

    In my case, I think the keys to success were really matching the hardware details as precisely as possible, i.e. hard-drive size and serial-number, MAC addresses, memory size, etc. I also did a fresh windows install, and entered the key found in the MSDM table. Also important is, I started with windows 8 (NOT 8.1) media I got from MSDN and not the media the OEM sent me. There is a re-activation feature as well, you could try that and use the OEM pre-activation key (widely available on google for the various OEMs).

    Good luck, and if you get it working, please share what you found!

Similar Threads

  1. [SOLVED] Samsung NP940X3G, UEFI, Windows 8, and fedora
    By Dan in forum Installation, Upgrades and Live Media
    Replies: 7
    Last Post: 14th May 2015, 08:05 PM
  2. Problem installing Fedora 17 with Windows 8 UEFI
    By johnbh in forum Installation, Upgrades and Live Media
    Replies: 4
    Last Post: 29th May 2013, 05:28 PM
  3. Install Windows 8 OEM as additional OS
    By gallicbear in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 27th October 2012, 03:43 PM
  4. Dual boot Fedora 17/Windows 7 + UEFI
    By ashram in forum Installation, Upgrades and Live Media
    Replies: 2
    Last Post: 21st October 2012, 12:39 AM
  5. How to make grub on F17 (uefi w/ grub 1) boot windows 7 (uefi)?
    By premudriy in forum Installation, Upgrades and Live Media
    Replies: 4
    Last Post: 21st August 2012, 06:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •