Skip to content

Commit 73d210e

Browse files
mgornymasahir0y
authored andcommitted
kheaders: make it possible to override TAR
Commit 86cdd2f ("kheaders: make headers archive reproducible") introduced a number of options specific to GNU tar to the `tar` invocation in `gen_kheaders.sh` script. This causes the script to fail to work on systems where `tar` is not GNU tar. This can occur e.g. on recent Gentoo Linux installations that support using bsdtar from libarchive instead. Add a `TAR` make variable to make it possible to override the tar executable used, e.g. by specifying: make TAR=gtar Link: https://bugs.gentoo.org/884061 Reported-by: Sam James <[email protected]> Tested-by: Sam James <[email protected]> Co-developed-by: Masahiro Yamada <[email protected]> Signed-off-by: Michał Górny <[email protected]> Signed-off-by: Sam James <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 936599c commit 73d210e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ LZMA = lzma
543543
LZ4 = lz4
544544
XZ = xz
545545
ZSTD = zstd
546+
TAR = tar
546547

547548
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
548549
-Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF)
@@ -622,7 +623,7 @@ export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN
622623
export HOSTRUSTC KBUILD_HOSTRUSTFLAGS
623624
export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL
624625
export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX
625-
export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD
626+
export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD TAR
626627
export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS KBUILD_PROCMACROLDFLAGS LDFLAGS_MODULE
627628
export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS
628629

kernel/gen_kheaders.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ rm -rf "${tmpdir}"
3030
mkdir "${tmpdir}"
3131

3232
# shellcheck disable=SC2154 # srctree is passed as an env variable
33-
sed "s:^${srctree}/::" "${srclist}" | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${tmpdir}"
34-
tar -c -f - -T "${objlist}" | tar -xf - -C "${tmpdir}"
33+
sed "s:^${srctree}/::" "${srclist}" | ${TAR} -c -f - -C "${srctree}" -T - | ${TAR} -xf - -C "${tmpdir}"
34+
${TAR} -c -f - -T "${objlist}" | ${TAR} -xf - -C "${tmpdir}"
3535

3636
# Remove comments except SDPX lines
3737
# Use a temporary file to store directory contents to prevent find/xargs from
@@ -43,7 +43,7 @@ xargs -0 -P8 -n1 \
4343
rm -f "${tmpdir}.contents.txt"
4444

4545
# Create archive and try to normalize metadata for reproducibility.
46-
tar "${timestamp:+--mtime=$timestamp}" \
46+
${TAR} "${timestamp:+--mtime=$timestamp}" \
4747
--owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \
4848
-I "${XZ}" -cf "${tarfile}" -C "${tmpdir}/" . > /dev/null
4949

0 commit comments

Comments
 (0)