Giter Site home page Giter Site logo

img2sdat's People

Contributors

peter23 avatar superr avatar xpirt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

img2sdat's Issues

Please update the img2sdat for Android 10 & Android 11

I've tried to debug the flash errors & I've noticed that

img2sdat/common.py

is not making a compatible transfer.list for Android 10 & Android 11 devices. I always get some errors when I try to remove those lines...

erasing 93285 blocks
package_extract_file from system_ext.transfer.list to memory took 00s.BLKDISCARD ioctl failed: Invalid argument
failed to execute command [erase 8,88590,97792,98833,130561,131594,163328,164385,185006]
new data receiver is still available after executing all commands.
script aborted: E2001: Failed to flash system_ext_a partition.
E2001: Failed to flash system_ext_a partition.error: 2001
Updater process ended with ERROR: 1
I:Install took 0 second(s).
Error installing zip file '/sdcard/crDroidAndroid-11.0-20210614-mojito-v7.6.zip'

When I try to remove that line, I get another set of following errors:

writing 512 blocks of new data
writing 512 blocks of new data
writing 512 blocks of new data
writing 512 blocks of new data
writing 512 blocks of new data
writing 1 blocks of new data
writing 512 blocks of new data
writing 457 blocks of new data
lseek64 failed: Invalid argument
Failed to write 23442 bytes.
missing 1871872 bytes of new data
failed to execute command [new 4,188006,188462,188513,188514]
script aborted: E2001: Failed to flash system_ext_a partition.
E2001: Failed to flash system_ext_a partition.error: 2001
cause: 103
Updater process ended with ERROR: 1
I:Install took 7 second(s).
Error installing zip file '/sdcard/crDroidAndroid-11.0-20210611-mojito-v7.6.zip'

lseek64() couldn't able to parse the transfer.list

No python 3.x support

The other issue (#9) has been closed, so I open a new one to report other errors caused by the differences between python 2 and 3.

[grbadmin@granitgeo test]$ python3 sdat2img/img2sdat.py system.sdat ua 4
img2sdat binary - version: 1.5

Total of 215040 4096-byte output blocks in 4921 input chunks.
Finding transfers...
Generating digraph...
Finding vertex sequence...
Reversing backward edges...
0/0 dependencies (0.00%) were violated; 0 source blocks stashed.
Improving vertex order...
Traceback (most recent call last):
File "sdat2img/img2sdat.py", line 89, in 
main(sys.argv)
File "sdat2img/img2sdat.py", line 83, in main
b.Compute(outdir)
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 342, in Compute
self.AssertSequenceGood()
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 814, in AssertSequenceGood
touched = array.array("B", "\0" * self.tgt.total_blocks)
TypeError: cannot use a str to initialize an array with typecode 'B'
[grbadmin@granitgeo test]$

The error above can be easily eliminated by changing blockimgdiff.py line 814 from
touched = array.array("B", "\0" * self.tgt.total_blocks)
to
touched = array.array("B", b"\0" * self.tgt.total_blocks)

But then another error happens, while creating the new dat file:

...
2097152 2097152 (100.00%) new __NONZERO-249 127489-128000
2097152 2097152 (100.00%) new __NONZERO-346 177153-177664
2097152 2097152 (100.00%) new __NONZERO-299 153089-153600
2097152 2097152 (100.00%) new __NONZERO-391 200193-200704
Traceback (most recent call last):
File "sdat2img/img2sdat.py", line 89, in 
main(sys.argv)
File "sdat2img/img2sdat.py", line 83, in main
b.Compute(outdir)
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 345, in Compute
self.WriteTransfers(prefix)
File "/home/grbadmin/test/sdat2img/blockimgdiff.py", line 417, in WriteTransfers
src_str.insert(1, unstashed_src_ranges.to_string_raw())
File "/home/grbadmin/test/sdat2img/rangelib.py", line 139, in to_string_raw
assert self.data
AssertionError
[grbadmin@granitgeo test]$

Too many arguments in bif.Compute() call

Error:

img2sdat system.new.dat2 111
Total of 215040 4096-byte output blocks in 428 input chunks.
Traceback (most recent call last):
  File "/usr/share/img2sdat/img2sdat.py", line 33, in <module>
    main(sysimg, outdir)
  File "/usr/share/img2sdat/img2sdat.py", line 13, in main
    bif.Compute('system', outdir)
TypeError: Compute() takes exactly 2 arguments (3 given)

Fix is to change:

bif.Compute('system', outdir)

to:

bif.Compute(outdir)

Magic Error

While converting 5.1 image it gives ValueError: Magic should be 0xED26FF3A but is 0x00000000

Problem with common

Ubuntu 16.04 LTS, all software installed.
alex_mercer@MacBookPro:~/UNPACK/AKITCHEN$
./img2sdat.py system_sparse.img
Traceback (most recent call last):
File "./img2sdat.py", line 10, in <module>
import common, blockimgdiff, sparse_img
ImportError: No module named common
alex_mercer@MacBookPro:~/UNPACK/AKITCHEN$

about the input img file

there are two kinds of img file , for raw image file and sparse image file。
what kind of image file is the input file?

common.py / python 2 & 3

  File "/home/grbadmin/test/sdat_utils/common.py", line 112
    print "running: ", " ".join(args)
                    ^
SyntaxError: invalid syntax

Please help. What to do (running on python 3.4.5)?

Output name is always system

A small mistake with the img2sdat
It works only on the image which is named "system", and doesn't work on vendor, product, etc...
I had to rename them to system, apply the script, get the dat files, then rename them again to their original names, which is a painfully slower task...
Can you update the script so that it works for any file name?
Also you might consider updating other scripts that have the same code.

img2sdat not support conversion vendor.new.dat

The tool does not support conversion to vendor.new.dat, if I run the command:

python img2dat.py vendor.img folderoutput 4

I always create system.new.dat, system.transfer.list and system.patch.dat, can you fix this problem kindly?

Magic value error?

./img2sdat.py system.img
img2sdat binary - version: 1.6

        1. Android Lollipop 5.0
        2. Android Lollipop 5.1
        3. Android Marshmallow 6.0
        4. Android Nougat 7.0/7.1/8.0

Choose system version: 4
Traceback (most recent call last):
File "./img2sdat.py", line 89, in
main(sys.argv)
File "./img2sdat.py", line 79, in main
image = sparse_img.SparseImage(INPUT_IMAGE, tempfile.mkstemp()[1], '0')
File "/home/123/Desktop/unpack/pack/sparse_img.py", line 52, in init
raise ValueError("Magic should be 0xED26FF3A but is 0x%08X" % (magic,))
ValueError: Magic should be 0xED26FF3A but is 0x00000000

But this system.img is not corrupted(can be mounted) and it was generated by sdat2img.py which is your work. It was just extracted from lineage-14.1's system.new.dat and has nothing special things like encryption or something.
Why this 'magic value' thing happens?

any file name + fix args

    if len(sys.argv) < 3:
        outdir = os.path.realpath(os.path.dirname(sys.argv[1])) + os.sep + os.path.basename(sys.argv[1]).split('.')[0]
        #outdir = './system'
    else:
        # outdir = sys.argv[2] + '/system'
        outdir = sys.argv[2] + os.sep + os.path.basename(sys.argv[1]).split('.')[0]
        if not os.path.exists(sys.argv[2]):
            os.makedirs(sys.argv[2])

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.