Skip to content
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

Files with more than 11 partitions/sections #11

Closed
armijnhemel opened this issue Apr 27, 2023 · 9 comments
Closed

Files with more than 11 partitions/sections #11

armijnhemel opened this issue Apr 27, 2023 · 9 comments

Comments

@armijnhemel
Copy link

There are firmware files where there are more than 11 partitions/sections. For example I am currently looking at IPC_528B174MP.1388_22100601.Reolink-Duo-WiFi.GC4653.4MP.WIFI1021.REOLINK.pak which has 13 partitions.

To find out how many partitions are needed you need to divide the offset found in the entry for the first section by (64 + 76)

@armijnhemel
Copy link
Author

Also see: kaitai-io/kaitai_struct_formats#667

@hn
Copy link
Owner

hn commented Apr 27, 2023

Nice, I didn't know Kaitai Struct yet.

I pushed c5f043b to at least make the number of sections/partitions a bit more configurable. I need to find some time to implement it cleanly.

And I think one has to subtract 12 before dividing by 64 + 76 (doesn't change anything for ints).

@armijnhemel
Copy link
Author

Nice, I didn't know Kaitai Struct yet.

I pushed c5f043b to at least make the number of sections/partitions a bit more configurable. I need to find some time to implement it cleanly.

And I think one has to subtract 12 before dividing by 64 + 76 (doesn't change anything for ints).

Ah yes, you are absolutely correct, the 12 bytes for the header should be subtracted.

@hn
Copy link
Owner

hn commented Apr 27, 2023

Off-topic: zennio-firmware and vallox-ventillation might be candidates for the Kaitai db ... in any case they are more or less based on the same perl-mishmash as the Reolink-unpacker :)

@AT0myks
Copy link

AT0myks commented May 1, 2023

To find out how many partitions are needed you need to divide the offset found in the entry for the first section by (64 + 76)

This is true for all firmwares except the ones for the RLN36, their only device with 64-bit hardware as far as I know. They have 4 extra NULL bytes between the end of the last MTD and the start of the first section's content. They also happen to have different header and section sizes. You can get more details here.

@hn
Copy link
Owner

hn commented May 2, 2023

Closing this because pakler is more advanced and there is no point in putting more work into this tool.

@hn hn closed this as completed May 2, 2023
@armijnhemel
Copy link
Author

To find out how many partitions are needed you need to divide the offset found in the entry for the first section by (64 + 76)

This is true for all firmwares except the ones for the RLN36, their only device with 64-bit hardware as far as I know. They have 4 extra NULL bytes between the end of the last MTD and the start of the first section's content. They also happen to have different header and section sizes. You can get more details here.

Excellent. I have adapted the kaitai struct specification so these files can also be parsed.

@AT0myks
Copy link

AT0myks commented May 5, 2023

@hn Thank you for adding a link to the archive and for your repo. It got me interested in digging into the firmwares to see what's inside. It's a great resource and I plan on using it in the future, maybe to make custom firmwares like others here have done.

@armijnhemel I see you're a former member of the gpl-violations.org core team, is this related to your interest in Reolink? Because it seems to me that they might not be complying with the GPL.

@armijnhemel
Copy link
Author

@armijnhemel I see you're a former member of the gpl-violations.org core team, is this related to your interest in Reolink? Because it seems to me that they might not be complying with the GPL.

No, I am creating a generic firmware unpacker and for that I wanted to support this particular firmware format. See https://github.com/armijnhemel/binaryanalysis-ng/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants