Difference between revisions of "Windows PE"

From ThinkWiki
Jump to: navigation, search
(←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...')
 
Line 13: Line 13:
 
* From the AIK installation file <tt>KB3AIK_EN.iso</tt>, provided in the form of a UDF disk image, extract the files <tt>wAIKX86.msi</tt> and <tt>WinPE.cab</tt>
 
* From the AIK installation file <tt>KB3AIK_EN.iso</tt>, provided in the form of a UDF disk image, extract the files <tt>wAIKX86.msi</tt> and <tt>WinPE.cab</tt>
 
* using <tt>cabextract</tt>, unpack these files into <tt>/tmp/wAIKX86.msi/</tt> and <tt>/tmp/WinPE.cab/</tt> respectively
 
* using <tt>cabextract</tt>, unpack these files into <tt>/tmp/wAIKX86.msi/</tt> and <tt>/tmp/WinPE.cab/</tt> respectively
* create bootable Windows PE *.iso image <tt>/tmp/winpe3_x86.iso</tt>
+
* create a bootable Windows PE *.iso image <tt>/tmp/winpe3_x86.iso</tt>
 
  cd /tmp
 
  cd /tmp
 
  mkdir -p winpe3_x86/iso/boot
 
  mkdir -p winpe3_x86/iso/boot
Line 31: Line 31:
 
  dd if=/dev/zero of=winpe3_x86.img count=250000
 
  dd if=/dev/zero of=winpe3_x86.img count=250000
 
* boot <tt>winpe3_x86.iso</tt> (which you've created before) in a virtual machine
 
* boot <tt>winpe3_x86.iso</tt> (which you've created before) in a virtual machine
  qemu -cdrom winpe3_x86/winpe3_x86.iso -boot d -m 640 -hda winpe3_x86.img
+
  qemu -cdrom winpe3_x86.iso -boot d -m 640 -hda winpe3_x86.img
 
* now, in the shell provided by Windows PE in the virtual machine
 
* now, in the shell provided by Windows PE in the virtual machine
 
  diskpart.exe
 
  diskpart.exe

Revision as of 07:17, 20 March 2010

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 WinPE.cab
  • using cabextract, unpack these files into /tmp/wAIKX86.msi/ and /tmp/WinPE.cab/ respectively
  • create a 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 WinPE.cab/F1_WINPE.WIM winpe3_x86/iso/sources/boot.wim
cp wAIKX86.msi/F_WINPE_X86_etfsboot.com winpe3_x86/iso/etfsboot.com
genisoimage -sysid "" -A "" -V "Microsoft Windows PE (x86)" -d -N -b etfsboot.com -no-emul-boot \
 -c boot.cat -hide etfsboot.com -hide boot.cat -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.iso -boot d -m 640 -hda winpe3_x86.img
  • now, in the shell provided by Windows PE in the virtual machine
diskpart.exe
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.