https://github.com/vooon/ota-mkfw
Firmware packer like px_mkfw.py
https://github.com/vooon/ota-mkfw
Last synced: about 1 month ago
JSON representation
Firmware packer like px_mkfw.py
- Host: GitHub
- URL: https://github.com/vooon/ota-mkfw
- Owner: vooon
- License: apache-2.0
- Created: 2016-02-05T20:58:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-29T08:21:02.000Z (almost 10 years ago)
- Last Synced: 2025-02-25T15:36:24.446Z (over 1 year ago)
- Language: Python
- Size: 28.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ota-mkfw: fimrware image packer
===============================
Simple proof-of-concept firmware image packer.
It works similar to [`px_mkfw.py`][1] from PX4 firmware,
except it uses [RFC-7049 (CBOR)][2] instead of JSON.
Thanks to binay format we may omit base64 encoding, and gzip is optional.
File format
-----------
For CBOR there exists own CDDL, but JSON-like is easier to understood:
```none
// File
[ // File root element is Array
"OTAFWv1", // first element is magic string (in map it's position unpredictable)
Metadata{}, // second - Metadata object (map)
{ // third element - image map
"firmware.bin": Image{}, // required
"parameters.xml": Image{}, // optional additional data
...
}
]
// EOF
// Metadata object
{
"description": "some description", // may be ""
"build_date": Tag(0, "2016-02-09T23:57:09+0300"), // RFC3339, alternative: Tag(1, )
"version": "0.1.0", // may be `git describe`
"revision": "", // SCM revision.
"board": "", // Board ID
... // extensions
}
// Image object
{
"load_address": 0x00800000, // optional, flash location
"dfu_alt": 0, // optional, DFU Alternate setting number (look dfu-util)
"size": 123, // uncompressed size to verify payload
"sha1sum": "", // optional, SHA1 digest of uncompressed data
"image": "", // File data. May be raw byte string and compressed (tagged)
// deflated: Tag(12222, "")
... // extensions
}
```
Comparison
----------
Current PX4 master (3e02bb1), px4fmu-v2: `.px4` file size is 847153, `.ofw` - 635442.
Both has same images of:
| image | size (bytes) |
| ------------------ | ------------:|
| firmware_nuttx.bin | 992428 |
| parameters.xml | 204128 |
| airframes.xml | 21010 |
```
ota-mkfw -o nuttx-px4fmu-v2-default.ofw --desc PX4FMUv2 --board PX4FMUv2 --git-identity -n firmware.bin -a 0x00800000 --dfu-alt 0 -n parameters.xml -n airframes.xml firmware_nuttx.bin ../../../parameters.xml ../../../airframes.xml
```
The difference not so great, also base64 and JSON parser exist everywhere,
while CBOR require additional libraries.
[1]: https://github.com/PX4/Firmware/blob/master/Tools/px_mkfw.py
[2]: https://tools.ietf.org/html/rfc7049