Skip to content

Commit

Permalink
Merge pull request #23 from T-vK/unattended-win-install
Browse files Browse the repository at this point in the history
Major refactor
  • Loading branch information
T-vK authored Nov 24, 2021
2 parents e662245 + 8c3c275 commit 1527df2
Show file tree
Hide file tree
Showing 91 changed files with 4,405 additions and 1,740 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
/vm-files/*.fd
/vm-files/*.iso
/vm-files/*.img
/vm-files/*.vfd
/vm-files/*.aml
/vm-files/patched-ovmf-files
/vm-files/MAC_ADDRESS.txt
/acpi-tables/*.aml
/thirdparty
/user.conf
/helper-iso-files/bin
/utils/nvflash_linux
/helper-iso-files/drivers
/helper-iso-files/.checksum
/live-iso-files/*.iso
/live-iso-files/scripts/chocolatey-install.ps1
/utils/nvflash_linux
/tmp
.*.swp
.*.swo
*.asc
191 changes: 87 additions & 104 deletions README.md

Large diffs are not rendered by default.

82 changes: 33 additions & 49 deletions default.conf
Original file line number Diff line number Diff line change
@@ -1,70 +1,54 @@
VM_NAME="WindowsVM" # Required
# Predefined variables: PROJECT_DIR (contains the path to the MobilePassthrough project)

CPU_CORE_COUNT=1 # Required
RAM_SIZE=8G # Required
VM_DISK_SIZE=40G # Required once, Changing this after the drive image has been created has no effect
# Variables that require a reinstall when changed (./mbpt.sh install)
VM_NAME="MBPT_WindowsVM" # Can't be empty; no spaces allowed
VM_FILES_DIR="${PROJECT_DIR}/vm-files" # The folder into which all files for your VM will be saved (Can't be an empty string)
DRIVE_IMG="${VM_FILES_DIR}/${VM_NAME}.img" # The location of your VM disk (Can't be an empty string)
VM_DISK_SIZE="40G" # Required once; changing this after the drive image has been created has no effect, unless you reinstall (E.g. "40G", "250G", ...); At least "40G" is highly recommended; "30G" will probably work, but Windows will break if you use it all
INSTALL_IMG="${VM_FILES_DIR}/windows10.iso" # Path of Windows 10 ISO used during installation (Will be downloaded to that location if it doesn't exist; Can't be an empty string)

VM_FILES_DIR="${PROJECT_DIR}/vm-files" # Required ; The folder into which all files for your VM will be saved
# Variables that can be changed between VM starts (./mbpt.sh start)
CPU_CORE_COUNT="auto" # "auto" is recommended (e.g. "8", "12" or "auto"); "auto" uses all, but one core, but no more than 16
RAM_SIZE="auto" # "auto" is recommended (e.g. "8G", "10G" or "auto"); "auto" uses [all free RAM]-1GB, but no more than 16GB

DRIVE_IMG="${VM_FILES_DIR}/${VM_NAME}.img" # Required ; The location of your VM disk
DGPU_PCI_ADDRESS="auto" # E.g. "01:00:0" or "auto", "auto" will use the fist dGPU it finds (if more than one, you will be asked which one to use; after 10 seconds it will timeout and use the fist one); see output of lspci
IGPU_PCI_ADDRESS="auto" # Only Intel iGPUs supported atm; recommended to leave on "auto"; Use "" to disable or "auto" to automatically detect it (recommended); required for mediated iGPU passthrough. you can check your iGPU PCI address using lspci
DGPU_PASSTHROUGH="auto" # "auto", "true" or "false" ("auto" Recommended) "auto" will enable it if the system has more than one GPU
SHARE_IGPU="auto" # "auto", "true", or "false"; only works for Intel iGPUs atm; "auto" will enable it automatically if an Intel iGPU is detected; Recommended to save battery life (this is mediated iGPU passthrough using GVT-g)

INSTALL_IMG="${VM_FILES_DIR}/windows10.iso" # Required for Windows installation
DGPU_ROM="" # Optional (Can help getting rid of error 43); Use "" to not load a vBIOS ROM or specify a path to one (e.g. "${VM_FILES_DIR}/vbios-roms/vbios.rom")
IGPU_ROM="" # Optional (Can help getting rid of error 43); Use "" to not load a vBIOS ROM or specify a path to one (e.g. "${VM_FILES_DIR}/vbios-roms/igpu-vbios.rom")
PATCH_OVMF_WITH_VROM="true" # "true" or "false"; Recommended to avoid Error 43; (Doesn't do anything, unless you specify a DGPU_ROM or IGPU_ROM)

DGPU_ROM="" # Optional; for example "${VM_FILES_DIR}/vbios-roms/vbios.rom"
IGPU_ROM="" # Optional; for example "${VM_FILES_DIR}/vbios-roms/igpu-vbios.rom"
MAC_ADDRESS="auto" # Required (E.g. 00:11:22:33:44:55 or auto to generate a new one with every VM start)
NETWORK_MODE="bridged" # Supports bridged or none
SMB_SHARE_FOLDER="" # Optional; for example "${VM_FILES_DIR}/vmshare" or "" to not use it

SMB_SHARE_FOLDER="" # Optional; for example "${VM_FILES_DIR}/vmshare"
VIRTUAL_INPUT_TYPE="virtio" # "usb-tablet", "virtio" or "". If keyboard input doesn't work properly for you, you may want to use "virtio" instead of "usb-tablet"

OVMF_CODE="/usr/share/OVMF/OVMF_CODE.fd" # Required
OVMF_VARS="/usr/share/OVMF/OVMF_VARS.fd" # Required
OVMF_VARS_VM="${VM_FILES_DIR}/OVMF_VARS_VM.fd" # Required
OVMF_CODE="/usr/share/OVMF/OVMF_CODE.fd" # Path to the unmodified OVMF_CODE image
OVMF_VARS="/usr/share/OVMF/OVMF_VARS.fd" # Path to the unmodified OVMF_VARS image
OVMF_VARS_VM="${VM_FILES_DIR}/OVMF_VARS_VM.fd" # Path to where a copy of the unmodified OVMF_VARS image will be created automatically

VIRTIO_WIN_IMG="/usr/share/virtio-win/virtio-win.iso" # Required for driver installation
HELPER_ISO="${VM_FILES_DIR}/mobile-passthrough-helper.iso" # Required for automated driver installation, looking glass setup, IP setup, remote desktop setup etc. inside of the VM

HELPER_ISO="${VM_FILES_DIR}/mobile-passthrough-helper.iso" # Required for automated driver installation, looking glass setup, IP setup, remote desktop setup etc inseide of the VM
LOOKING_GLASS_MAX_SCREEN_WIDTH="1920" # 1920 Recommended (bigger resolutions will result in a bigger buffer with worse performance)
LOOKING_GLASS_MAX_SCREEN_HEIGHT="1080" # 1080 Recommended (bigger resolutions will result in a bigger buffer with worse performance)
LOOKING_GLASS_VERSION="B4" # B4 Recommended

DGPU_PCI_ADDRESS=01:00.0 # Required; If you don't use Bumblebee, you have to set this to the correct PCI address of your dGPU (see output of lspci)
# This project has only been tested with Bumblebee enabled.
IGPU_PCI_ADDRESS=00:02.0 # Recommended; required for mediated iGPU passthrough. you can cehck your iGPU PCI address using lspci
DISPLAY_MODE="4" # ("4" is the only working one atm) Display mode to use (e.g. 1 or 2 ... see scripts/utils/common/plugins)

DGPU_PASSTHROUGH=true # Recommended

SHARE_IGPU=true # Recommended to save battery life (this is mediated iGPU passthrough using GVT-g)

HOST_DGPU_DRIVER=nvidia # Only tested with "nvidia" and "amdgpu", not tested with "nouveau"

VIRTUAL_INPUT_TYPE="usb-tablet" # "usb-tablet", "virtio" or "". If keyboard input doesn't work properly for you, you may want to use "virtio" instead of "usb-tablet"

MAC_ADDRESS="" # Required
NETWORK_MODE=TAP # Currently only supports TAP (bridged, NAT and none don't work atm)

USE_LOOKING_GLASS=true # Optional
LOOKING_GLASS_MAX_SCREEN_WIDTH=1920 # Recommended (bigger resolutions will result in a bigger buffer with worse performance)
LOOKING_GLASS_MAX_SCREEN_HEIGHT=1080 # Recommended (bigger resolutions will result in a bigger buffer with worse performance)
LOOKING_GLASS_VERSION=B3 # Recommended

USE_SPICE=true # Required for Windows installation and recommended for Looking Glass
SPICE_PORT=5900 # 5900 is recommended

USE_DMA_BUF=true # Optional

USE_QXL=true # Required for RDP
USE_SPICE="true" # Recommended for Windows installation and required for Looking Glass and QXL
SPICE_PORT="5904" # 5900 is the normal port, but it may already be used by something else on your system like VNC
USE_SPICE_CLIENT="true" # Recommended for installation

USE_FAKE_BATTERY="true" # Recommended to avoid Error 43

PATCH_OVMF_WITH_VROM="true" # Recommended to avoid Error 43
VM_START_MODE="qemu" # "qemu" is recommended ("qemu" or "virt-install")

# USB devices to pass through automatically while the VM is running. Separated by semicolons!
# (See output of lsusb for vendorid/productid or hostbus/hostaddr)
USB_DEVICES=""
# example1: USB_DEVICES="hostbus=3,hostaddr=9"
# example2: USB_DEVICES="vendorid=0x0b95,productid=0x1790"
# example3: USB_DEVICES="vendorid=0x0b12,productid=0x9348;vendorid=0x0b95,productid=0x1790;hostbus=3,hostaddr=9"

####### This part of the config get's burned into the helper iso that you can generate using generate-helper-iso.sh ######
# Not implemented yet; Please change the helper-iso-files/start.bat file manually, if you need to change the IPs
#V_NETWORK_GATEWAY_IP=192.168.99.1 # Recommended (Leave this as is unless you know what you're doing)
#V_NETWORK_DNS_IP=192.168.99.1 # Recommended (Leave this as is unless you know what you're doing)
#V_NETWORK_IP=192.168.99.2 # Recommended (Leave this as is unless you know what you're doing)
# TODO: add DHCP
##########################################################################################################################
169 changes: 169 additions & 0 deletions helper-iso-files/Autounattend.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-PnpCustomizationsWinPE" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" processorArchitecture="amd64" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="2">
<Path>E:\bin\virtio-drivers\Win10\amd64</Path>
</PathAndCredentials>
</DriverPaths>
</component>
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-GB</UILanguage>
</SetupUILanguage>
<InputLocale>en-GB</InputLocale>
<SystemLocale>en-GB</SystemLocale>
<UILanguage>en-GB</UILanguage>
<UILanguageFallback>en-GB</UILanguageFallback>
<UserLocale>en-GB</UserLocale>
</component>
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>EFI</Type>
<Size>100</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>MSR</Type>
<Size>4096</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>3</Order>
<Type>Primary</Type>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>3</PartitionID>
<Label>Windows</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
</Disk>
<WillShowUI>OnError</WillShowUI>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<WillShowUI>OnError</WillShowUI>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME</Key>
<Value>Windows 10 Pro</Value>
</MetaData>
</InstallFrom>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>3</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
<UserData>
<AcceptEula>true</AcceptEula>
<FullName></FullName>
<Organization></Organization>
<ProductKey>
<Key></Key>
<WillShowUI>Never</WillShowUI>
</ProductKey>
</UserData>
<DynamicUpdate>
<Enable>false</Enable>
<WillShowUI>Never</WillShowUI>
</DynamicUpdate>
<EnableFirewall>false</EnableFirewall>
<LogPath>C:\Log</LogPath>
</component>
</settings>
<settings pass="offlineServicing">
<component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EnableLUA>false</EnableLUA>
</component>
</settings>
<settings pass="generalize">
<component name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipRearm>1</SkipRearm>
</component>
</settings>
<!--<settings pass="specialize">
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>en-GB</InputLocale>
<SystemLocale>en-GB</SystemLocale>
<UILanguage>en-GB</UILanguage>
<UILanguageFallback>en-GB</UILanguageFallback>
<UserLocale>en-GB</UserLocale>
</component>
<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>GPU-PASSTHROUGH-VM</ComputerName>
</component>
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
</component>
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<IEHardenAdmin>false</IEHardenAdmin>
<IEHardenUser>false</IEHardenUser>
</component>
<component xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
</component>
</settings>-->
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAccounts>
<AdministratorPassword>
<Value>admin</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
</UserAccounts>
<AutoLogon>
<Password>
<Value>admin</Value>
<PlainText>true</PlainText>
</Password>
<Username>Administrator</Username>
<LogonCount>99</LogonCount>
<Enabled>true</Enabled>
</AutoLogon>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideLocalAccountScreen>true</HideLocalAccountScreen>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
<TimeZone>UTC</TimeZone>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>cmd /q /c "FOR %i IN (A B C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %i:\mbpt-helper.bat cmd /c %i:\mbpt-helper.bat"</CommandLine>
<Description>Install drivers, guest tools, looking glass, enable RDP, etc.</Description>
<Order>1</Order>
<RequiresUserInput>false</RequiresUserInput>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
<cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
Binary file added helper-iso-files/RedHat.cer
Binary file not shown.
Loading

0 comments on commit 1527df2

Please sign in to comment.