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

Implement sparse image support #30

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

obbardc
Copy link

@obbardc obbardc commented Jun 29, 2022

Based on original work from #5

Signed-off-by: Christopher Obbard [email protected]

Based on original work from linux-msm#5

Signed-off-by: Christopher Obbard <[email protected]>
@obbardc
Copy link
Author

obbardc commented Jun 29, 2022

n = read(fd, buf, chunk_size * program->sector_size);
if (n < 0)
err(1, "failed to read");
// TODO originally used sparse_stream_callback
Copy link
Author

Choose a reason for hiding this comment

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

Currently it times out.

@ndechesne
Copy link
Contributor

thanks for sending this PR.. support for sparse support is very much needed.. I am wondering if using libsparse is really a great thing though. First the distribution of libsparse in distro is not always great (I don't think Archlinux has it), and hardcoding the lib path like you did is problematic. Also, I think it complicates the main loop when processing the file quite a bit.. how difficult (or wrong?) would it be to implement a small 'unsparse' algorithm directly in qdl? would that be a bad idea?

@jwinarske
Copy link

@ndechesne I agree. It would be better to not pull in library dependency, and implement the sparse algorithm directly.

@obbardc
Copy link
Author

obbardc commented Jun 29, 2022

Right, using the library is a bit of a pain. The other two open PRs vendor in libsparse. If that is acceptable, I can do that here too?

@obbardc obbardc changed the title Implement sparse image flashing using libsparse Implement sparse image flashing Jun 30, 2022
@obbardc obbardc changed the title Implement sparse image flashing Implement sparse image support Jun 30, 2022
CFLAGS := -O2 -Wall -g `pkg-config --cflags libxml-2.0`
LDFLAGS := `pkg-config --libs libxml-2.0 libudev`
CFLAGS := -O2 -Wall -g `pkg-config --cflags libxml-2.0` -I/usr/include/android
LDFLAGS := `pkg-config --libs libxml-2.0 libudev` -L/usr/lib/x86_64-linux-gnu/android -Wl,-rpath=/usr/lib/x86_64-linux-gnu/android -lsparse
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this part of a commonly available package in most distributions?
What can be done about the "x86_64"-part, I'm exclusively running qdl on my ARM64 laptop.

I was under the impression that the sparse format essentially is a form of run-length-encoding to avoid encoding the empty regions in the image. Would it be possible to implement this in qdl, instead of relying on a 3rd party library?

Copy link
Author

Choose a reason for hiding this comment

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

@andersson I don't have the bandwidth to make this modification right now.

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.

4 participants