Skip to content

Commit

Permalink
Add -l flag when using lz4 compression
Browse files Browse the repository at this point in the history
This isn't documented, but it's needed since the kernel lz4 support is
based on the original streaming format and not the newer default. Use
-l to force the legacy codec.

Fixup lsinitcpio to support the older format, and, add a warning when
the newer format is detected. Who knows when this will be "resolved" ...

Upstream discussion: https://code.google.com/p/lz4/issues/detail?id=102
  • Loading branch information
falconindy committed Dec 22, 2013
1 parent a22a830 commit 2ce3a41
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lsinitcpio
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,17 @@ detect_filetype() {
return
fi

if [[ $(hexdump -n 4 -e '"%x"' "$1") == '184d2204' ]]; then
echo 'lz4'
return
fi
case $(hexdump -n 4 -e '"%x"' "$1") in
184d2204)
error 'Newer lz4 stream format detected! This may not boot!'
echo 'lz4'
return
;;
184c2102)
echo 'lz4 -l'
return
;;
esac

if [[ $(hexdump -n 3 -e '"%c"' "$1") == 'BZh' ]]; then
echo 'bzip2'
Expand Down
3 changes: 3 additions & 0 deletions mkinitcpio
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ build_image() {
xz)
COMPRESSION_OPTIONS+=' --check=crc32'
;;
lz4)
COMPRESSION_OPTIONS+=' -l'
;;
esac

cpio_opts=('-0' '-o' '-H' 'newc')
Expand Down

0 comments on commit 2ce3a41

Please sign in to comment.