Lab 1e: Add a driver to an image
In this lab, we'll add the sample driver - Toaster - package it up, and deploy it to our device.
Prerequisites/Requirements
Make sure you've created a basic image from Create a basic image.
You will need the following tools installed to complete this section:
- Windows Assessment and Deployment Kit (Windows ADK)
- IoT Core PowerShell Environment
- Windows 10 IoT Core Packages
- IoT Core ADK Add-Ons
- A text editor like Notepad or VS Code
Check for similar drivers
Before adding drivers, you may want to review your pre-built Board Support Package (BSP) to make sure there's not already a similar driver.
For example, review the list of drivers in the file: \\IoT-ADK-AddonKit\\Source-arm\\BSP\\Rpi2\\Packages\\RPi2FM.xml
If there's not an existing driver, you can usually just add one.
If there is a driver, but it doesn't meet your needs, you'll need to replace the driver by creating a new BSP. We'll cover that in Lab 2.
Create your driver files
- Complete the steps listed under the Toaster Driver sample to build this sample. You'll create a file, wdfsimple.sys, which you'll use to install the driver.
You can also use your own IoT Core driver, as long as it doesn't conflict with the existing Board Support Package (BSP).
- Copy the files, wdfsimple.sys and wdfsimple.inf, into a test folder, for example:
C:\wdfsimple\
Build a package for your driver
Once the driver files are created, we need to create a package that includes them, and then add that package to our Windows IoT Core image.
Run IoT Core PowerShell Environment as an administrator. Select your appropriate architecture.
Create a driver package using New-IoTDriverPackage.
Add-IoTDriverPackage C:\wdfsimple\wdfsimple.inf Drivers.Toaster
(or) newdrvpkg C:\wdfsimple\wdfsimple.inf Drivers.Toaster
This creates a new folder at C:\MyWorkspace\Source-<arch>\Packages\Drivers.Toaster
.
This also adds a FeatureID DRIVERS_TOASTER to the C:\MyWorkspace\Source-<arch>\Packages\OEMFM.xml
file.
- Build the package using New-IoTCabPackage.
New-IoTCabPackage Drivers.Toaster
(or) buildpkg Drivers.Toaster
Update the project's configuration files
Update the product test configuration file using Add-IoTProductFeature.
Add-IoTProductFeature ProductB Test DRIVERS_TOASTER -OEM
(or) addfid ProductB Test DRIVERS_TOASTER -OEM
Build and test the image
Build the FFU image again, as specified in Create a basic image. You should only have to run the New-IoTFFUImage command:
New-IoTFFUImage ProductX Test
(or)buildimage ProductX Test
Verify driver is installed properly
You can verify that the test driver was installed properly by following the steps in the Toaster Driver sample to test your driver.
Otherwise, if you used another test driver, you can follow these steps:
- Boot up your Windows 10 IoT Core device and make note of its IP address.
- On your technician PC, open File Explorer and in the address bar type in
\\<TARGET_DEVICE_IP>\c$
and press Enter. TARGET_DEVICE_IP will correspond to the IP address of you rdevice.
If you are prompted for credentials, please enter these and click OK. If you have not changed the default credentials use the following:
User ID: Administrator
Password: p@ssw0rd
- Once your credentials are accepted and File Explorer displays the c$ directory of your device, navigate to
c:\Windows\System32\Drivers
and look for the gpiokmdfdemo.sys file. If present, this validates that your driver has been properly installed on your device.