├── .gitignore
├── AutoUnattend-tpl.xml
├── LICENSE.txt
├── README.md
├── from-tpl.sh
├── makeiso.sh
└── wsim
├── Firstrun
└── setup.ps1
└── Out-of-Box Drivers
└── virtio
├── netkvm.cat
├── netkvm.inf
├── netkvm.sys
├── vioscsi.cat
├── vioscsi.inf
├── vioscsi.sys
├── viostor.cat
├── viostor.inf
└── viostor.sys
/.gitignore:
--------------------------------------------------------------------------------
1 | .*
2 | AutoUnattend.xml
3 |
--------------------------------------------------------------------------------
/AutoUnattend-tpl.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | 1
57 |
58 | 12286
59 | Primary
60 |
61 |
62 |
63 |
64 | true
65 | false
66 | NTFS
67 |
68 | C
69 | 1
70 | 1
71 |
72 |
73 | 0
74 | true
75 |
76 | OnError
77 |
78 |
79 |
80 |
81 | 0
82 | 1
83 |
84 | OnError
85 |
86 |
87 | /IMAGE/NAME
88 |
89 | Windows 7 HOMEBASIC
90 |
91 | Windows 7 HOMEPREMIUM
92 |
93 | Windows 7 PROFESSIONAL
94 |
95 | Windows 7 ULTIMATE
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 | YGFVB-QTFXQ-3H233-PTWTJ-YRYRV
105 |
106 | RHPQ2-RMFJH-74XYM-BH4JX-XM76F
107 |
108 | HYF8J-CVRMY-CM74G-RPHKF-PW487
109 |
110 | D4F6K-QK3RD-TMVMJ-BBMRX-3MBMV
111 |
112 | OnError
113 |
114 | true
115 |
116 |
117 | 0
118 |
119 | true
120 |
121 |
122 |
123 | en-US
124 |
125 | en-US
126 | en-US
127 | en-US
128 | nl-NL
129 |
130 |
131 |
132 |
133 | %configsetroot%\Out-of-Box Drivers\virtio
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 | 3
142 | Other
143 | true
144 | true
145 |
146 |
147 |
148 |
149 | User
150 | Administrators
151 |
152 |
153 | UABhAHMAcwB3AG8AcgBkAA==
154 | false
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 | 1
163 | %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass %SystemRoot%\ConfigSetRoot\Firstrun\setup.ps1
164 | Run post-installation scripts
165 |
166 |
167 | 2
168 | cmd /c rd /s /q %SystemRoot%\ConfigSetRoot
169 | Remove post-installation scripts
170 |
171 |
172 |
173 | 32
174 | 1280
175 | 800
176 |
177 |
178 |
179 | true
180 |
181 |
182 |
183 |
184 |
185 | 32
186 | 1280
187 | 800
188 |
189 | QEMU
190 | false
191 | W. Europe Standard Time
192 | false
193 |
194 |
195 | true
196 |
197 |
198 | true
199 | true
200 | http://10.0.2.2:8888/
201 | false
202 | true
203 |
204 |
205 | 1
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 Peter Wu
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18 | OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19 | OR OTHER DEALINGS IN THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Windows Bootstrap
2 | This repository contains scripts and tools to automate installation and
3 | configuration of a Windows 7 machine for use in QEMU. The scripts are intended
4 | to run under a Linux system and will output an ISO image containing an
5 | `AutoUnattend.xml` file which will answer Setup questions.
6 |
7 | **Note: the generated iso will wipe your disk without questions!**
8 |
9 | The scripts are written with a 64-bit iso, but can be adopted for 32-bit
10 | installations if wanted.
11 |
12 | ## Requirements
13 | mkisofs is needed by makeiso.sh to create a iso file (part of cdrkit, package
14 | genisomage on Ubuntu).
15 |
16 | A Windows 7 iso is (obviously) needed to start the installation. Tested with:
17 |
18 | Windows 7 Ultimate x64 English
19 | http://msft.digitalrivercontent.net/win/X17-59465.iso
20 | size 3320903680 bytes
21 | md5 c9f7ecb768acb82daacf5030e14b271e
22 | sha1 36ae90defbad9d9539e649b193ae573b77a71c83
23 |
24 | Tested with QEMU 2.0.0 on Ubuntu 14.04 LTS, QEMU 2.1 on Arch Linux.
25 |
26 | ## Usage
27 | Example shell script:
28 |
29 | winiso=X17-59465.iso
30 | diskimg=win7.qcow2
31 | automateiso=bootstrap.iso
32 |
33 | # Create the bootstrap image
34 | # Second argument can be basic, premium, pro or ultimate (see from-tpl.sh)
35 | ./makeiso.sh "$automateiso" basic
36 |
37 | # Create QEMU disk image
38 | qemu-img create -f qcow2 "$diskimg" 12G
39 |
40 | # Start the installation
41 | qemu-system-x86_64 \
42 | -machine pc,accel=kvm -m 4G -smp threads=2 -vga std \
43 | -usb -usbdevice tablet \
44 | -drive if=none,aio=native,discard=unmap,file="$diskimg",id=vd0 \
45 | -device virtio-scsi-pci -device scsi-disk,drive=vd0 \
46 | -drive media=cdrom,aio=native,file="$winiso" \
47 | -drive media=cdrom,aio=native,file="$automateiso" \
48 | -net user,id=user0 -net nic,model=virtio,id=vnet0
49 |
50 | For reference, installation on an i7-3770 with all three files in a 18GiB tmpfs
51 | took about 4m30s to 5m following the above commands. The disk space utilization
52 | as measured using virt-df is somehow the same for all editions (Home Basic, Home
53 | Premium, Professional and Ultimate) and are about 7.90 GiB. This includes the
54 | pagefile, once rebooted about 6.87-7.00 GiB will be in use.
55 |
56 | Do not forget to install updates which will take a lot more time and disk space.
57 |
58 | ## Configuration details
59 | Many Windows features have been disabled, see
60 | [AutoUnattended-tpl.xml](AutoUnattended-tpl.xml) for details. Overview of
61 | settings:
62 |
63 | - Disk size: 12 GiB (page file disabled).
64 | - Additional drivers: virtio (netkvm, vioscsi, viostor).
65 | - Default user: User, default password: Password.
66 | - Locale: en-US (mostly, using userLocale nl-NL for Euros).
67 | - Computer name: QEMU
68 | - Resolution: 1280x800 (color depth: 32).
69 | - Timezone: UTC+1 (Europe/Amsterdam)
70 | - Homepage: http://10.0.2.2:8888/ (10.0.2.2 is the host IP address when QEMU
71 | user networking is in use).
72 |
73 | On post-installation, `wsim\Firstrun\setup.ps1` gets executed which:
74 |
75 | - Show hidden and system files, unhide file extensions.
76 | - Display "Computer" icon on desktop.
77 | - Disable page files and hibernation.
78 | - If Windows is not already activated, execute the `slactivate` program at
79 | `wsim\Firstrun\slactivate` (with an extension such as .cmd, .exe, etc.). If
80 | that file exists and runs a zero status code, then the system will reboot to
81 | complete the activation.
82 |
83 | ## Known issues
84 | The bootstrap image for the Basic edition shows an error after the first reboot
85 | ("Completing installation") which makes the installation not quite unattended.
86 |
87 | ## Third-party software
88 | The virtio drivers have been retrieved from
89 | http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/
90 |
91 | ## Copyright
92 | Windows is a trademark blabla Microsoft blabla registered US blabla bla.
93 |
94 | The Windows virtio drivers are GPLd, see
95 | http://www.linux-kvm.org/page/WindowsGuestDrivers for details.
96 |
97 | The scripts and configuration files are provided under the terms in the MIT
98 | license (see LICENSE.txt for details).
99 |
--------------------------------------------------------------------------------
/from-tpl.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Generates an AutoUnattend.xml file from AutoUnattend-tpl.xml
3 | # Supported markers (anchored at the begin of a line) in the file are:
4 | # -