- src/kernel/lz4.c + include/lz4.h: standalone LZ4 block decompressor
(~80 lines, no external dependencies)
- src/drivers/initrd.c: auto-detect LZ4B magic at boot, decompress
into heap buffer, then parse the contained USTAR tar as before
- tools/mkinitrd.c: built-in LZ4 block compressor (greedy hash-table),
builds tar in memory then wraps in LZ4B envelope
(magic + orig_size + comp_size + compressed data)
Format: LZ4B header (12 bytes) + raw LZ4 block. Falls back to
uncompressed tar if compression fails.
Results on current initrd (12 files including doom.elf):
TAR: 562 KB -> LZ4B: 326 KB (58% ratio)
Backward compatible: kernel still accepts plain USTAR tar
(no LZ4B magic = parse directly).