Licensing tool
MiraOS requires a valid license on the device.
Each license is unique to the device, and cannot be copied from one device to another.
Reading a status report from a License Generator¶
Use the mira_license.py tool.
./mira_license.py -d /dev/ttyXXXXX -t report
Where /dev/ttyXXXXX is the device name for the License Generator UART interface.
The command generates a license report on the command line interface. The report shows the number of generated licenses, as well as the number of allowed licenses for this License Generator.
Reading the device ID of a connected device¶
Use the mira_license.py tool.
To read the device ID of an NRF device, use:
./mira_license.py -d /dev/ttyXXXXX -P nrfjprog -s NNNNN
To read the device ID of an mkw41z device, use:
./mira_license.py -d /dev/ttyXXXXX -P nxp_mkw41z -s NNNNN
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.
The device ID is printed on the command line interface.
Signing a connected device¶
Use the mira_license.py tool.
To sign an NRF device, use:
./mira_license.py -d /dev/ttyXXXXX -t license -P nrfjprog -s NNNNN -a AAAAA -l LLLLL
To sign an mkw41z device, use:
./mira_license.py -d /dev/ttyXXXXX -t license -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 'CERTIFICATE' area in the .ld script of the target.
LLLLL is the length of the 'CERTIFICATE' 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 -d /dev/ttyXXXXX -t generate -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 -d /dev/ttyXXXXX -t license -P ihex -a AAAAA -l LLLLL -i IIIII -f FILE
Signing a device with remotely generated license¶
./mira_license.py -t license -P PROG -a AAAAA -l LLLLL -I FILE
Where PROG is the programmer.
AAAAA is the origin of the 'CERTIFICATE' area in the .ld script of the target.
LLLLL is the length of the 'CERTIFICATE' area in the .ld script of the target.
FILE is the name of the license file. Must be a textfile generated with 
-t generate and -f arguments.
Signing a gateway¶
./mira_license.py -d /dev/ttyXXXXX -t license -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.
Changing the license storage¶
The address (-a) and length (-l) of the certificate block can be changed for
a given build, to match the 'CERTIFICATE' space in the .ld script, when using a
custom ld script. For more information, see:
./mira_license.py -h
API¶
To check license validity at runtime, see API documentation