Skip to content

Commit

Permalink
Merge pull request ms-iot#251 from ms-iot/develop
Browse files Browse the repository at this point in the history
Device Update center tools update
  • Loading branch information
parameshbabu authored Jul 3, 2018
2 parents a6b43fb + bb08a80 commit a9660c5
Show file tree
Hide file tree
Showing 14 changed files with 356 additions and 70 deletions.
2 changes: 1 addition & 1 deletion Source-arm/BSP/QCDB410C/Packages/QCDB410CFM.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<FeatureID>SBC</FeatureID>
</FeatureIDs>
</PackageFile>
<PackageFile Path="%BSPPKG_DIR%" Name="Qualcomm.M8016SOC_SBC_ATHENS.acpi.cab">
<PackageFile Path="%BSPPKG_DIR%" Name="Qualcomm.M8016SOC_SBC.acpi.cab">
<FeatureIDs>
<FeatureID>SBC</FeatureID>
</FeatureIDs>
Expand Down
1 change: 0 additions & 1 deletion Source-arm/Products/DigitalSign/TestOEMInput.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
<Feature>IOT_FTSER2K_MAKERDRIVER</Feature>

<Feature>IOT_POWER_SETTINGS</Feature>
<!-- Feature>IOT_HWN_CLASS_EXTENSION</Feature -->
<Feature>IOT_USBFN_CLASS_EXTENSION</Feature>
<Feature>IOT_GENERIC_POP</Feature>
<!-- both these are Required for Cortana -->
Expand Down
4 changes: 2 additions & 2 deletions Source-x86/BSP/CustomMBM/OEMInputSamples/TestOEMInput.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<!-- for Connectivity -->
<Feature>IOT_WEBB_EXTN</Feature>
<Feature>IOT_POWERSHELL</Feature>
<Feature>IOT_NETCMD</Feature>

<Feature>IOT_SSH</Feature>
<Feature>IOT_SIREP</Feature>
<!-- Enabling Test images -->
Expand All @@ -61,7 +61,7 @@
<Feature>IOT_WDTF</Feature>
<Feature>IOT_CRT140</Feature>
<Feature>IOT_DIRECTX_TOOLS</Feature>
<Feature>PRODUCTION_CORE</Feature>

<Feature>PRODUCTION</Feature>
<!-- Sample Apps, remove this when you introduce OEM Apps -->
<Feature>IOT_BERTHA</Feature>
Expand Down
4 changes: 2 additions & 2 deletions Source-x86/BSP/MBM/OEMInputSamples/TestOEMInput.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<!-- for Connectivity -->
<Feature>IOT_WEBB_EXTN</Feature>
<Feature>IOT_POWERSHELL</Feature>
<Feature>IOT_NETCMD</Feature>

<Feature>IOT_SSH</Feature>
<Feature>IOT_SIREP</Feature>
<!-- Enabling Test images -->
Expand All @@ -61,7 +61,7 @@
<Feature>IOT_WDTF</Feature>
<Feature>IOT_CRT140</Feature>
<Feature>IOT_DIRECTX_TOOLS</Feature>
<Feature>PRODUCTION_CORE</Feature>

<Feature>PRODUCTION</Feature>
<!-- Sample Apps, remove this when you introduce OEM Apps -->
<Feature>IOT_BERTHA</Feature>
Expand Down
7 changes: 3 additions & 4 deletions Templates/bsp/RetailOEMInputTemplate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<AdditionalFM>%BLD_DIR%\MergedFMs\{BSP}FM.xml</AdditionalFM>
<!-- Including OEM feature manifest -->
<AdditionalFM>%BLD_DIR%\MergedFMs\OEMCommonFM.xml</AdditionalFM>
<AdditionalFM>%BLD_DIR%\MergedFMs\OEMFM.xml</AdditionalFM>
<!--AdditionalFM>%BLD_DIR%\MergedFMs\OEMFM.xml</AdditionalFM-->

</AdditionalFMs>
<Features>
Expand All @@ -42,9 +42,8 @@
<!-- Include BSP Features -->

<!-- Include OEM features -->
<Feature>OEM_IoTCoreDefaultApp</Feature>
<Feature>OEM_CustomCmd</Feature>
<Feature>OEM_ProvAuto</Feature>
<Feature>CUSTOM_CMD</Feature>
<Feature>PROV_AUTO</Feature>

</OEM>
</Features>
Expand Down
7 changes: 3 additions & 4 deletions Templates/bsp/TestOEMInputTemplate.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<AdditionalFM>%BLD_DIR%\MergedFMs\{BSP}FM.xml</AdditionalFM>
<!-- Including OEM feature manifest -->
<AdditionalFM>%BLD_DIR%\MergedFMs\OEMCommonFM.xml</AdditionalFM>
<AdditionalFM>%BLD_DIR%\MergedFMs\OEMFM.xml</AdditionalFM>
<!--AdditionalFM>%BLD_DIR%\MergedFMs\OEMFM.xml</AdditionalFM-->

<!-- Including the test features -->
<AdditionalFM>%AKROOT%\FMFiles\{arch}\IoTUAPNonProductionPartnerShareFM.xml</AdditionalFM>
Expand All @@ -43,9 +43,8 @@
<!-- Include BSP Features -->

<!-- Include OEM features -->
<Feature>OEM_IoTCoreDefaultApp</Feature>
<Feature>OEM_CustomCmd</Feature>
<Feature>OEM_ProvAuto</Feature>
<Feature>CUSTOM_CMD</Feature>
<Feature>PROV_AUTO</Feature>

</OEM>
</Features>
Expand Down
131 changes: 131 additions & 0 deletions Tools/DeviceModel.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
######################################
# DeviceModel.ps1
# Creates the Device Model XML file to upload in the Device Update Center
######################################

Param(
[string] $productname,
[switch] $Silent
)

################
# Main Function
################

$dixmlfile = "$env:SRC_DIR\Products\$productname\IoTDeviceModel_$($productname).xml"
Write-Host "DeviceInventory file : $dixmlfile"
if (Test-Path $dixmlfile) {
Write-Host "$dixmlfile already exists" -ForegroundColor Red
return
}

$arch = $env:ARCH
$key = "Registry::HKEY_CLASSES_ROOT\Installer\Dependencies\Microsoft.Windows.Windows_10_IoT_Core_$($arch)_Packages.x86.10"
if (Test-Path $key) {
$corekitver = (Get-ItemProperty -Path $key).Version
$corekitver = $corekitver.Replace("10.1.", "10.0.")
}
else {
Write-Host "IoT Core kit ver not found in registry" -ForegroundColor Red
return
}

Write-Host "OS Version : $corekitver"
Write-Host "BSP Version : $env:BSP_VERSION"

$smbioscfg = "$env:SRC_DIR\Products\$productname\SMBIOS.CFG"
if (Test-Path $smbioscfg) {
Write-Host "Parsing SMBIOS.CFG to get SMBIOS information"
$doc = Get-Content $smbioscfg
foreach ($line in $doc) {
$parts = $line.Split(",")
if ($parts[0] -eq "01") {
switch ($parts[1]) {
'04' {
$Manufacturer = $parts[3] -replace '"', ""
Write-Host "Manufacturer : $Manufacturer"
break
}
'05' {
$ProductName = $parts[3] -replace '"', ""
Write-Host "Product Name : $ProductName"
break
}
'19' {
$SKUNumber = $parts[3] -replace '"', ""
Write-Host "SKU Number : $SKUNumber"
break
}
'1A' {
$Family = $parts[3] -replace '"', ""
Write-Host "Family : $Family"
break
}
}
}
}
}
$encoding = [System.Text.Encoding]::UTF8
$xmlwriter = New-Object System.Xml.XmlTextWriter($dixmlfile, $encoding)
$xmlwriter.Formatting = "Indented"
$xmlwriter.Indentation = 4
$xmlwriter.WriteStartDocument()
$xmlwriter.WriteStartElement("DeviceInventory")
$xmlwriter.WriteAttributeString("SchemaVersion", "1")
$xmlwriter.WriteAttributeString("BuildArch", $env:BSP_ARCH)
$xmlwriter.WriteAttributeString("OSString", $corekitver)
$xmlwriter.WriteAttributeString("OCPString", $env:BSP_VERSION)
$xmlwriter.WriteStartElement("MachineInfo")
if ($Manufacturer) {
$usrinput = $Manufacturer
}
else {
if (!$Silent) {
$usrinput = Read-Host("Enter Manufacturer ")
}
else { $usrinput = $env:OEM_NAME }
}
$xmlwriter.WriteAttributeString("Manufacturer", $usrinput)
if ($Family) {
$usrinput = $Family
}
else {
if (!$Silent) {
$usrinput = Read-Host("Enter Family ")
}
else { $usrinput = $env:OEM_NAME + "Family" }
}
$xmlwriter.WriteAttributeString("Family", $usrinput)
if ($ProductName) {
$usrinput = $ProductName
}
else {
$usrinput = $productname
}
$xmlwriter.WriteAttributeString("ProductName", $usrinput)
if ($SKUNumber) {
$usrinput = $SKUNumber
}
else {
if (!$Silent) {
$usrinput = Read-Host("Enter SKUNumber ")
}
else { $usrinput = $productname + "01" }
}
$xmlwriter.WriteAttributeString("SKUNumber", $usrinput)
$usrinput = "Fabrikam"
if (!$Silent) {
$usrinput = Read-Host("Enter BaseboardManufacturer ")
}
$xmlwriter.WriteAttributeString("BaseboardManufacturer", $usrinput)
$usrinput = $productname + "_v01"
if (!$Silent) {
$usrinput = Read-Host("Enter BaseboardProduct (HWvID) ")
}
$xmlwriter.WriteAttributeString("BaseboardProduct", $usrinput)
$xmlwriter.WriteEndElement() # MachineInfo element
$xmlwriter.WriteEndElement() # DeviceInventory element
$xmlwriter.WriteEndDocument()
$xmlwriter.Flush()
$xmlwriter.Close()
Write-Host "DeviceInventory created"
48 changes: 48 additions & 0 deletions Tools/ExportBSPDB.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
######################################
# ExportBSPDB.ps1
# Exports the cab files referred in the BSPDBPublish xml file
######################################

Param(
[string] $FFUDir,
[string] $DestDir
)

################
# Main Function
################
$BSPDBPublishxml = "$FFUDir\$($env:FFUNAME).BSPDB_publish.xml"

$bspdbpubdoc = [xml] (get-content $BSPDBPublishxml)
$BSPVersion = $bspdbpubdoc.CompDBPublishingInfo.BSPVersion
Write-Host "BSP Version : $BSPVersion"

if ($BSPVersion -ine $env:BSP_VERSION ) {
Write-Host "BSP version is different from $env:BSP_VERSION." -ForegroundColor Red
#return
}
Write-Host "Exporting required packages to $outputpath"
$packages = $bspdbpubdoc.GetElementsByTagName("Package")
Foreach ($package in $packages) {
Write-Host $package.Path
if (!(Test-Path $package.Path )) {
$package.Path = $env:MSPACKAGE + "\" + $package.Path
if (!(Test-Path $package.Path )) {
Write-Host "$($package.Path) not found" -ForegroundColor Red
}
}
Copy-Item $package.Path $DestDir
}
$BSPDBxml = "$FFUDir\$($env:FFUNAME).BSPDB.xml"
Write-Host "Exporting BSP DB"
Copy-Item $BSPDBxml $DestDir
$bspdbdoc = [xml] (get-content $BSPDBxml)
$pkgs = $bspdbdoc.CompDB.Packages.Package
$ocpname = Split-Path $DestDir -Leaf
$outfile = "$DestDir\..\$($ocpname)_pkgver.txt"
#$outfile = Resolve-Path $outfile
Set-Content -Path $outfile -Value "PackageName,Version"
foreach ($pkg in $pkgs) {
Add-Content -Path $outfile -Value "$($pkg.ID).cab,$($pkg.Version)"
}

88 changes: 88 additions & 0 deletions Tools/ImportConfig.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<#
# ImportConfig.ps1
# Imports the CUSConfig.zip file (downloaded from Device Update Center) into the product directory
# and updates the input xmls with the required changes
#>

Param(
[string] $productname,
[string] $zipfile
)

################
# Main Function
################

$productdir = "$env:SRC_DIR\Products\$productname"
if (!(Test-Path $productdir)) {
Write-Host "Error: $productdir not found." -ForegroundColor Red
return
}
if (!(Test-Path $zipfile)) {
Write-Host "Error: $zipfile not found." -ForegroundColor Red
return
}

#check if config files are already present
$cfgdir = "$productdir\Packages\CUSConfig"
if (Test-Path $cfgdir){
Write-Host "Error: CUSConfig files already exists."
return
} else {
New-Item $cfgdir -ItemType Directory | Out-Null
}

#unzip the file
Expand-Archive -Path $zipfile -DestinationPath $cfgdir
Write-Host "Updating OEMInputXML files"

$ocpfmfile = "%BLD_DIR%\MergedFMs\OCPUpdateFM.xml"

$files = Get-ChildItem -Path $productdir\ -File -Filter *OEMInput.xml | Foreach-Object {$_.FullName}
foreach ($file in $files) {
$filename = Split-Path -Path $file -Leaf
Write-Host "Processing $filename"
$xmlfile = [xml] (Get-Content -Path $file)
# add the FM file
$node = $xmlfile.GetElementsByTagName("AdditionalFM") | Where-Object { ($_.InnerText) -ieq $ocpfmfile }
if ($node) {
Write-Host " Add OCPUpdateFM : Exists"
}else{
$fmnode = $xmlfile.OEMInput.AdditionalFMs
$newfm = $xmlfile.CreateElement("AdditionalFM", "http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")
$newfm.InnerText = $ocpfmfile
$retval = $fmnode.AppendChild($newfm)
Write-Debug "$newfm added"
Write-Host " Add OCPUpdateFM : Added"
$dirty = $true
}
# remove featureid IOT_GENERIC_POP
$fid = "IOT_GENERIC_POP"
$node = $xmlfile.GetElementsByTagName("Feature") | Where-Object { ($_.InnerText) -ieq $fid }
if ($node) {
$parentnode = $node.ParentNode
$oldnode = $parentnode.RemoveChild($node)
Write-Host " Remove $fid : Removed"
Write-Debug "$oldnode removed"
$dirty = $true
} else {
Write-Host " Remove $fid : Skip, doesn't exist"
}
# add feature id CUS_DEVICE_INFO
$fid = "CUS_DEVICE_INFO"
$node = $xmlfile.GetElementsByTagName("Feature") | Where-Object { ($_.InnerText) -ieq $fid }
if ($node) {
Write-Host " Add $fid : Exists"
} else {
$node = $xmlfile.OEMInput.Features.OEM
$newfid = $xmlfile.CreateElement("Feature","http://schemas.microsoft.com/embedded/2004/10/ImageUpdate")
$newfid.InnerText = $fid
$retval = $node.AppendChild($newfid)
Write-Debug "$newfid added"
Write-Host " Add $fid : Added"
$dirty = $true
}
if ($dirty) {
$xmlfile.Save($file) | Out-Null
}
}
2 changes: 1 addition & 1 deletion Tools/LaunchTool.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ REM Change to Working directory
cd /D %IOTADK_ROOT%\Tools

doskey /macrofile=alias.txt
set IOT_ADDON_VERSION=5.1
set IOT_ADDON_VERSION=5.3

echo IOTADK_ROOT : %IOTADK_ROOT%
echo ADK_VERSION : %ADK_VERSION%
Expand Down
2 changes: 1 addition & 1 deletion Tools/bsptools/QCDB410C/FMCabList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Qualcomm.QC8916.smbios_cfg.cab
Qualcomm.QC8916.MemRes_ModemLite.cab
Qualcomm.QC8916_SBC.ACSP.cab
Qualcomm.QC8916_SBC.qcaud.cab
Qualcomm.M8016SOC_SBC_ATHENS.acpi.cab
Qualcomm.M8016SOC_SBC.acpi.cab
Qualcomm.QC8916.qcAccGyroMPU6050.cab
Qualcomm.QC8916.qcSynapticsTouch.cab
Qualcomm.QC8916.qcFocalTechTouch.cab
Expand Down
Loading

0 comments on commit a9660c5

Please sign in to comment.