From nobody Mon Oct 6 01:23:43 2025 Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2AA6A1DBB2E; Sat, 26 Jul 2025 15:10:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.211.166.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753542658; cv=none; b=D0ov1uO/nyn7Ee1fzF95WDztXvH7vUKGo+Xr+lEJnfY0xylQQCxxO/XC85fnpYy9hAPUg2QE1MPLuz6lTs2ffUpBHho1eQtn1W+HIlRMixb7/7GkzRKZyW/tyuHki6VVwVWUIev3jz3W0jTC86zSdnCl1qnIs3BezO4Qo/huhIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753542658; c=relaxed/simple; bh=VuF3iwFNCJc1dhUDx5eheQI14CKmMz0Sb7ok2diS9xM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=W9hdG4jCVUupEMHe6lZf/1chZ7uh6qsIEv/+CgHIJlNeUfoJM1nXyuWSgwl+kLYG1Gkzwye213pIWeVBPol0SltzLzCI/EJUlGHAKVKe2ahv5YMmO+y8w0URVvOSHvFAc37jH3SadwE3XCpN0b6l2i2GsY/9HPxRQIkn+1hujos= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gentoo.org; spf=pass smtp.mailfrom=gentoo.org; arc=none smtp.client-ip=140.211.166.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gentoo.org Received: from pomiot (c144-156.icpnet.pl [85.221.144.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 032A5340CEA; Sat, 26 Jul 2025 15:10:54 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: Masahiro Yamada Cc: Nathan Chancellor , Sam James , Nicolas Schier , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [PATCH v3 kbuild-rebased] kheaders: make it possible to override TAR Date: Sat, 26 Jul 2025 17:10:30 +0200 Message-ID: <20250726151030.142548-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Commit 86cdd2fdc4e39c388d39c7ba2396d1a9dfd66226 ("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=3Dgtar Link: https://bugs.gentoo.org/884061 Reported-by: Sam James Tested-by: Sam James Co-developed-by: Masahiro Yamada Signed-off-by: Micha=C5=82 G=C3=B3rny Signed-off-by: Sam James --- Makefile | 3 ++- kernel/gen_kheaders.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ba0827a1fccd..081d494d037a 100644 --- a/Makefile +++ b/Makefile @@ -543,6 +543,7 @@ LZMA =3D lzma LZ4 =3D lz4 XZ =3D xz ZSTD =3D zstd +TAR =3D tar =20 CHECKFLAGS :=3D -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) @@ -622,7 +623,7 @@ export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUST= C_OR_CLIPPY BINDGEN export HOSTRUSTC KBUILD_HOSTRUSTFLAGS export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX Y= ACC AWK INSTALLKERNEL export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX -export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD +export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD TAR export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS KBUILD_PRO= CMACROLDFLAGS LDFLAGS_MODULE export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS =20 diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index c64e5a00a3d9..59ec52f62c52 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -31,7 +31,7 @@ mkdir "${tmpdir}" =20 # shellcheck disable=3DSC2154 # srctree is passed as an env variable sed "s:^${srctree}/::" "${srclist}" | tar -c -f - -C "${srctree}" -T - | t= ar -xf - -C "${tmpdir}" -tar -c -f - -T "${objlist}" | tar -xf - -C "${tmpdir}" +${TAR:-tar} -c -f - -T "${objlist}" | tar -xf - -C "${tmpdir}" =20 # Remove comments except SDPX lines # Use a temporary file to store directory contents to prevent find/xargs f= rom @@ -43,7 +43,7 @@ xargs -0 -P8 -n1 \ rm -f "${tmpdir}.contents.txt" =20 # Create archive and try to normalize metadata for reproducibility. -tar "${timestamp:+--mtime=3D$timestamp}" \ +${TAR:-tar} "${timestamp:+--mtime=3D$timestamp}" \ --owner=3D0 --group=3D0 --sort=3Dname --numeric-owner --mode=3Du=3Drw,= go=3Dr,a+X \ -I "${XZ}" -cf "${tarfile}" -C "${tmpdir}/" . > /dev/null =20