Skip to content

legacy file format support #169

Open

Description

@armijnhemel

Currently python-lz4 does not seem to support the legacy file format:

https://github.com/lz4/lz4/blob/master/doc/lz4_Frame_format.md#legacy-frame

This particular format, while discouraged by the LZ4 authors, is actually still in use, for example in the Linux kernel:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/decompress_unlz4.c

Activity

  1. jonathanunderwood commented on Mar 31, 2019

    @jonathanunderwood
    Member

    I don't have the time or interest for adding support for a disused legacy format I am afraid. Further, I don't really understand the use case - I don't see why you'd want to use Python to compress/decompress data and pass it to/from the kernel. I might be more interested if you could articulate the use case.

    I'd accept patches as long as they were well documented and included tests.

  2. armijnhemel commented on Mar 31, 2019

    @armijnhemel
    Author

    I would not need it for passing information to the Linux kernel, but I want to use it for automated firmware analysis, where I process binaries to see what is inside and process them according to what I find.

    It appears that the legacy file format is not standard in the LZ4 library (I thought it was), but it is supported in the standard lz4 utilities instead, so I will use those instead.

  3. sebastien-riou commented on May 30, 2019

    @sebastien-riou

    the "legacy" format is the one with the simplest decoder and provide very good compression level. It is therefore ideal for embedded firmware compression. In this use case the decompressor is embedded in the firmware, so simplicity is paramount. It would be nice to have it in Python to prepare the firmware image.

  4. jonathanunderwood commented on May 30, 2019

    @jonathanunderwood
    Member

    Ok. I'll reopen this, and look at it at some point, unless someone beats me to it :)

  5. lukeman commented on Apr 4, 2022

    @lukeman

    FWIW I recently needed to process some files that are produced in the legacy frame format and after much confusion found that a PR over this project provides a very clear way to detect the legacy frame and to decompress them: marin-m/vmlinux-to-elf@6225011

  6. jonathanunderwood commented on Apr 4, 2022

    @jonathanunderwood
    Member

    OK - that looks simple enough. I'll re-open this - if anyone wants to submit a patch with tests, I'll happily look at merging it.

  7. bol-van commented on Jan 19, 2023

    @bol-van

    I also vote to add legacy format support. I need it to decompress lz4 compressed vmlinuz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions