Adaptation of BusyBox lzma decompressor for embedded, inflate directly from buffer to buffer.
Main goal is binary size.
- read and write directly into buffers, removed all file handling
- handle files without compressed size, using a end marker. Can now inflate lzma1 files made with lzma from xz-utils
- prefer stack variable for rc_t
- reuse buffer_end to handle truncated input
- Observed binary sizes with GCC 10:
- i686: 1.445 bytes
- x86_64: 1.545 bytes
- armv7-a thumb: 1.128 bytes
- armv7-a: 1.652 bytes
- aarch64: 1.756 bytes
- mips: 2.016 bytes
- mips16 1.456 bytes
mkdir obj
cd obj
make -f ../Makefile
- unlzma_tiny.c: uncompressor base on busybox/archival/libarchive/decompress_unlzma.c
- unlzma_tiny_config.h: wrapper for base functions
- unlzma.c: test program for debugging
This code was originally based on busybox commit 8f48fc0 without keeping history. A backup tag unlzma_tiny-2021.01 to previous history was kept.
Further changes are merged from a filtered branch obtained with this script:
#!/bin/sh
set -e
REF=1_29_0
export FILTER_BRANCH_SQUELCH_WARNING=1
git fetch busybox -t -f
git checkout $REF -b busybox-filtered
git filter-branch -f --subdirectory-filter archival/ --prune-empty -- --all
git filter-branch -f --prune-empty --index-filter "git ls-files | grep -v 'decompress_unlzma.c' | xargs git rm --cached --ignore-unmatch"
git filter-branch -f --prune-empty --tree-filter "git ls-files | xargs -I '{}' git mv '{}' ./"
git fetch busybox -t -f
- BusyBox (https://busybox.net) (2006 Aurelien Jacobs)
- LZMA SDK 4.22 (http://www.7-zip.org/) (1999-2005 Igor Pavlov)