-用 git 克隆 Yabs 的 repo,并开始你的初始工作目录。
$ git clone https://github.com/pr1ntf/YetAnotherBhyveScript.git Cloning into 'YetAnotherBhyveScript'... remote: Counting objects: 22, done. remote: Compressing objects: 100% (17/17), done. remote: Total 22 (delta 9), reused 17 (delta 4), pack-reused 0 Unpacking objects: 100% (22/22), done. Checking connectivity... done.$ mv YetAnotherBhyveScript/ win2k8auto$ cd win2k8auto/-使用 fetch 命令从 Peter 那里取得固件,并从 Fedora Project 取得驱动。我将使用 0.1-94 版驱动,因为较新版的驱动在 Windows 2008 下不能正常工作。
$ fetch https://people.freebsd.org/~grehan/bhyve_uefi/BHYVE_UEFI_20151002.fd $ fetch https://fedorapeople.org/groups/virt/virtio-win/deprecated-isos/archives/virtio-win-0.1-94/virtio-win-0.1-94.iso-我找到的 ISO 安装文件叫做 Win2k8R2.iso,其目录内容如下:
$ ls BHYVE_UEFI_20151002.fd Win2k8-AutoUnattend.xml extract.sh remaster.sh yabs.sh README.txt Win2k8R2.iso null.iso virtio-win-0.1-94.iso-我们现在必须修改 extract.sh 脚本来指向正确的位置。要注意运行 extract.sh 需要 FreeBSD 的 Port archivers/pz7ip。我的文件如下:
#!/bin/sh
# Extract important stuff to remaster folder
folder=win2k8
iso=Win2k8R2.iso
drivers=virtio-win-0.1-94.iso
mkdir -p ${folder}/virtio
7z x ${iso} -o${folder}
tar xf $drivers -C ${folder}/virtio
-在我们执行 ./extract.sh 之后我们可以将 AutoUnattend.xml 文件复制到我们的 win2k8 目录下。Yabs 中包含的 AutoUnattend.xml 文件会将管理员密码设置为 R3dm0nd!,并会将默认网卡 IP 设置为 192.168.0.111 并具有指定网关和子网掩码。因此一定要先对其进行修改。你可以在此文件中删除第二个 <SynchronousCommand wcm:action="add">。(在第一次登陆时执行这个命令 netsh interface ipv4 set address source=static address=192.168.0.111 mask=255.255.255.0 gateway=192.168.0.1)。
$ cat Win2k8-AutoUnattend.xml
<?xml version="1.0" encoding="utf-8"?><unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="" xmlns:xsi="">
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Size>400</Size>
<Type>EFI</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Size>128</Size>
<Type>MSR</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>3</Order>
<Extend>true</Extend>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<!-- EFI system partition (ESP) -->
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<!-- Windows partition -->
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>3</PartitionID>
</WindowsFeatures>
<Themes>
<ThemeName>Classic Theme</ThemeName>
<DefaultThemesOff>true</DefaultThemesOff>
</Themes>
<ShowWindowsLive>false</ShowWindowsLive>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd /C bcdedit /emssettings emsport:1 emsbaudrate:115200</CommandLine>
<Description>Enable EMS</Description>
<Order>1</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>netsh interface ipv4 set address source=static
address=192.168.0.111 mask=255.255.255.0 gateway=192.168.0.1</CommandLine>
<Order>2</Order>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
<settings pass="offlineServicing">
<component processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance">
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="1">
<Path>d:\virtio</Path>
</PathAndCredentials>
</DriverPaths>
</component>
</settings></unattend>$ cp Win2k8-AutoUnattend.xml win2k8/AutoUnattend.xml