/**
@page dfu_generating OTA-DFU - Generating your own packages

The following procedures assume that you are working with your own custom firmware. You will need to do the following to generate your own packages:

-# Generate your own public and private key pair.
-# Generate a custom bootloader.
-# Generate custom bootloader settings.

To run these tasks, you will require <a href="https://github.com/NordicSemiconductor/pc-nrfutil" target="blank">nrfutil</a>.

@section dfu_custom_key Replacing the public key

Before you can generate DFU packages, you must first generate new keys. Cryptographic keys are required to sign and validate a Device Firmware Update package. Before running your own custom DFU, you must generate your own private-public key pair.

To generate a new private key, run the following command with nrfutil installed:
@code
nrfutil keys generate private-key.pem
@endcode

Make sure you keep this key secret. The command generates the new key file in the folder where you ran the command.

Now, generate a public key from the private one:
@code
nrfutil keys display --key pk --format code private-key.pem --out_file dfu_public_key.c
@endcode

Copy the public_key.c from where you generated it to @c \<InstallFolder\>\\project\\bootloader_secure\\dfu_public_key.c.

@section dfu_custom_bootloader Generating the bootloader

To generate a new bootloader, compile the <tt>Bootloader</tt> project using either Keil μVision or GCC. Flash the compiled bootloader onto Thingy.
Remember to flash the SoftDevice as well for the OTA-DFU to function properly.

@section dfu_generate_package Generating a DFU package

Run <tt>nrfutil pkg generate</tt> to generate a ZIP file that you can later use with a mobile or desktop application to update the Thingy firmware, as described in <a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.tools/dita/tools/nrfutil/nrfutil_pkg.html" target="blank">nrfutil documentation</a>.
For example:
@code
nrfutil pkg generate --application <path_to_hex_file> --application-version 0 --hw-version 52 --sd-req 0x98 --key-file private-key.pem dfu-app.zip
@endcode

@subsection dfu_version Version requirements
This command contains essential information about the versions of the application and of the hardware. These versions determine whether it will be possible to perform a valid DFU process. DFU is only possible if:
- The application version is greater than or equal to the previous application version.
@note If an existing app is replaced with a new one with a higher version number, Thingy will reinitialize parts of its flash storage, and BLE configurable settings will revert to default.
- The hw-version property is the same as in the previous version.
- The bootloader version is greater than the previous bootloader version (bootloader version is provided when you update the bootloader).

@section dfu_assembly Manual firmware assembly

A firmware package which supports OTA-DFU must consist of the following four elements:
- Application
- SoftDevice
- Bootloader
- Bootloader settings

@subsection dfu_bootloader_settings Bootloader settings

Bootloader settings is a special area in the bootloader that contains information about the DFU process, as well as information about the versions of the application and the bootloader. You must generate your own bootloader settings file for your custom application. See <a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.tools/dita/tools/nrfutil/nrfutil_settings_generate_display.html" target="blank">nrfutil documentation</a> for information on how to generate the bootloader settings file.
Refer to @ref dfu_version and make sure that you set correct versions when generating the bootloader settings file.

@section dfu_perform_after_gen Running a DFU with a custom package

When your custom package is ready, follow the procedure in @ref dfu_connect to run an OTA-DFU.
*/
