Firmware image found with MediaTek MT76xx wifi chipsets.
This page hosts a formal specification of Andes Firmware Image layout as seen in MT76 Wifi Chipsets using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
All parsing code for JavaScript generated by Kaitai Struct depends on the JavaScript runtime library. You have to install it before you can parse data.
The JavaScript runtime library is available at npm:
npm install kaitai-struct
See the usage examples in the JavaScript notes.
Parse structure from an ArrayBuffer:
var arrayBuffer = ...;
var data = new AndesFirmware(new KaitaiStream(arrayBuffer));
After that, one can get various attributes from the structure by accessing fields or properties like:
data.imageHeader // => get image header
// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define(['kaitai-struct/KaitaiStream'], factory);
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('kaitai-struct/KaitaiStream'));
} else {
root.AndesFirmware = factory(root.KaitaiStream);
}
}(typeof self !== 'undefined' ? self : this, function (KaitaiStream) {
/**
* Firmware image found with MediaTek MT76xx wifi chipsets.
*/
var AndesFirmware = (function() {
function AndesFirmware(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
AndesFirmware.prototype._read = function() {
this._raw_imageHeader = this._io.readBytes(32);
var _io__raw_imageHeader = new KaitaiStream(this._raw_imageHeader);
this.imageHeader = new ImageHeader(_io__raw_imageHeader, this, this._root);
this.ilm = this._io.readBytes(this.imageHeader.ilmLen);
this.dlm = this._io.readBytes(this.imageHeader.dlmLen);
}
var ImageHeader = AndesFirmware.ImageHeader = (function() {
function ImageHeader(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
ImageHeader.prototype._read = function() {
this.ilmLen = this._io.readU4le();
this.dlmLen = this._io.readU4le();
this.fwVer = this._io.readU2le();
this.buildVer = this._io.readU2le();
this.extra = this._io.readU4le();
this.buildTime = KaitaiStream.bytesToStr(this._io.readBytes(16), "UTF-8");
}
return ImageHeader;
})();
return AndesFirmware;
})();
return AndesFirmware;
}));