The pkg command generates a package to use for a Device Firmware Update (DFU). The package contains the new firmware image, an init packet, and a manifest file that indicates the package format. The command can also be used to display the package contents.
Run nrfutil pkg generate to generate a zip file that you can use later with a mobile application or another tool to update the firmware of an nRF5 device. You can see available options by entering the following command:
nrfutil pkg generate --help
Run nrfutil pkg display to display the contents of a package.
nrfutil pkg generate --application app.hex app_dfu_package.zip
Enter the following command to generate a package called
app_dfu_package.zip from the application file
app.hex with application version 4 that requires hardware
version 51 and SoftDevice S130 v2.0.0 (0x80) and is signed with the private key that is
stored in
key.pem:nrfutil pkg generate --hw-version 51 --sd-req 0x80 --application-version 4 --application app.hex --key-file key.pem app_dfu_package.zip
Enter the following command to generate an unsigned debug package without version information from the application file app.hex:
nrfutil pkg generate --debug-mode --application app.hex app_dfu_package.zip
Enter
the following command to display the contents of the created
package:nrfutil pkg display app_dfu_package.zip
The --hw-version
option must correspond to the nRF5 device used.
The --sd-req
option must correspond to the firmware ID of the
SoftDevice present on the target device. Refer to the list of SoftDevice firmware
IDs (under --sd-req) displayed by the nrfutil pkg generate --help
command.
--sd-req
option is required for compatibility. Any value
provided for this option is ignored during the DFU. Not all combinations of Bootloader, SoftDevice, and Application are possible when generating a package. See Supported Bootloader, SoftDevice, and Application combinations for more information.