Skip to content

Licensing tool

Each node (implementing MiraOS, MiraMesh, or Border Gateway radio) needs a unique license from a license generator.

Every license is unique to the device, and cannot be copied from one device to another.

mira_license is a python script used to work with licenses and license dongles.

Instructions for installation of it is in the README.md file in the libmira/tools directory.

The first argument to the script says what sub-command to run.

To see the available sub-commands, run:

./mira_license.py -h

To see the available arguments to a sub-command, in this example the "report" sub-command, run:

./mira_license.py report -h

Reading a status report from a License Generator

Use the mira_license.py tool.

./mira_license.py report -d /dev/ttyXXXXX
or
./mira_license.py report -d /dev/ttyXXXXX -F filename

Where /dev/ttyXXXXX is the device name for the License Generator UART interface.

The command generates a license report and either writes it the given filename or it is shown as output from the program.

The report shows the number of generated licenses, as well as the number of allowed licenses for this license dongle.

Reading the device ID of a connected device

To read the device ID of an NRF device, use:

./mira_license.py get_device_id -P nrfjprog -s NNNNN

To read the device ID of an mkw41z device, use:

./mira_license.py get_device_id -P nxp_mkw41z -s NNNNN

NNNNN is the serial number of the programmer, which can be retrieved using nrfjprog --ids. If -s NNNNN is not provided, one of the connected device's serial numbers are used.

The device ID is printed on the command line interface.

Signing a connected device

To sign an NRF device, when the license dongle is connected to the computer, run:

./mira_license.py license -d /dev/ttyXXXXX -P nrfjprog -s NNNNN -a AAAAA -l LLLLL

To sign an mkw41z device, use:

./mira_license.py license -d /dev/ttyXXXXX -P nxp_mkw41z -s NNNNN -a AAAAA -l LLLLL

Where /dev/ttyXXXXX is the device name for the License Generator UART interface.
NNNNN is the serial number of the programmer, which can be retrieved using nrfjprog --ids. AAAAA is the origin of the 'FACTORY_CONFIG' area in the .ld script of the target.
LLLLL is the length of the 'FACTORY_CONFIG' area in the .ld script of the target.

Generating license for a remote device

To generate licenses remotely the device ID must be specified. The device ID can be read out by this tool, is printed by MiraOS upon startup, and can be supplied at runtime via the Mira API, see API documentation. The license will be saved to a file.

./mira_license.py generate -d /dev/ttyXXXXX -i IIIII -F FILE
Where /dev/ttyXXXXX is the device name for the License Generator UART interface.
IIIII is the device ID of the target.
FILE is the name of the file created. The file is in text format, and the license is in Base64.

The license can also be saved in Intel HEX format. In that case address and length must be specified.

./mira_license.py generate -d /dev/ttyXXXXX -P ihex -a AAAAA -l LLLLL -i IIIII -f FILE

Signing a device with remotely generated license

./mira_license.py license -P PROG -a AAAAA -l LLLLL -I FILE

Where PROG is the programmer.
AAAAA is the origin of the 'FACTORY_CONFIG' area in the .ld script of the target.
LLLLL is the length of the 'FACTORY_CONFIG' area in the .ld script of the target.
FILE is the name of the license file. Must be a textfile generated with generate and -f arguments.

Signing a gateway

./mira_license.py generate -d /dev/ttyXXXXX -i NNNNN -F NNNNN.lic
Put the created NNNNN.lic file in the licenses sub-directory.

Where /dev/ttyXXXXX is the device name for the License Generator UART interface.
NNNNN is the device id of the gateway's radio. The gateway will write the device name in its logs when the license is missing.

Using a custom linkscript

When using a custom linkscript one must ensure that the address (-a) and length (-l) matches the origin address and length of the 'FACTORY_CONFIG' area in the custom linkscript.

API

To check license validity at runtime, see API documentation

Back to top