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.
Showing the changes to kernel (1 of 4 files). Show all
Unified · Split
| @@ -14,13 +14,6 @@ include/ · 13 unmodified lines | ||
| 14 | 14 | arch/$SRCARCH/include/ |
| 15 | 15 | " |
| 16 | 16 | |
| 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 | − | |
| 24 | 17 | # Support incremental builds by skipping archive generation |
| 25 | 18 | # if timestamps of files being archived are not changed. |
| 26 | 19 | |
| @@ -73,15 +66,13 @@ if [ "$building_out_of_srctree" ]; then · 46 unmodified lines | ||
| 73 | 66 | cd $srctree |
| 74 | 67 | for f in $dir_list |
| 75 | 68 | do find "$f" -name "*.h"; |
| 76 | − done | cpio --quiet -pd "${tmpdir}" | |
| 69 | + done | tar -c -f - -T - | tar -xf - -C "${tmpdir}" | |
| 77 | 70 | ) |
| 78 | 71 | fi |
| 79 | 72 | |
| 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. | |
| 82 | 73 | for f in $dir_list; |
| 83 | 74 | 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}" | |
| 85 | 76 | |
| 86 | 77 | # Always exclude include/generated/utsversion.h |
| 87 | 78 | # Otherwise, the contents of the tarball may vary depending on the build steps. |