Skip to content

Commit 82a1978

Browse files
committed
kheaders: use 'tar' instead of 'cpio' for copying files
The 'cpio' command is used solely for copying header files to the temporary directory. However, there is no strong reason to use 'cpio' for this purpose. For example, scripts/package/install-extmod-build uses the 'tar' command to copy files. This commit replaces the use of 'cpio' with 'tar' because 'tar' is already used in this script to generate kheaders_data.tar.xz anyway. Performance-wide, there is no significant difference between 'cpio' and 'tar'. [Before] $ rm -fr kheaders; mkdir kheaders $ time sh -c ' for f in include arch/x86/include do find "$f" -name "*.h" done | cpio --quiet -pd kheaders ' real 0m0.148s user 0m0.021s sys 0m0.140s [After] $ rm -fr kheaders; mkdir kheaders $ time sh -c ' for f in include arch/x86/include do find "$f" -name "*.h" done | tar -c -f - -T - | tar -xf - -C kheaders ' real 0m0.098s user 0m0.024s sys 0m0.131s Revert commit 69ef092 ("Docs: Add cpio requirement to changes.rst") because 'cpio' is not used anywhere else during the kernel build. Please note that the built-in initramfs is created by the in-tree tool, usr/gen_init_cpio, so it does not rely on the external 'cpio' command at all. Remove 'cpio' from the package build dependencies as well. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent fd2a118 commit 82a1978

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed

Documentation/process/changes.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ iptables 1.4.2 iptables -V
5959
openssl & libcrypto 1.0.0 openssl version
6060
bc 1.06.95 bc --version
6161
Sphinx\ [#f1]_ 2.4.4 sphinx-build --version
62-
cpio any cpio --version
6362
GNU tar 1.28 tar --version
6463
gtags (optional) 6.6.5 gtags --version
6564
mkimage (optional) 2017.01 mkimage --version
@@ -536,11 +535,6 @@ mcelog
536535

537536
- <https://www.mcelog.org/>
538537

539-
cpio
540-
----
541-
542-
- <https://www.gnu.org/software/cpio/>
543-
544538
Networking
545539
**********
546540

kernel/gen_kheaders.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ include/
1414
arch/$SRCARCH/include/
1515
"
1616

17-
if ! command -v cpio >/dev/null; then
18-
echo >&2 "***"
19-
echo >&2 "*** 'cpio' could not be found."
20-
echo >&2 "***"
21-
exit 1
22-
fi
23-
2417
# Support incremental builds by skipping archive generation
2518
# if timestamps of files being archived are not changed.
2619

@@ -73,15 +66,13 @@ if [ "$building_out_of_srctree" ]; then
7366
cd $srctree
7467
for f in $dir_list
7568
do find "$f" -name "*.h";
76-
done | cpio --quiet -pd "${tmpdir}"
69+
done | tar -c -f - -T - | tar -xf - -C "${tmpdir}"
7770
)
7871
fi
7972

80-
# The second CPIO can complain if files already exist which can happen with out
81-
# of tree builds having stale headers in srctree. Just silence CPIO for now.
8273
for f in $dir_list;
8374
do find "$f" -name "*.h";
84-
done | cpio --quiet -pdu "${tmpdir}" >/dev/null 2>&1
75+
done | tar -c -f - -T - | tar -xf - -C "${tmpdir}"
8576

8677
# Always exclude include/generated/utsversion.h
8778
# Otherwise, the contents of the tarball may vary depending on the build steps.

scripts/package/PKGBUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ license=(GPL-2.0-only)
2222
makedepends=(
2323
bc
2424
bison
25-
cpio
2625
flex
2726
gettext
2827
kmod

scripts/package/mkdebian

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Priority: optional
205205
Maintainer: $maintainer
206206
Rules-Requires-Root: no
207207
Build-Depends: debhelper-compat (= 12)
208-
Build-Depends-Arch: bc, bison, cpio, flex,
208+
Build-Depends-Arch: bc, bison, flex,
209209
gcc-${host_gnu} <!pkg.${sourcename}.nokernelheaders>,
210210
kmod, libelf-dev:native,
211211
libssl-dev:native, libssl-dev <!pkg.${sourcename}.nokernelheaders>,

0 commit comments

Comments
 (0)