diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2024-12-18 19:37:08 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2025-01-10 23:01:22 +0900 |
commit | 82a1978d0fdc28e561bc4d98ea155dd322f33c19 (patch) | |
tree | 627b706aaf15d9505fe146db4b1e074fb1bbbcfe /kernel | |
parent | fd2a118c483472f8862cc46981a5230414cd0e67 (diff) |
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 69ef0920bdd3 ("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 <masahiroy@kernel.org>
Diffstat (limited to 'kernel')
-rwxr-xr-x | kernel/gen_kheaders.sh | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index ddfd1177567f..55f493d83b8f 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -14,13 +14,6 @@ include/ arch/$SRCARCH/include/ " -if ! command -v cpio >/dev/null; then - echo >&2 "***" - echo >&2 "*** 'cpio' could not be found." - echo >&2 "***" - exit 1 -fi - # Support incremental builds by skipping archive generation # if timestamps of files being archived are not changed. @@ -73,15 +66,13 @@ if [ "$building_out_of_srctree" ]; then cd $srctree for f in $dir_list do find "$f" -name "*.h"; - done | cpio --quiet -pd "${tmpdir}" + done | tar -c -f - -T - | tar -xf - -C "${tmpdir}" ) fi -# The second CPIO can complain if files already exist which can happen with out -# of tree builds having stale headers in srctree. Just silence CPIO for now. for f in $dir_list; do find "$f" -name "*.h"; -done | cpio --quiet -pdu "${tmpdir}" >/dev/null 2>&1 +done | tar -c -f - -T - | tar -xf - -C "${tmpdir}" # Always exclude include/generated/utsversion.h # Otherwise, the contents of the tarball may vary depending on the build steps. |