Create and install a package

Packages are the logical building blocks of IoT Core. From device drivers to system files, every component must be contained in a package. This is the smallest servicable unit on the device.

Step 1: Get set up


Install the tools

  1. Windows Assessment and Deployment Kit(Windows ADK)
  2. IoT Core ADK Add-Ons
  3. Windows Driver Kit (WDK)

Set up your environment

  • Edit \IoT-ADK-AddonKit\Tools\setOEM.cmd to set the OEM_NAME
  • Launch IoTCoreShell.cmd ( this one launches in the elevated prompt )
  • Select the required architecture in the Set Environment for Architecture prompt
  • Install test signing certificates using InstallOEMCerts . This is required only once for the PC.

To create your own image (FFU), get the tools needed to customize Windows IoT Core

Step 2: Create a new package


  1. Create a package definition xml file (.pkg.xml file), and specify the files and reg keys you want to add. Learn more at Specifying components in a package and Elements and Attributes of a package

  2. Build the package: buildpkg.cmd filename.pkg.xml. The .cab file will be created in the build directory \IoT-ADK-AddonKit\Build\<arch>\pkgs.

Create a package with files and reg keys

Below is an example for specifying files and reg keys.

<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="urn:Microsoft.WindowsPhone/PackageSchema.v8.00"
   Owner="OEMName"           OwnerType="OEM"
   ReleaseType="Test"        Platform="PlaformName"
   Component="ComponentName" SubComponent="SubName">
   <Components>
      <OSComponent>
         <Files>
            <File Source="$(_RELEASEDIR)\test_file1.dll"/>
            <File Source="$(_RELEASEDIR)\toBeRenamed.dat"
               DestinationDir="$(runtime.system32)\test" Name="test.dat"/>
         </Files>
         <RegKeys>
            <RegKey KeyName="$(hklm.software)\OEMName\test">
               <RegValue Name="StringValue" Value="Test string" Type="REG_SZ"/>
               <RegValue Name="DWordValue" Value="12AB34CD" Type="REG_DWORD"/>
               <RegValue Name="BinaryValue" Value="12,AB,CD,EF" Type="REG_BINARY"/>
            </RegKey>
            <RegKey KeyName="$(hklm.software)\OEMName\EmptyKey"/>
         </RegKeys>
      </OSComponent>
   </Components>
</Package>

Create an Appx package

Use appx2pkg.cmd tool to generate the .pkg.xml file for a given appx file. This tool expects the appx dependencies in the sub directory named “dependencies” in the folder containing the appx file.

You can also create the Appx component directly in the IoTCoreShell, using the following steps

> newappxpkg HelloWorld.appx fga Appx.HelloWorld
> buildpkg Appx.HelloWorld

fga sets the appx as the foreground startup app, bgt sets the appx as the background task and none skips startup configuration.

See Appx.IoTCoreDefaultApp as an example.

See also

Create a driver package

The driver package contains the references (InfSource) to the Inf file for the driver and also lists all the files referenced in the Inf file. You can author the driver .pkg.xml file manually or use inf2pkg.cmd tool that generates package xml based on the input inf file.

inf2cab.cmd tool creates the package xml file and also builds the cab file directly by invoking buildpkg.cmd internally.

NOTE

Windows IoT Core supports Universal Inf only

See also

Step 3: Install on device


  • Connect to the device ( using SSH or using Powershell )
  • Copy the .cab file to the device to a directory say C:\OemInstall
  • Initiate staging of the package using applyupdate -stage C:\OemInstall\<filename>.cab. Note that this step is be repeated for each package, when you have multiple packages to install.
  • Commit the packages using applyupdate -commit.

The device will reboot into the update OS (showing gears) to install the packages and will reboot again to main OS. This process can take a few minutes.


Was this page helpful?
Additional feedback?
Thank you! We appreciate your feedback.
Follow us