-
Couldn't load subscription status.
- Fork 218
add specification for TP-Link's minifs #682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
armijnhemel
wants to merge
4
commits into
kaitai-io:master
Choose a base branch
from
armijnhemel:minifs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b042896
add specification for TP-Link's minifs
armijnhemel 7abeeaf
minifs: rename to tplink_minifs
armijnhemel ffcc003
tplink_minifs: fix order of keys per style guide
generalmimon 926a5f9
tplink_minifs: simplify computation of lzma_meta offsets
armijnhemel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| meta: | ||
| id: tplink_minifs | ||
| title: TP-Link MINIFS | ||
| license: CC0-1.0 | ||
| endian: be | ||
| encoding: ASCII | ||
| doc: | | ||
| MINIFS is a file system found in certain TP-Link firmware files, such as | ||
| RE450(V4)_210531.zip, for TP-Link's own TPOS RTOS. | ||
|
|
||
| It consists of a header, followed by a list of file names, followed by | ||
| meta information for each file, meta information about the LZMA compressed | ||
| blobs including length, offset and uncompressed length, and then a number | ||
| of LZMA compressed blobs. | ||
|
|
||
| The LZMA blobs can contain the concatenated contents of multiple files. | ||
| The meta information of a file contains an offset to the directory name, | ||
| a file name, the LZMA blob (numbering starts at 0), the offset of the file | ||
| in the uncompressed data and the size of the uncompressed file. | ||
| seq: | ||
| - id: header | ||
| size: 32 | ||
| type: header | ||
| - id: filenames | ||
| size: header.len_filenames | ||
| type: filenames | ||
| - id: inodes | ||
| type: 'inode(_index != 0 ? inodes[_index - 1].cur_max_lzma_blob : 0)' | ||
| repeat: expr | ||
| repeat-expr: header.num_files | ||
| - id: lzma_metas | ||
| type: 'lzma_meta(_index != 0 ? lzma_metas[_index - 1].cur_max_lzma_blob_len : 0)' | ||
| repeat: expr | ||
| repeat-expr: inodes.last.cur_max_lzma_blob + 1 | ||
| doc: Count starts at 0, so there is one more blob than the highest blob number | ||
| - id: lzma_blobs_area | ||
| size: lzma_metas.last.cur_max_lzma_blob_len | ||
| type: dummy | ||
| instances: | ||
| lzma_blobs: | ||
| io: _root.lzma_blobs_area._io | ||
| type: lzma_blob(_index) | ||
| repeat: expr | ||
| repeat-expr: _root.inodes.last.cur_max_lzma_blob + 1 | ||
| types: | ||
| dummy: {} | ||
| lzma_blob: | ||
| params: | ||
| - id: index | ||
| type: u4 | ||
| instances: | ||
| data: | ||
| pos: _root.lzma_metas[index].ofs_blob | ||
| size: _root.lzma_metas[index].len_blob | ||
| header: | ||
| seq: | ||
| - id: magic | ||
| contents: "MINIFS\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" | ||
| - id: unknown_1 | ||
| type: u4 | ||
| - id: num_files | ||
| type: u4 | ||
| - id: unknown_2 | ||
| type: u4 | ||
| - id: len_filenames | ||
| type: u4 | ||
| filenames: | ||
| seq: | ||
| - id: filename | ||
| type: strz | ||
| repeat: eos | ||
| inode: | ||
| params: | ||
| - id: prev_max_lzma_blob | ||
| type: u4 | ||
| seq: | ||
| - id: ofs_directory | ||
| type: u4 | ||
| - id: ofs_name | ||
| type: u4 | ||
| - id: lzma_blob | ||
| type: u4 | ||
| - id: ofs_file | ||
| type: u4 | ||
| - id: size | ||
| type: u4 | ||
| instances: | ||
| cur_max_lzma_blob: | ||
| value: 'lzma_blob > prev_max_lzma_blob ? lzma_blob : prev_max_lzma_blob' | ||
| filename: | ||
| io: _root.filenames._io | ||
| pos: ofs_name | ||
| type: strz | ||
| directory_name: | ||
| io: _root.filenames._io | ||
| pos: ofs_directory | ||
| type: strz | ||
| lzma_meta: | ||
| params: | ||
| - id: prev_max_lzma_blob_len | ||
| type: u4 | ||
| seq: | ||
| - id: ofs_blob | ||
| type: u4 | ||
| valid: prev_max_lzma_blob_len | ||
| - id: len_blob | ||
| type: u4 | ||
| - id: len_blob_uncompressed | ||
| type: u4 | ||
| instances: | ||
| cur_max_lzma_blob_len: | ||
| value: 'ofs_blob + len_blob > prev_max_lzma_blob_len ? ofs_blob + len_blob : prev_max_lzma_blob_len' | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.