xz_wrap.sh parses the the xz help output to test if the selected BCJ
filter is actually supported. $BCJ might be empty though for some
architectures like Mips, so test the variable for being non-empty before
grepping for the BCJ filter to avoid warnings from grep:

Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.

Fixes: 02898c798d ("scripts: Select XZ --arm64 BCJ filter for 64-bit arm")
Signed-off-by: Sascha Hauer <s.ha...@pengutronix.de>
---
 scripts/xz_wrap.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/xz_wrap.sh b/scripts/xz_wrap.sh
index a6373a7481..02823bc1df 100755
--- a/scripts/xz_wrap.sh
+++ b/scripts/xz_wrap.sh
@@ -25,6 +25,8 @@ if grep -q '^CONFIG_THUMB2_BAREBOX=y$' 
include/config/auto.conf; then
 fi
 
 # clear BCJ filter if unsupported
-xz -H | grep -q -- $BCJ || BCJ=
+if [ -n "${BCJ}" ]; then
+       xz -H | grep -q -- $BCJ || BCJ=
+fi
 
 exec xz --check=crc32 $BCJ --lzma2=$LZMA2OPTS,dict=32MiB
-- 
2.39.2


Reply via email to