Skip to content

Commit ff1d77f

Browse files
committed
Update tool to use DriverUpdater for installing drivers
1 parent 48f198c commit ff1d77f

5 files changed

Lines changed: 8 additions & 24 deletions

File tree

DeviceProfiles/CitymanProfile.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ public string Bootloader()
1212

1313
public string DriverCommand(string DriverFolder)
1414
{
15-
string definitionFile = $@"{DriverFolder}\definitions\950xl.txt";
16-
string[] definitionPaths = File.ReadAllLines(definitionFile).Where(x => !string.IsNullOrEmpty(x)).ToArray();
17-
string driverCommand = $"{string.Join(" ", definitionPaths.Select(x => $"/Driver:\"{DriverFolder}\\{x}\""))} /Recurse";
18-
return driverCommand;
15+
return $@"{DriverFolder}\definitions\950xl.txt";
1916
}
2017

2118
public string FFUFileName(string OSVersion, string Language, string Sku)

DeviceProfiles/HapaneroAAProfile.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ public string Bootloader()
1212

1313
public string DriverCommand(string DriverFolder)
1414
{
15-
string definitionFile = $@"{DriverFolder}\definitions\rx130aa.txt";
16-
string[] definitionPaths = File.ReadAllLines(definitionFile).Where(x => !string.IsNullOrEmpty(x)).ToArray();
17-
string driverCommand = $"{string.Join(" ", definitionPaths.Select(x => $"/Driver:\"{DriverFolder}\\{x}\""))} /Recurse";
18-
return driverCommand;
15+
return $@"{DriverFolder}\definitions\rx130aa.txt";
1916
}
2017

2118
public string FFUFileName(string OSVersion, string Language, string Sku)

DeviceProfiles/HapaneroABProfile.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ public string Bootloader()
1212

1313
public string DriverCommand(string DriverFolder)
1414
{
15-
string definitionFile = $@"{DriverFolder}\definitions\rx130ab.txt";
16-
string[] definitionPaths = File.ReadAllLines(definitionFile).Where(x => !string.IsNullOrEmpty(x)).ToArray();
17-
string driverCommand = $"{string.Join(" ", definitionPaths.Select(x => $"/Driver:\"{DriverFolder}\\{x}\""))} /Recurse";
18-
return driverCommand;
15+
return $@"{DriverFolder}\definitions\rx130ab.txt";
1916
}
2017

2118
public string FFUFileName(string OSVersion, string Language, string Sku)

DeviceProfiles/TalkmanProfile.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ public string Bootloader()
1212

1313
public string DriverCommand(string DriverFolder)
1414
{
15-
string definitionFile = $@"{DriverFolder}\definitions\950.txt";
16-
string[] definitionPaths = File.ReadAllLines(definitionFile).Where(x => !string.IsNullOrEmpty(x)).ToArray();
17-
string driverCommand = $"{string.Join(" ", definitionPaths.Select(x => $"/Driver:\"{DriverFolder}\\{x}\""))} /Recurse";
18-
return driverCommand;
15+
return $@"{DriverFolder}\definitions\950.txt";
1916
}
2017

2118
public string FFUFileName(string OSVersion, string Language, string Sku)

MainLogic.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ public static bool VerifyAllComponentsArePresent()
2424
var BlankVHD = @"blank.vhdx";
2525
var wimlib = @"wimlib-imagex.exe";
2626
var Img2Ffu = @"Img2Ffu.exe";
27+
var DriverUpdater = @"DriverUpdater.exe";
2728

28-
if (!(File.Exists(wimlib) && File.Exists(Img2Ffu) && File.Exists(BlankVHD)))
29+
if (!(File.Exists(wimlib) && File.Exists(Img2Ffu) && File.Exists(BlankVHD) && File.Exists(DriverUpdater)))
2930
{
3031
Logging.Log("Some components could not be found", Logging.LoggingLevel.Error);
3132
return false;
@@ -46,7 +47,6 @@ public static bool VerifyAllComponentsArePresent()
4647
public static string MountVHD(string VHDPath, bool readOnly)
4748
{
4849
Logging.Log("Mounting " + VHDPath + (readOnly ? " as read only" : "") + "...");
49-
//RunProgram("powershell.exe", $"-command \"Import-module hyper-v; Mount-VHD -Path '{VHDPath}'" + (readOnly ? " -ReadOnly" : "") + "\"");
5050
var id = VHDUtils.MountVHD(VHDPath, readOnly);
5151
Logging.Log(id, Logging.LoggingLevel.Warning);
5252
return id;
@@ -55,7 +55,6 @@ public static string MountVHD(string VHDPath, bool readOnly)
5555
public static void DismountVHD(string VHDPath)
5656
{
5757
Logging.Log("Dismounting " + VHDPath + "...");
58-
//RunProgram("powershell.exe", $"-command \"Import-module hyper-v; Dismount-VHD -Path '{VHDPath}'\"");
5958
VHDUtils.UnmountVHD(VHDPath);
6059
}
6160

@@ -146,6 +145,7 @@ public static void GenerateWindowsFFU(GenerateWindowsFFUOptions options)
146145
var tmp = @"tmp";
147146
var SystemPartition = "Y:";
148147
var Img2Ffu = @"Img2Ffu.exe";
148+
var DriverUpdater = @"DriverUpdater.exe";
149149

150150
if (!Directory.Exists(tmp))
151151
Directory.CreateDirectory(tmp);
@@ -183,17 +183,13 @@ public static void GenerateWindowsFFU(GenerateWindowsFFUOptions options)
183183
}
184184

185185
Logging.Log("Adding drivers");
186-
RunProgram("dism.exe", $"/Image:{TVHDLetter} /Add-Driver " + deviceProfile.DriverCommand(options.DriverPack));
186+
RunProgram(DriverUpdater, $"{deviceProfile.DriverCommand(options.DriverPack)} {options.DriverPack} {TVHDLetter} DisablePostUpgrade");
187187

188188
DismountVHD(TmpVHD);
189189

190-
//DiskId = MountVHD(TmpVHD, true);
191-
192190
Logging.Log("Making FFU");
193191
RunProgram(Img2Ffu, $"-i {TmpVHD} -f \"{options.Output + "\\" + deviceProfile.FFUFileName(options.WindowsVer, "EN-US", "PRO")}\" -p {deviceProfile.PlatformID()} -o {options.WindowsVer}");
194192

195-
//DismountVHD(TmpVHD);
196-
197193
Logging.Log("Deleting Temp VHD");
198194
File.Delete(TmpVHD);
199195
}

0 commit comments

Comments
 (0)