123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- diff -urdN kmod-27.orig/Makefile.am kmod-27/Makefile.am
- --- kmod-27.orig/Makefile.am 2020-02-19 00:20:13.000000000 +0100
- +++ kmod-27/Makefile.am 2020-09-17 19:36:55.000000000 +0200
- @@ -19,7 +19,7 @@
- -include $(top_builddir)/config.h \
- -I$(top_srcdir) \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- - ${zlib_CFLAGS}
- + ${lzlib_CFLAGS} ${zlib_CFLAGS}
-
- AM_CFLAGS = $(OUR_CFLAGS)
- AM_LDFLAGS = $(OUR_LDFLAGS)
- @@ -33,6 +33,8 @@
- -e 's,@includedir\@,$(includedir),g' \
- -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
- -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
- + -e 's,@lzlib_CFLAGS\@,${lzlib_CFLAGS},g' \
- + -e 's,@lzlib_LIBS\@,${lzlib_LIBS},g' \
- -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
- -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
- -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
- @@ -90,7 +92,7 @@
- ${top_srcdir}/libkmod/libkmod.sym
- libkmod_libkmod_la_LIBADD = \
- shared/libshared.la \
- - ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
- + ${liblzma_LIBS} ${lzlib_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
-
- noinst_LTLIBRARIES += libkmod/libkmod-internal.la
- libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
- diff -urdN kmod-27.orig/Makefile.in kmod-27/Makefile.in
- --- kmod-27.orig/Makefile.in 2020-02-19 00:43:03.000000000 +0100
- +++ kmod-27/Makefile.in 2020-09-17 19:36:55.000000000 +0200
- @@ -904,6 +904,8 @@
- liblzma_LIBS = @liblzma_LIBS@
- localedir = @localedir@
- localstatedir = @localstatedir@
- +lzlib_CFLAGS = @lzlib_CFLAGS@
- +lzlib_LIBS = @lzlib_LIBS@
- mandir = @mandir@
- mkdir_p = @mkdir_p@
- oldincludedir = @oldincludedir@
- @@ -974,7 +976,7 @@
- -include $(top_builddir)/config.h \
- -I$(top_srcdir) \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- - ${zlib_CFLAGS}
- + ${lzlib_CFLAGS} ${zlib_CFLAGS}
-
- AM_CFLAGS = $(OUR_CFLAGS)
- AM_LDFLAGS = $(OUR_LDFLAGS)
- @@ -987,6 +989,8 @@
- -e 's,@includedir\@,$(includedir),g' \
- -e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
- -e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
- + -e 's,@lzlib_CFLAGS\@,${lzlib_CFLAGS},g' \
- + -e 's,@lzlib_LIBS\@,${lzlib_LIBS},g' \
- -e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
- -e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
- -e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
- @@ -1037,7 +1041,7 @@
-
- libkmod_libkmod_la_LIBADD = \
- shared/libshared.la \
- - ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
- + ${liblzma_LIBS} ${lzlib_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
-
- libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
- libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
- diff -urdN kmod-27.orig/README kmod-27/README
- --- kmod-27.orig/README 2019-01-04 19:04:40.000000000 +0100
- +++ kmod-27/README 2020-09-17 19:03:14.000000000 +0200
- @@ -52,6 +52,7 @@
-
- Optional dependencies:
- - ZLIB library
- + - LZLIB library
- - LZMA library
-
- Typical configuration:
- diff -urdN kmod-27.orig/config.h.in kmod-27/config.h.in
- --- kmod-27.orig/config.h.in 2020-02-19 00:43:13.000000000 +0100
- +++ kmod-27/config.h.in 2020-09-17 19:03:14.000000000 +0200
- @@ -15,6 +15,9 @@
- /* Enable Xz for modules. */
- #undef ENABLE_XZ
-
- +/* Enable lzlib for modules. */
- +#undef ENABLE_LZLIB
- +
- /* Enable zlib for modules. */
- #undef ENABLE_ZLIB
-
- diff -urdN kmod-27.orig/configure kmod-27/configure
- --- kmod-27.orig/configure 2020-02-19 00:43:04.000000000 +0100
- +++ kmod-27/configure 2020-09-17 19:36:55.000000000 +0200
- @@ -673,6 +673,8 @@
- libcrypto_CFLAGS
- zlib_LIBS
- zlib_CFLAGS
- +lzlib_LIBS
- +lzlib_CFLAGS
- liblzma_LIBS
- liblzma_CFLAGS
- rootlibdir
- @@ -814,6 +816,7 @@
- enable_libtool_lock
- with_rootlibdir
- with_xz
- +with_lzlib
- with_zlib
- with_openssl
- with_bashcompletiondir
- @@ -841,6 +844,8 @@
- PKG_CONFIG_LIBDIR
- liblzma_CFLAGS
- liblzma_LIBS
- +lzlib_CFLAGS
- +lzlib_LIBS
- zlib_CFLAGS
- zlib_LIBS
- libcrypto_CFLAGS
- @@ -1507,6 +1512,7 @@
- compiler's sysroot if not specified).
- --with-rootlibdir=DIR rootfs directory to install shared libraries
- --with-xz handle Xz-compressed modules [default=disabled]
- + --with-lzlib handle lzipped modules [default=disabled]
- --with-zlib handle gzipped modules [default=disabled]
- --with-openssl handle PKCS7 signatures [default=disabled]
- --with-bashcompletiondir=DIR
- @@ -1532,6 +1538,9 @@
- C compiler flags for liblzma, overriding pkg-config
- liblzma_LIBS
- linker flags for liblzma, overriding pkg-config
- + lzlib_CFLAGS
- + C compiler flags for lzlib, overriding pkg-config
- + lzlib_LIBS linker flags for lzlib, overriding pkg-config
- zlib_CFLAGS C compiler flags for zlib, overriding pkg-config
- zlib_LIBS linker flags for zlib, overriding pkg-config
- libcrypto_CFLAGS
- @@ -13511,6 +13520,142 @@
-
-
-
- +# Check whether --with-lzlib was given.
- +if test "${with_lzlib+set}" = set; then :
- + withval=$with_lzlib;
- +else
- + with_lzlib=no
- +fi
- +
- +if test "x$with_lzlib" != "xno"; then :
- +
- +
- +pkg_failed=no
- +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzlib" >&5
- +$as_echo_n "checking for lzlib... " >&6; }
- +
- +if test -n "$lzlib_CFLAGS"; then
- + pkg_cv_lzlib_CFLAGS="$lzlib_CFLAGS"
- + elif test -n "$PKG_CONFIG"; then
- + if test -n "$PKG_CONFIG" && \
- + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lzlib\""; } >&5
- + ($PKG_CONFIG --exists --print-errors "lzlib") 2>&5
- + ac_status=$?
- + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- + test $ac_status = 0; }; then
- + pkg_cv_lzlib_CFLAGS=`$PKG_CONFIG --cflags "lzlib" 2>/dev/null`
- + test "x$?" != "x0" && pkg_failed=yes
- +else
- + pkg_failed=yes
- +fi
- + else
- + pkg_failed=untried
- +fi
- +if test -n "$lzlib_LIBS"; then
- + pkg_cv_lzlib_LIBS="$lzlib_LIBS"
- + elif test -n "$PKG_CONFIG"; then
- + if test -n "$PKG_CONFIG" && \
- + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lzlib\""; } >&5
- + ($PKG_CONFIG --exists --print-errors "lzlib") 2>&5
- + ac_status=$?
- + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- + test $ac_status = 0; }; then
- + pkg_cv_lzlib_LIBS=`$PKG_CONFIG --libs "lzlib" 2>/dev/null`
- + test "x$?" != "x0" && pkg_failed=yes
- +else
- + pkg_failed=yes
- +fi
- + else
- + pkg_failed=untried
- +fi
- +
- +
- +
- +if test $pkg_failed = yes; then
- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
- +$as_echo "no" >&6; }
- +
- +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- + _pkg_short_errors_supported=yes
- +else
- + _pkg_short_errors_supported=no
- +fi
- + if test $_pkg_short_errors_supported = yes; then
- + lzlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lzlib" 2>&1`
- + else
- + lzlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lzlib" 2>&1`
- + fi
- + # Put the nasty error message in config.log where it belongs
- + echo "$lzlib_PKG_ERRORS" >&5
- +
- + as_fn_error $? "Package requirements (lzlib) were not met:
- +
- +$lzlib_PKG_ERRORS
- +
- +Consider adjusting the PKG_CONFIG_PATH environment variable if you
- +installed software in a non-standard prefix.
- +
- +Alternatively, you may set the environment variables lzlib_CFLAGS
- +and lzlib_LIBS to avoid the need to call pkg-config.
- +See the pkg-config man page for more details." "$LINENO" 5
- +elif test $pkg_failed = untried; then
- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
- +$as_echo "no" >&6; }
- + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
- +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
- +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
- +is in your PATH or set the PKG_CONFIG environment variable to the full
- +path to pkg-config.
- +
- +Alternatively, you may set the environment variables lzlib_CFLAGS
- +and lzlib_LIBS to avoid the need to call pkg-config.
- +See the pkg-config man page for more details.
- +
- +To get pkg-config, see <http://pkg-config.freedesktop.org/>.
- +See \`config.log' for more details" "$LINENO" 5; }
- +else
- + lzlib_CFLAGS=$pkg_cv_lzlib_CFLAGS
- + lzlib_LIBS=$pkg_cv_lzlib_LIBS
- + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
- +$as_echo "yes" >&6; }
- +
- +fi
- +
- +$as_echo "#define ENABLE_LZLIB 1" >>confdefs.h
- +
- +
- +else
- +
- + { $as_echo "$as_me:${as_lineno-$LINENO}: lzlib support not requested" >&5
- +$as_echo "$as_me: lzlib support not requested" >&6;}
- +
- +fi
- +
- +
- + case " $with_features " in #(
- + *" LZLIB "*) :
- + { { $as_echo "$as_me:${as_lineno-$LINENO}: : with_features already contains LZLIB"; } >&5
- + (: with_features already contains LZLIB) 2>&5
- + ac_status=$?
- + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- + test $ac_status = 0; } ;; #(
- + *) :
- +
- + if test "x$with_features" != "x"; then :
- + as_fn_append with_features " "
- +fi
- + if test "x$with_lzlib" = "xyes"; then :
- + as_fn_append with_features "+LZLIB"
- +else
- + as_fn_append with_features "-LZLIB"
- +fi
- +
- + ;;
- +esac
- +
- +
- +
- +
- # Check whether --with-zlib was given.
- if test "${with_zlib+set}" = set; then :
- withval=$with_zlib;
- @@ -17013,7 +17158,7 @@
- tools: ${enable_tools}
- python bindings: ${enable_python}
- logging: ${enable_logging}
- - compression: xz=${with_xz} zlib=${with_zlib}
- + compression: xz=${with_xz} lzlib=${with_lzlib} zlib=${with_zlib}
- debug: ${enable_debug}
- coverage: ${enable_coverage}
- doc: ${enable_gtk_doc}
- @@ -17042,7 +17187,7 @@
- tools: ${enable_tools}
- python bindings: ${enable_python}
- logging: ${enable_logging}
- - compression: xz=${with_xz} zlib=${with_zlib}
- + compression: xz=${with_xz} lzlib=${with_lzlib} zlib=${with_zlib}
- debug: ${enable_debug}
- coverage: ${enable_coverage}
- doc: ${enable_gtk_doc}
- diff -urdN kmod-27.orig/configure.ac kmod-27/configure.ac
- --- kmod-27.orig/configure.ac 2020-02-19 00:40:36.000000000 +0100
- +++ kmod-27/configure.ac 2020-09-17 19:03:14.000000000 +0200
- @@ -94,6 +94,17 @@
- ])
- CC_FEATURE_APPEND([with_features], [with_xz], [XZ])
-
- +AC_ARG_WITH([lzlib],
- + AS_HELP_STRING([--with-lzlib], [handle lzipped modules @<:@default=disabled@:>@]),
- + [], [with_lzlib=no])
- +AS_IF([test "x$with_lzlib" != "xno"], [
- + PKG_CHECK_MODULES([lzlib], [lzlib])
- + AC_DEFINE([ENABLE_LZLIB], [1], [Enable lzlib for modules.])
- +], [
- + AC_MSG_NOTICE([lzlib support not requested])
- +])
- +CC_FEATURE_APPEND([with_features], [with_lzlib], [LZLIB])
- +
- AC_ARG_WITH([zlib],
- AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
- [], [with_zlib=no])
- @@ -307,7 +318,7 @@
- tools: ${enable_tools}
- python bindings: ${enable_python}
- logging: ${enable_logging}
- - compression: xz=${with_xz} zlib=${with_zlib}
- + compression: xz=${with_xz} lzlib=${with_lzlib} zlib=${with_zlib}
- debug: ${enable_debug}
- coverage: ${enable_coverage}
- doc: ${enable_gtk_doc}
- diff -urdN kmod-27.orig/libkmod/docs/Makefile.in kmod-27/libkmod/docs/Makefile.in
- --- kmod-27.orig/libkmod/docs/Makefile.in 2020-02-19 00:43:03.000000000 +0100
- +++ kmod-27/libkmod/docs/Makefile.in 2020-09-17 19:03:14.000000000 +0200
- @@ -247,6 +247,8 @@
- liblzma_LIBS = @liblzma_LIBS@
- localedir = @localedir@
- localstatedir = @localstatedir@
- +lzlib_CFLAGS = @lzlib_CFLAGS@
- +lzlib_LIBS = @lzlib_LIBS@
- mandir = @mandir@
- mkdir_p = @mkdir_p@
- oldincludedir = @oldincludedir@
- diff -urdN kmod-27.orig/libkmod/libkmod-file.c kmod-27/libkmod/libkmod-file.c
- --- kmod-27.orig/libkmod/libkmod-file.c 2017-12-07 23:05:47.000000000 +0100
- +++ kmod-27/libkmod/libkmod-file.c 2020-09-17 19:03:14.000000000 +0200
- @@ -34,6 +34,9 @@
- #endif
-
- #include <shared/util.h>
- +#ifdef ENABLE_LZLIB
- +#include <lzlib.h>
- +#endif
-
- #include "libkmod.h"
- #include "libkmod-internal.h"
- @@ -48,6 +51,9 @@
- #ifdef ENABLE_XZ
- bool xz_used;
- #endif
- +#ifdef ENABLE_LZLIB
- + bool lz_used;
- +#endif
- #ifdef ENABLE_ZLIB
- gzFile gzf;
- #endif
- @@ -169,6 +175,88 @@
- static const char magic_xz[] = {0xfd, '7', 'z', 'X', 'Z', 0};
- #endif
-
- +#ifdef ENABLE_LZLIB
- +#ifndef min
- + #define min(x,y) ((x) <= (y) ? (x) : (y))
- +#endif
- +
- +static int load_lzlib(struct kmod_file *file)
- +{
- + uint8_t in_buf[16384];
- + int err = 0;
- + off_t did = 0, total = 0;
- + _cleanup_free_ unsigned char *p = NULL;
- +
- + struct LZ_Decoder *lzd = LZ_decompress_open();
- + if (!lzd || LZ_decompress_errno( lzd ) != LZ_ok)
- + { LZ_decompress_close(lzd); return -ENOMEM; }
- +
- + for (;;) {
- + int rd;
- + const int size = min(LZ_decompress_write_size(lzd),
- + (int)sizeof in_buf);
- +
- + if (did == total) {
- + const int realloc_step = 4 * 1024 * 1024;
- + void *tmp = realloc(p, total + realloc_step);
- + if (tmp == NULL) {
- + err = -ENOMEM;
- + goto error;
- + }
- + total += realloc_step;
- + p = tmp;
- + }
- +
- + if (size > 0) {
- + rd = read(file->fd, in_buf, size);
- + if (rd < 0) {
- + err = -errno;
- + goto error;
- + }
- + if (rd == 0)
- + LZ_decompress_finish(lzd);
- + else if (LZ_decompress_write(lzd, in_buf, rd) != rd) {
- + err = -EINVAL;
- + goto error;
- + }
- + }
- + rd = LZ_decompress_read(lzd, p + did, total - did);
- + if (rd < 0) {
- + const char *lz_errmsg =
- + LZ_strerror(LZ_decompress_errno(lzd));
- +
- + ERR(file->ctx, "lzip: %s\n", lz_errmsg);
- + err = -EINVAL;
- + goto error;
- + }
- + did += rd;
- + if (LZ_decompress_finished(lzd) == 1)
- + break;
- + }
- +
- + if (LZ_decompress_close(lzd) < 0)
- + return -EINVAL;
- + file->lz_used = true;
- + file->memory = p;
- + file->size = did;
- + p = NULL;
- + return 0;
- +
- +error:
- + LZ_decompress_close(lzd);
- + return err;
- +}
- +
- +static void unload_lzlib(struct kmod_file *file)
- +{
- + if (!file->lz_used)
- + return;
- + free(file->memory);
- +}
- +
- +static const char magic_lzlib[] = { 0x4C, 0x5A, 0x49, 0x50 }; /* "LZIP" */
- +#endif
- +
- #ifdef ENABLE_ZLIB
- #define READ_STEP (4 * 1024 * 1024)
- static int load_zlib(struct kmod_file *file)
- @@ -241,6 +329,9 @@
- #ifdef ENABLE_XZ
- {sizeof(magic_xz), magic_xz, {load_xz, unload_xz}},
- #endif
- +#ifdef ENABLE_LZLIB
- + {sizeof(magic_lzlib), magic_lzlib, {load_lzlib, unload_lzlib}},
- +#endif
- #ifdef ENABLE_ZLIB
- {sizeof(magic_zlib), magic_zlib, {load_zlib, unload_zlib}},
- #endif
- diff -urdN kmod-27.orig/libkmod/libkmod.pc.in kmod-27/libkmod/libkmod.pc.in
- --- kmod-27.orig/libkmod/libkmod.pc.in 2013-04-24 22:02:37.000000000 +0200
- +++ kmod-27/libkmod/libkmod.pc.in 2020-09-17 19:03:14.000000000 +0200
- @@ -7,5 +7,5 @@
- Description: Library to deal with kernel modules
- Version: @VERSION@
- Libs: -L${libdir} -lkmod
- -Libs.private: @liblzma_LIBS@ @zlib_LIBS@
- +Libs.private: @liblzma_LIBS@ @lzlib_LIBS@ @zlib_LIBS@
- Cflags: -I${includedir}
- diff -urdN kmod-27.orig/man/Makefile.in kmod-27/man/Makefile.in
- --- kmod-27.orig/man/Makefile.in 2020-02-19 00:43:03.000000000 +0100
- +++ kmod-27/man/Makefile.in 2020-09-17 19:03:14.000000000 +0200
- @@ -277,6 +277,8 @@
- liblzma_LIBS = @liblzma_LIBS@
- localedir = @localedir@
- localstatedir = @localstatedir@
- +lzlib_CFLAGS = @lzlib_CFLAGS@
- +lzlib_LIBS = @lzlib_LIBS@
- mandir = @mandir@
- mkdir_p = @mkdir_p@
- oldincludedir = @oldincludedir@
- diff -urdN kmod-27.orig/shared/util.c kmod-27/shared/util.c
- --- kmod-27.orig/shared/util.c 2018-01-31 18:10:59.000000000 +0100
- +++ kmod-27/shared/util.c 2020-09-17 19:03:14.000000000 +0200
- @@ -43,6 +43,9 @@
- #ifdef ENABLE_ZLIB
- {".ko.gz", sizeof(".ko.gz") - 1},
- #endif
- +#ifdef ENABLE_LZLIB
- + {".ko.lz", sizeof(".ko.lz") - 1},
- +#endif
- #ifdef ENABLE_XZ
- {".ko.xz", sizeof(".ko.xz") - 1},
- #endif
- diff -urdN kmod-27.orig/testsuite/test-util.c kmod-27/testsuite/test-util.c
- --- kmod-27.orig/testsuite/test-util.c 2017-12-07 23:05:47.000000000 +0100
- +++ kmod-27/testsuite/test-util.c 2020-09-17 19:03:14.000000000 +0200
- @@ -154,6 +154,9 @@
- #ifdef ENABLE_ZLIB
- { "/bla.ko.gz", true },
- #endif
- +#ifdef ENABLE_LZLIB
- + { "/bla.ko.lz", true },
- +#endif
- #ifdef ENABLE_XZ
- { "/bla.ko.xz", true },
- #endif
|