Skip to content

Commit

Permalink
Merge fd91409 into 239f20e
Browse files Browse the repository at this point in the history
  • Loading branch information
felfert committed Jul 1, 2020
2 parents 239f20e + fd91409 commit 8317091
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions WinImageBuilder.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ $VirtIODrivers = @("balloon", "netkvm", "pvpanic", "qemupciserial", "qxl",
"qxldod", "vioinput", "viorng", "vioscsi", "vioserial", "viostor")

$VirtIODriverMappings = @{
"2k8" = @(60, 1);
"2k8r2" = @(61, 1);
"w7" = @(61, 0);
"2k12" = @(62, 1);
"w8" = @(62, 0);
"2k12r2" = @(63, 1);
"w8.1" = @(63, 0);
"2k16" = @(100, 1);
"w10" = @(100, 0);
"2k8" = @(60, 0, 1);
"2k8r2" = @(61, 0, 1);
"w7" = @(61, 0, 0);
"2k12" = @(62, 0, 1);
"w8" = @(62, 0, 0);
"2k12r2" = @(63, 0, 1);
"w8.1" = @(63, 0, 0);
"2k16" = @(100, 14393, 1);
"2k19" = @(100, 17763, 1);
"w10" = @(100, 0, 0);
}

$AvailableCompressionFormats = @("tar","gz","zip")
Expand Down Expand Up @@ -719,6 +720,8 @@ function Get-VirtIODrivers {
[parameter(Mandatory=$true)]
[int]$MajorMinorVersion,
[parameter(Mandatory=$true)]
[int]$BuildNumber,
[parameter(Mandatory=$true)]
[int]$IsServer,
[parameter(Mandatory=$true)]
[string]$BasePath,
Expand All @@ -733,7 +736,10 @@ function Get-VirtIODrivers {
foreach ($driver in $VirtioDrivers) {
foreach ($osVersion in $VirtIODriverMappings.Keys) {
$map = $VirtIODriverMappings[$osVersion]
if (!(($map[0] -eq $MajorMinorVersion) -and ($map[1] -eq $isServer))) {
if (!(($map[0] -eq $MajorMinorVersion) -and ($map[2] -eq $isServer))) {
continue
}
if (($map[1] -ne 0) -and ($map[1] -ne $BuildNumber)) {
continue
}
$driverPath = "{0}\{1}\{2}\{3}" -f @($basePath,
Expand All @@ -748,7 +754,7 @@ function Get-VirtIODrivers {
}
if (!$driverPaths -and $RecursionDepth -lt 1) {
# Note(avladu): Fallback to 2012r2/w8.1 if no drivers are found
$driverPaths = Get-VirtIODrivers -MajorMinorVersion 63 -IsServer $IsServer `
$driverPaths = Get-VirtIODrivers -MajorMinorVersion 63 -BuildNumber 0 -IsServer $IsServer `
-BasePath $BasePath -Architecture $Architecture -RecursionDepth 1
}
return $driverPaths
Expand Down Expand Up @@ -789,8 +795,8 @@ function Add-VirtIODrivers {
# For VirtIO ISO with drivers version higher than 1.8.x
$majorMinorVersion = [string]$image.ImageVersion.Major + [string]$image.ImageVersion.Minor
$virtioDriversPaths = Get-VirtIODrivers -MajorMinorVersion $majorMinorVersion `
-IsServer ([int](Is-ServerInstallationType $image)) -BasePath $driversBasePath `
-Architecture $image.ImageArchitecture
-BuildNumber $image.ImageVersion.Build -IsServer ([int](Is-ServerInstallationType $image)) `
-BasePath $driversBasePath -Architecture $image.ImageArchitecture
foreach ($virtioDriversPath in $virtioDriversPaths) {
if (Test-Path $virtioDriversPath) {
Add-DriversToImage $vhdDriveLetter $virtioDriversPath
Expand Down

0 comments on commit 8317091

Please sign in to comment.