<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mjdtjm</id>
	<title>ThinkWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.thinkwiki.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mjdtjm"/>
	<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/wiki/Special:Contributions/Mjdtjm"/>
	<updated>2026-04-20T11:40:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.12</generator>
	<entry>
		<id>https://www.thinkwiki.org/w/index.php?title=Windows_PE&amp;diff=56706</id>
		<title>Windows PE</title>
		<link rel="alternate" type="text/html" href="https://www.thinkwiki.org/w/index.php?title=Windows_PE&amp;diff=56706"/>
		<updated>2016-02-06T15:04:03Z</updated>

		<summary type="html">&lt;p&gt;Mjdtjm: Current release of wimlib-1.9.0 (released January 31, 2016)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some utilities/drivers provided by IBM/Lenovo come only in the form of Windows executables (for example, [[Intel_Active_Management_Technology_(AMT)|Intel AMT]] firmware updates). And for people who don't use Windows OS on their computers it becomes impossible to use/apply them. Luckily, Microsoft provides [http://www.microsoft.com/downloads/en/results.aspx?pocId=&amp;amp;freetext=Automated%20Installation%20Kit&amp;amp;DisplayLang=en 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 &amp;quot;real&amp;quot; OS, and allow to use it for any diagnostic and reapair tasks). The latest version is [http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=696dd665-9f76-4177-a811-39c26d3b3b34 The Windows® Automated Installation Kit (AIK) for Windows® 7]. Users of Windows OS can install this AIK and create bootable CD-ROMs and bootable USB-flash drives with Windows PE (or WinPE for short), 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 WinPE using only free software. Moreover, free software allows to create bootable USB-FDD with WinPE -- the feature not available to users of Microsoft tools :).&lt;br /&gt;
&lt;br /&gt;
==How to build a bootable WinPE *.iso image==&lt;br /&gt;
===Using wimlib===&lt;br /&gt;
* Download, build and install wimlib https://wimlib.net/  Current release: wimlib-1.9.0 (released January 31, 2016)&lt;br /&gt;
** On Debian-based systems:&lt;br /&gt;
    sudo apt-get install debhelper autotools-dev pkg-config libfuse-dev libxml2-dev libssl-dev ntfs-3g-dev attr-dev attr&lt;br /&gt;
    wget https://wimlib.net/downloads/wimlib-1.9.0.tar.gz&lt;br /&gt;
    tar -xzf wimlib-1.9.0.tar.gz&lt;br /&gt;
    cd wimlib-1.9.0&lt;br /&gt;
    dpkg-buildpackage -uc -us -rfakeroot&lt;br /&gt;
    sudo dpkg -i ../wimlib_1.9.0-1_amd64.deb ../wimtools_1.9.0-1_amd64.deb&lt;br /&gt;
* Mount the AIK image&lt;br /&gt;
    mkdir waik&lt;br /&gt;
    sudo mount -o loop,ro KB3AIK_EN.iso waik&lt;br /&gt;
* Create the WinPE image (with drivers extracted by wine)&lt;br /&gt;
    mkwinpeimg --iso --waik-dir=$PWD/waik winpe3_x86.iso --overlay=$HOME/.wine/drive_c/DRIVERS&lt;br /&gt;
* Unmount the AIK image&lt;br /&gt;
    sudo umount waik&lt;br /&gt;
&lt;br /&gt;
===Using standard tools===&lt;br /&gt;
* From the AIK installation file &amp;lt;tt&amp;gt;KB3AIK_EN.iso&amp;lt;/tt&amp;gt;, provided in the form of a UDF disk image, use &amp;lt;tt&amp;gt;7z&amp;lt;/tt&amp;gt; (from [http://sourceforge.net/projects/p7zip p7zip]) to extract the files &amp;lt;tt&amp;gt;wAIKX86.msi&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;WinPE.cab&amp;lt;/tt&amp;gt;&lt;br /&gt;
* use &amp;lt;tt&amp;gt;7z&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;cabextract&amp;lt;/tt&amp;gt; to unpack these files into &amp;lt;tt&amp;gt;/tmp/wAIKX86.msi/&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;/tmp/WinPE.cab/&amp;lt;/tt&amp;gt; respectively&lt;br /&gt;
* create a bootable WinPE *.iso image &amp;lt;tt&amp;gt;/tmp/winpe3_x86.iso&amp;lt;/tt&amp;gt;&lt;br /&gt;
 cd /tmp&lt;br /&gt;
 mkdir -p winpe3_x86/boot&lt;br /&gt;
 mkdir -p winpe3_x86/sources&lt;br /&gt;
 cp wAIKX86.msi/F_WINPE_X86_etfsboot.com winpe3_x86/etfsboot.com&lt;br /&gt;
 cp wAIKX86.msi/F1_BOOTMGR winpe3_x86/bootmgr&lt;br /&gt;
 cp wAIKX86.msi/F_WINPE_X86_bcd winpe3_x86/boot/bcd&lt;br /&gt;
 cp wAIKX86.msi/F_WINPE_X86_boot.sdi winpe3_x86/boot/boot.sdi&lt;br /&gt;
 cp WinPE.cab/F1_WINPE.WIM winpe3_x86/sources/boot.wim&lt;br /&gt;
 genisoimage -sysid &amp;quot;&amp;quot; -A &amp;quot;&amp;quot; -V &amp;quot;Microsoft Windows PE (x86)&amp;quot; -d -N -b etfsboot.com -no-emul-boot \&lt;br /&gt;
  -c boot.cat -hide etfsboot.com -hide boot.cat -o winpe3_x86.iso winpe3_x86&lt;br /&gt;
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)&lt;br /&gt;
&lt;br /&gt;
==How to build a bootable WinPE USB-flash image==&lt;br /&gt;
a more convenient option would be to create a bootable USB-flash drive. Unfortunately, Windows loader &amp;lt;tt&amp;gt;bootmgr&amp;lt;/tt&amp;gt; does not seem to support booting from USB-FDDs, while for some BIOSes this is the only type of bootable USB-flash devices.&lt;br /&gt;
&lt;br /&gt;
===Building WinPE USB-HDD image natively in a virtual machine===&lt;br /&gt;
Since we already have a bootable WinPE *.iso image, we can use native Windows tools to build a bootable WinPE USB-HDD image in a virtual machine like '''qemu'''.&lt;br /&gt;
* prepare a blank&lt;br /&gt;
 dd if=/dev/zero of=winpe3_x86hdd.img count=250000&lt;br /&gt;
* boot &amp;lt;tt&amp;gt;winpe3_x86.iso&amp;lt;/tt&amp;gt; (which you've created before) in a virtual machine&lt;br /&gt;
 qemu -enable-kvm -machine accel=kvm -cdrom winpe3_x86.iso -boot d -m 300 -hda winpe3_x86hdd.img&lt;br /&gt;
* now, in the shell provided by WinPE in the virtual machine&lt;br /&gt;
 diskpart.exe&lt;br /&gt;
 diskpart&amp;gt; list disk&lt;br /&gt;
 diskpart&amp;gt; select disk 0&lt;br /&gt;
 diskpart&amp;gt; clean&lt;br /&gt;
 diskpart&amp;gt; create partition primary&lt;br /&gt;
 diskpart&amp;gt; list partition&lt;br /&gt;
 diskpart&amp;gt; select partition 1&lt;br /&gt;
 diskpart&amp;gt; format fs=fat32 quick&lt;br /&gt;
 diskpart&amp;gt; active&lt;br /&gt;
 diskpart&amp;gt; assign&lt;br /&gt;
 diskpart&amp;gt; list volume&lt;br /&gt;
 diskpart&amp;gt; exit&lt;br /&gt;
 xcopy /s d:\* c:\&lt;br /&gt;
 wpeutil shutdown&lt;br /&gt;
* when the virtual machine shuts down, the bootable WinPE image is ready. If you have write permissions for some flash media device (e.g. &amp;lt;tt&amp;gt;/dev/sdb&amp;lt;/tt&amp;gt;), you can copy it with&lt;br /&gt;
 # dd if=winpe3_x86hdd.img of=/dev/sdb&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
===Building WinPE USB-HDD image with mtools and syslinux===&lt;br /&gt;
if for some ethical or religious reasons you do not want to run any Windows code even in a virtual machine, or you don't have a virtual machine at all -- you can build a bootable WinPE USB-HDD image using '''syslinux''' and '''mtools'''.&lt;br /&gt;
* create and format the partition image&lt;br /&gt;
 dd if=/dev/zero of=winpe3_x86part.img count='''234000'''&lt;br /&gt;
 /sbin/mkfs.vfat -F32 winpe3_x86part.img&lt;br /&gt;
Note: it looks that '''234000''' is the minimal possible size, but you can choose a bigger number.&lt;br /&gt;
* copy the files (you may have to put &amp;quot;mtools_skip_check=1&amp;quot; into &amp;lt;tt&amp;gt;~/.mtoolsrc&amp;lt;/tt&amp;gt; if your partition is not aligned like mine)&lt;br /&gt;
 mmd -i winpe3_x86part.img boot&lt;br /&gt;
 mmd -i winpe3_x86part.img sources&lt;br /&gt;
 mcopy -i winpe3_x86part.img /tmp/wAIKX86.msi/F1_BOOTMGR ::/bootmgr&lt;br /&gt;
 mcopy -i winpe3_x86part.img /tmp/wAIKX86.msi/F_WINPE_X86_bcd ::/boot/bcd&lt;br /&gt;
 mcopy -i winpe3_x86part.img /tmp/wAIKX86.msi/F_WINPE_X86_boot.sdi ::/boot/boot.sdi&lt;br /&gt;
 mcopy -i winpe3_x86part.img /tmp/WinPE.cab/F1_WINPE.WIM ::/sources/boot.wim&lt;br /&gt;
 mcopy -i winpe3_x86part.img /usr/lib/syslinux/chain.c32 ::/chain.c32&lt;br /&gt;
* create the config file &amp;lt;tt&amp;gt;/tmp/syslinux.cfg&amp;lt;/tt&amp;gt; and copy it&lt;br /&gt;
 DEFAULT WinPE&lt;br /&gt;
 LABEL WinPE&lt;br /&gt;
         COM32 /chain.c32&lt;br /&gt;
         APPEND boot ntldr=/bootmgr&lt;br /&gt;
&lt;br /&gt;
 mcopy -i winpe3_x86part.img /tmp/syslinux.cfg ::/syslinux.cfg&lt;br /&gt;
* install syslinux&lt;br /&gt;
 syslinux winpe3_x86part.img&lt;br /&gt;
* create USB-HDD image of the size at least '''32''' sectors bigger than the size of the partition we've just created&lt;br /&gt;
 dd if=/dev/zero of=winpe3_x86hdd.img count='''234032'''&lt;br /&gt;
* create a bootable partition entry&lt;br /&gt;
 /sbin/parted winpe3_x86hdd.img&lt;br /&gt;
 (parted) mklabel msdos&lt;br /&gt;
 (parted) unit s&lt;br /&gt;
 (parted) print free&lt;br /&gt;
 (parted) mkpart primary fat32&lt;br /&gt;
 (parted) set 1 boot on&lt;br /&gt;
 (parted) print&lt;br /&gt;
 (parted) quit&lt;br /&gt;
* copy the partition image into the disk image&lt;br /&gt;
 dd if=winpe3_x86part.img of=winpe3_x86hdd.img seek='''32'''&lt;br /&gt;
where '''32''' is the start sector of your partition&lt;br /&gt;
* now the image is ready. If you have write permissions for some flash media device (e.g. &amp;lt;tt&amp;gt;/dev/sdb&amp;lt;/tt&amp;gt;), you can copy it with&lt;br /&gt;
 # dd if=winpe3_x86hdd.img of=/dev/sdb&lt;br /&gt;
and use it for test/diagnostic tasks such as firmware upgrades.&lt;br /&gt;
&lt;br /&gt;
===Building WinPE USB-FDD image with mtools, syslinux and grub4dos===&lt;br /&gt;
Any BIOS that supports booting from some USB media at all supports booting from USB-FDD. As it was mentioned ealier, the problem with WinPE is that the bootloader &amp;lt;tt&amp;gt;bootmgr&amp;lt;/tt&amp;gt; does not seem to like such devices. So, we will have to create a virtual HDD or a virtual CDROM (I prefer virtual HDD). For some mystical reason, &amp;lt;tt&amp;gt;memdisk&amp;lt;/tt&amp;gt; (the dirver for virtual disks which comes with syslinux) does not work on Thinkpads if the disk image is on a USB media. Thus we will use a rival technology [http://sourceforge.net/projects/grub4dos/files/ grub4dos].&lt;br /&gt;
* create USB-FDD image&lt;br /&gt;
 dd if=/dev/zero of=winpe3_x86fdd.img count='''238200'''&lt;br /&gt;
 /sbin/mkfs.vfat -F32 winpe3_x86fdd.img&lt;br /&gt;
Note: it looks that '''238200''' is the minimal possible size, but you can choose a bigger number.&lt;br /&gt;
* download [http://sourceforge.net/projects/grub4dos/files/ grub4dos] and copy &amp;lt;tt&amp;gt;grub.exe&amp;lt;/tt&amp;gt;&lt;br /&gt;
 mcopy -i winpe3_x86fdd.img grub.exe ::/&lt;br /&gt;
* copy the payload&lt;br /&gt;
 mcopy -i winpe3_x86fdd.img winpe3_x86part.img ::/&lt;br /&gt;
Note that this is the image of the partition, not of the whole HD. The reason why it works is grub.exe's [http://grub4dos.sourceforge.net/wiki/index.php/Grub4dos_tutorial#Auto_MBR_creation Auto MBR creation] feature, which tricks &amp;lt;tt&amp;gt;bootmgr&amp;lt;/tt&amp;gt; into thinking that it boots from a real HD.&lt;br /&gt;
* create the config file &amp;lt;tt&amp;gt;/tmp/syslinux.cfg&amp;lt;/tt&amp;gt; and copy it&lt;br /&gt;
 DEFAULT WinPE&lt;br /&gt;
 LABEL WinPE&lt;br /&gt;
         KERNEL /grub.exe&lt;br /&gt;
         APPEND --config-file=&amp;quot;map (rd) (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)&amp;quot;&lt;br /&gt;
         INITRD /winpe3_x86part.img&lt;br /&gt;
&lt;br /&gt;
 mcopy -i winpe3_x86fdd.img /tmp/syslinux.cfg ::/syslinux.cfg&lt;br /&gt;
'''Note''': for a virtual CDROM, your &amp;lt;tt&amp;gt;syslinux.cfg&amp;lt;/tt&amp;gt; should look like&lt;br /&gt;
 DEFAULT WinPE&lt;br /&gt;
 LABEL WinPE&lt;br /&gt;
         KERNEL /grub.exe&lt;br /&gt;
         APPEND --config-file=&amp;quot;map (rd) (hd32); map --hook; root (hd32); chainloader (hd32)&amp;quot;&lt;br /&gt;
         INITRD /winpe3_x86.iso&lt;br /&gt;
'''Note''': if your computer is low on RAM (less than 350Mb) you may also try the following &amp;lt;tt&amp;gt;syslinux.cfg&amp;lt;/tt&amp;gt; with direct mapping and make sure that the payload &amp;lt;tt&amp;gt;winpe3_x86part.img&amp;lt;/tt&amp;gt; is in one contiguous disk area.&lt;br /&gt;
 DEFAULT WinPE&lt;br /&gt;
 LABEL WinPE&lt;br /&gt;
         KERNEL /grub.exe&lt;br /&gt;
         APPEND --config-file=&amp;quot;map (hd0)/winpe3_x86part.img (fd0); map --hook; chainloader (fd0)+1; rootnoverify (fd0)&amp;quot;&lt;br /&gt;
* install syslinux&lt;br /&gt;
 syslinux winpe3_x86fdd.img&lt;br /&gt;
* now the image is ready. If you have write permissions for some flash media device (e.g. &amp;lt;tt&amp;gt;/dev/sdb&amp;lt;/tt&amp;gt;), you can copy it with &lt;br /&gt;
 # dd if=winpe3_x86fdd.img of=/dev/sdb&lt;br /&gt;
and use it for test/diagnostic tasks such as firmware upgrades.&lt;/div&gt;</summary>
		<author><name>Mjdtjm</name></author>
		
	</entry>
</feed>