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

Introduce USB burning tool #20

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

m-kurbanov
Copy link

This tool supports burning devices using the ADNL and Optimus protocols.

list.append(x) returns None

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Unpack for int requires a buffer of 4 bytes

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
The function tplStat() is used to obtain the status of the completion of
the last TPL command (tplCommand()).

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Support for the byte type for the password, and the password length
check has been removed as the length of the password depends on the SoC.

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Save legacy format.

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
The functions readMedia() and writeMedia() are used for reading/writing
data from/to the disk. Before calling these functions, you need to send
a Bulk upload/download command.

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
This parameter is needed for the user to be able to define their own
functions for communication over the USB protocol.

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
@superna9999
Copy link
Owner

@m-kurbanov Hi sorry for the delay, the code looks real good and I don't have any comments so far, except about Documentation.
Could you write some documentation on the protocols (Optimus & ADNL), the Image format and how to use the burning tool ?

Comment on lines +184 to +207
if enc_chip1 == chipid:
encrypt_reg = self._platform.enc_reg1
elif enc_chip2 == chipid:
encrypt_reg = self._platform.enc_reg2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a match-case setup instead, would look cleaner

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A match-case is supported starting from version 3.10. We would prefer not to increase the minimum supported version of Python.

optimus.py Outdated
STAGE_MINOR_SPL = 8 # Secondary Program Loader
STAGE_MINOR_TPL = 16 # Tertiary Program Loader

def __init__(self, socid):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid confusion I'd probably rename the socid parameter to rawData or data or something similar, just like the local field _raw.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @fonix232. Done

optimus.py Outdated
Comment on lines 42 to 48
self.major = ord(socid[0])
self.minor = ord(socid[1])
self.stage_major = ord(socid[2])
self.stage_minor = ord(socid[3])
if len(socid) > 4:
self.need_password = bool(ord(socid[4]))
self.password_ok = bool(ord(socid[5]))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of directly assigning on creation, why not create getter properties for these values?

Something like this:

class SocId:

    @property
    def major(self):
        return ord(self._raw[0])

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @fonix232. Done

m-kurbanov and others added 4 commits April 16, 2024 15:37
This patch support for parsing the Amlogic image
format (aml_upgrade_package.img).

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
This module helps to flash a device using the Optimus protocol.

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
This module helps to flash a device using the ADNL protocol.

Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
This tool supports burning devices using the ADNL and Optimus protocols.

To use ADNL protocol no specific argument is required: if firmware
image contains item 'usb_flow', then ADNL protocol will be used.

Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com>
@m-kurbanov
Copy link
Author

@m-kurbanov Hi sorry for the delay, the code looks real good and I don't have any comments so far, except about Documentation. Could you write some documentation on the protocols (Optimus & ADNL), the Image format and how to use the burning tool ?

Done

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

Successfully merging this pull request may close these issues.

None yet

3 participants