Windows PE

From ThinkWiki
Revision as of 07:21, 20 March 2010 by Newhren (Talk | contribs) (←Created page with 'Some utilities/drivers provided by IBM/Lenovo come only in the form of Windows executables. And for people who don't use Windows OS on their computers it becomes impossibl...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Some utilities/drivers provided by IBM/Lenovo come only in the form of Windows executables. And for people who don't use Windows OS on their computers it becomes impossible to use/apply them. Luckily, Microsoft provides Automated Installation Kit (aka AIK) for free to everyone with very few resctictions on usage (basically, they only prohibit using it as a substitute of a "real" OS, and allow to use it for any diagnostic and reapair tasks). Users of Windows OS can use this AIK to create bootable CD-ROMs and bootable USB-flash drives with Windows PE, which is essentially a stripped-down version of Windows. In this article we will explain how to create bootable CD-ROMs and USB-flash drives with Windows PE using only FOSS software.

Tools we will need

  • cabextract
  • genisoimage (or mkisofs)
  • qemu (or qemu-kvm) virtual machine

and of course the Automated Installation Kit kit itself. The latest version is The Windows® Automated Installation Kit (AIK) for Windows® 7

How to build a bootable WinPE *.iso image

  • From the AIK installation file KB3AIK_EN.iso, provided in the form of a UDF disk image, extract the files wAIKX86.msi and
  • using cabextract, unpack these files into /tmp/wAIKX86.msi/ and /tmp/ respectively
  • create bootable Windows PE *.iso image /tmp/winpe3_x86.iso
cd /tmp
mkdir -p winpe3_x86/iso/boot
mkdir -p winpe3_x86/iso/sources
cp wAIKX86.msi/F_WINPE_X86_bcd winpe3_x86/iso/boot/bcd
cp wAIKX86.msi/F_WINPE_X86_boot.sdi winpe3_x86/iso/boot/boot.sdi
cp winpe3_x86/iso/sources/boot.wim
cp wAIKX86.msi/ winpe3_x86/iso/
genisoimage -sysid "" -A "" -V "Microsoft Windows PE (x86)" -d -N -b -no-emul-boot \
 -c -hide -hide -o winpe3_x86.iso winpe3_x86/iso

the file you will get will be about 120M in size. Then you can burn this *.iso and boot it on any x86-machine which supports booting from CD-ROMs (which is pretty much any PC today)

How to build a bootable WinPE USB-flash image

a more convenient option would be to create a bootable USB-flash drive. Unfortunately, you will only be able to use it on PCs which support booting from USB-HDDs. Some BIOSes only support booting from USB-FDDs.

  • prepare a blank
dd if=/dev/zero of=winpe3_x86.img count=250000
  • boot winpe3_x86.iso (which you've created before) in a virtual machine
qemu -cdrom winpe3_x86/winpe3_x86.iso -boot d -m 640 -hda winpe3_x86.img
  • now, in the shell provided by Windows PE in the virtual machine
diskpart> list disk
diskpart> select disk 0
diskpart> clean
diskpart> create partition primary
diskpart> list partition
diskpart> select partition 1
diskpart> format fs=fat32 quick
diskpart> active
diskpart> assign
diskpart> list volume
diskpart> exit
xcopy /s d:\* c:\
wpeutil shutdown
  • then the virtual machine shuts down, you can copy Windows PE image on a flash media. It will fit on any media > 125M in size.
dd if=winpe3_x86.img of=/dev/sdb

and use it for test/diagnostic tasks such as firmware upgrades. If you want, you can create an additional partition for you firmware/diagnostic tools, just don't mess with the partition created by Windows -- you may reder it unbootable.