summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2022-05-25 11:55:59 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-27 23:50:48 +0100
commit789769b9231747d665f9e648690e6146c9fa1624 (patch)
tree06f43a1b35416cd8304ffbef2d40d1f773e45cb3 /meta/recipes-devtools
parent608ef67baa8162cce6536df72af14d1b7b4844d4 (diff)
downloadpoky-789769b9231747d665f9e648690e6146c9fa1624.tar.gz
btrfs-tools: add a PACKAGECONFIG for lzo
LZO is a fairly obsolete compression format these days, so add an option to enable/disable LZO to btrfs-progs and disable it by default. (From OE-Core rev: 26ffb0300cfa365627299a7af2efcb230f5951f0) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.patch126
-rw-r--r--meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb4
2 files changed, 129 insertions, 1 deletions
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.patch b/meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.patch
new file mode 100644
index 0000000000..f4278a5c5d
--- /dev/null
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools/lzo-option.patch
@@ -0,0 +1,126 @@
1Upstream-Status: Backport [https://github.com/kdave/btrfs-progs/commit/73545c1fe6304f08ab306b76d2bcacaf22a5e99a]
2Signed-off-by: Ross Burton <ross.burton@arm.com>
3
4From 4f4eafe8ebcc86f84f6c85a5c5814c430d8f190c Mon Sep 17 00:00:00 2001
5From: Ross Burton <ross.burton@arm.com>
6Date: Tue, 24 May 2022 13:44:29 +0100
7Subject: [PATCH] btrfs-progs: add option to disable LZO support
8
9LZO as a compression format is pretty archaic these days, there are
10better algorithsm in all metrics for compression and decompression, and
11lzo hasn't had a new release since 2017.
12
13Add an option to disable LZO (defaulting to enabled), and respect it in
14cmds/restore.c.
15
16Signed-off-by: Ross Burton <ross.burton@arm.com>
17---
18 Makefile | 2 +-
19 Makefile.inc.in | 1 +
20 cmds/restore.c | 7 +++++++
21 configure.ac | 30 ++++++++++++++++++++----------
22 4 files changed, 29 insertions(+), 11 deletions(-)
23
24diff --git a/Makefile b/Makefile
25index af4908f9..0e8e05f3 100644
26--- a/Makefile
27+++ b/Makefile
28@@ -335,7 +335,7 @@ endif
29 btrfs_convert_cflags = -DBTRFSCONVERT_EXT2=$(BTRFSCONVERT_EXT2)
30 btrfs_convert_cflags += -DBTRFSCONVERT_REISERFS=$(BTRFSCONVERT_REISERFS)
31 btrfs_fragments_libs = -lgd -lpng -ljpeg -lfreetype
32-cmds_restore_cflags = -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD)
33+cmds_restore_cflags = -DBTRFSRESTORE_LZO=$(BTRFSRESTORE_LZO) -DBTRFSRESTORE_ZSTD=$(BTRFSRESTORE_ZSTD)
34
35 ifeq ($(CRYPTOPROVIDER_BUILTIN),1)
36 CRYPTO_OBJECTS = crypto/sha224-256.o crypto/blake2b-ref.o
37diff --git a/Makefile.inc.in b/Makefile.inc.in
38index c995aef9..385b7ae1 100644
39--- a/Makefile.inc.in
40+++ b/Makefile.inc.in
41@@ -16,6 +16,7 @@ BUILD_PROGRAMS = @BUILD_PROGRAMS@
42 BUILD_SHARED_LIBRARIES = @BUILD_SHARED_LIBRARIES@
43 BUILD_STATIC_LIBRARIES = @BUILD_STATIC_LIBRARIES@
44 BTRFSCONVERT_EXT2 = @BTRFSCONVERT_EXT2@
45+BTRFSRESTORE_LZO = @BTRFSRESTORE_LZO@
46 BTRFSCONVERT_REISERFS = @BTRFSCONVERT_REISERFS@
47 BTRFSRESTORE_ZSTD = @BTRFSRESTORE_ZSTD@
48 PYTHON_BINDINGS = @PYTHON_BINDINGS@
49diff --git a/cmds/restore.c b/cmds/restore.c
50index 5923d571..4dd79fce 100644
51--- a/cmds/restore.c
52+++ b/cmds/restore.c
53@@ -25,8 +25,10 @@
54 #include <fcntl.h>
55 #include <sys/stat.h>
56 #include <sys/types.h>
57+#if BTRFSRESTORE_LZO
58 #include <lzo/lzoconf.h>
59 #include <lzo/lzo1x.h>
60+#endif
61 #include <zlib.h>
62 #if BTRFSRESTORE_ZSTD
63 #include <zstd.h>
64@@ -98,6 +100,10 @@ static inline size_t read_compress_length(unsigned char *buf)
65 static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf,
66 char *outbuf, u64 compress_len, u64 *decompress_len)
67 {
68+#if !BTRFSRESTORE_LZO
69+ error("btrfs not compiled with lzo support");
70+ return -1;
71+#else
72 size_t new_len;
73 size_t in_len;
74 size_t out_len = 0;
75@@ -156,6 +162,7 @@ static int decompress_lzo(struct btrfs_root *root, unsigned char *inbuf,
76 *decompress_len = out_len;
77
78 return 0;
79+#endif
80 }
81
82 static int decompress_zstd(const char *inbuf, char *outbuf, u64 compress_len,
83diff --git a/configure.ac b/configure.ac
84index d907636b..c1ad2c22 100644
85--- a/configure.ac
86+++ b/configure.ac
87@@ -372,16 +372,26 @@ if ${PKG_CONFIG} udev --atleast-version 190; then
88 fi
89 AC_SUBST(UDEVDIR)
90
91-dnl lzo library does not provide pkg-config, let use classic way
92-AC_CHECK_LIB([lzo2], [lzo_version], [
93- LZO2_LIBS="-llzo2"
94- LZO2_CFLAGS=""
95- LZO2_LIBS_STATIC="-llzo2"],[
96- AC_MSG_ERROR([cannot find lzo2 library])
97-])
98-AC_SUBST([LZO2_LIBS])
99-AC_SUBST([LZO2_LIBS_STATIC])
100-AC_SUBST([LZO2_CFLAGS])
101+AC_ARG_ENABLE([lzo],
102+ AS_HELP_STRING([--disable-lzo], [build without lzo support]),
103+ [], [enable_lzo=yes]
104+)
105+
106+if test "x$enable_lzo" = xyes; then
107+ dnl lzo library does not provide pkg-config, let use classic way
108+ AC_CHECK_LIB([lzo2], [lzo_version], [
109+ LZO2_LIBS="-llzo2"
110+ LZO2_CFLAGS=""
111+ LZO2_LIBS_STATIC="-llzo2"],[
112+ AC_MSG_ERROR([cannot find lzo2 library])
113+ ])
114+ AC_SUBST([LZO2_LIBS])
115+ AC_SUBST([LZO2_LIBS_STATIC])
116+ AC_SUBST([LZO2_CFLAGS])
117+fi
118+
119+AS_IF([test "x$enable_lzo" = xyes], [BTRFSRESTORE_LZO=1], [BTRFSRESTORE_LZO=0])
120+AC_SUBST(BTRFSRESTORE_LZO)
121
122 dnl call PKG_INSTALLDIR from pkg.m4 to set pkgconfigdir
123 m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_MSG_ERROR([please install pkgconf])])
124--
1252.25.1
126
diff --git a/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb b/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb
index 4ab486c465..88b5c6259c 100644
--- a/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb
+++ b/meta/recipes-devtools/btrfs-tools/btrfs-tools_5.16.2.bb
@@ -13,10 +13,11 @@ LIC_FILES_CHKSUM = " \
13 file://libbtrfsutil/COPYING;md5=4fbd65380cdd255951079008b364516c \ 13 file://libbtrfsutil/COPYING;md5=4fbd65380cdd255951079008b364516c \
14" 14"
15SECTION = "base" 15SECTION = "base"
16DEPENDS = "lzo util-linux zlib" 16DEPENDS = "util-linux zlib"
17 17
18SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git;branch=master \ 18SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git;branch=master \
19 file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \ 19 file://0001-Add-a-possibility-to-specify-where-python-modules-ar.patch \
20 file://lzo-option.patch \
20 " 21 "
21SRCREV = "31458c9c81935abbed010221261897273a98d2c1" 22SRCREV = "31458c9c81935abbed010221261897273a98d2c1"
22S = "${WORKDIR}/git" 23S = "${WORKDIR}/git"
@@ -32,6 +33,7 @@ PACKAGECONFIG[programs] = "--enable-programs,--disable-programs"
32PACKAGECONFIG[convert] = "--enable-convert --with-convert=ext2,--disable-convert --without-convert,e2fsprogs" 33PACKAGECONFIG[convert] = "--enable-convert --with-convert=ext2,--disable-convert --without-convert,e2fsprogs"
33PACKAGECONFIG[zoned] = "--enable-zoned,--disable-zoned" 34PACKAGECONFIG[zoned] = "--enable-zoned,--disable-zoned"
34PACKAGECONFIG[python] = "--enable-python,--disable-python,python3-setuptools-native" 35PACKAGECONFIG[python] = "--enable-python,--disable-python,python3-setuptools-native"
36PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
35PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" 37PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd"
36PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev" 38PACKAGECONFIG[udev] = "--enable-libudev,--disable-libudev,udev"
37 39