Skip to content

repack.py Decoding error. #26

@ArgentumLupin

Description

@ArgentumLupin

I'm working with a gen 1 model and followed the README.md file to fix what storytel should have done themself.
it worked great until I tried to repack the boot.img.
When I run the python3 tools/repack.py --boot_img tmp/boot.img --out_img tmp/boot-gen1-patched.img --mods_dir mods/gen1/
I get this error on windows

Unpacking C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tmp\boot.img
Traceback (most recent call last):
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\unpack.py", line 27, in unpack
    info = unpack_android_bootimg(boot_img, out_dir)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\utils\android.py", line 11, in unpack_android_bootimg
    return unpack_bootimg(str(boot_img), str(output_dir)).__dict__
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\mkbootimg\unpack_bootimg.py", line 481, in unpack_bootimg
    boot_magic = unpack('8s', image_file.read(8))[0].decode()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\repack.py", line 82, in <module>
    main()
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\repack.py", line 73, in main
    repack(
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\repack.py", line 44, in repack
    unpack(boot_img, work_dir)
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\unpack.py", line 30, in unpack
    info = unpack_rockchip_krnl_bootimg(boot_img, out_dir)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\utils\rockchip.py", line 20, in unpack_rockchip_krnl_bootimg
    check_krnl_initrd_img(boot_img)
  File "C:\Users\USER\Documents\__git\StoryTell reader\StorytelReaderMods\tools\utils\rockchip.py", line 12, in check_krnl_initrd_img
    magic = unpack('4s', f.read(4))[0].decode()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

and when I do it on Linux I get the program freezing at writing the bytes until I press enter, then it prints a new line with the next byte until it says it's done at byte 0x0000ffe0 but when I actually checked the boot-gen1-patched.img it was empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions