History

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.

Masahiro Yamada committed 1 year ago

Commit 82a19781 parent fd2a1184 files · +3 −19Browse files

Unified · Split

4 files
  1. Documentation/process/changes.rst +0 −6
  2. kernel/gen_kheaders.sh +2 −11
  3. scripts/package/PKGBUILD +0 −1
  4. scripts/package/mkdebian +1 −1
Documentation/process/changes.rst+0−6
@@ -59,7 +59,6 @@ iptables 1.4.2 iptables -V · 58 unmodified lines
59openssl & libcrypto 1.0.0 openssl version59openssl & libcrypto 1.0.0 openssl version
60bc 1.06.95 bc --version60bc 1.06.95 bc --version
61Sphinx\ [#f1]_ 2.4.4 sphinx-build --version61Sphinx\ [#f1]_ 2.4.4 sphinx-build --version
62cpio any cpio --version
63GNU tar 1.28 tar --version62GNU tar 1.28 tar --version
64gtags (optional) 6.6.5 gtags --version63gtags (optional) 6.6.5 gtags --version
65mkimage (optional) 2017.01 mkimage --version64mkimage (optional) 2017.01 mkimage --version
@@ -536,11 +535,6 @@ mcelog · 470 unmodified lines
536 535
537- <https://www.mcelog.org/>536- <https://www.mcelog.org/>
538 537
539cpio
540----
541
542- <https://www.gnu.org/software/cpio/>
543
544Networking538Networking
545**********539**********
546 540
kernel/gen_kheaders.sh+2−11
@@ -14,13 +14,6 @@ include/ · 13 unmodified lines
14arch/$SRCARCH/include/14arch/$SRCARCH/include/
15"15"
16 16
17if ! command -v cpio >/dev/null; then
18 echo >&2 "***"
19 echo >&2 "*** 'cpio' could not be found."
20 echo >&2 "***"
21 exit 1
22fi
23
24# Support incremental builds by skipping archive generation17# Support incremental builds by skipping archive generation
25# if timestamps of files being archived are not changed.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 cd $srctree66 cd $srctree
74 for f in $dir_list67 for f in $dir_list
75 do find "$f" -name "*.h";68 do find "$f" -name "*.h";
76 done | cpio --quiet -pd "${tmpdir}"69 done | tar -c -f - -T - | tar -xf - -C "${tmpdir}"
77 )70 )
78fi71fi
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.
82for f in $dir_list;73for f in $dir_list;
83 do find "$f" -name "*.h";74 do find "$f" -name "*.h";
84done | cpio --quiet -pdu "${tmpdir}" >/dev/null 2>&175done | tar -c -f - -T - | tar -xf - -C "${tmpdir}"
85 76
86# Always exclude include/generated/utsversion.h77# Always exclude include/generated/utsversion.h
87# Otherwise, the contents of the tarball may vary depending on the build steps.78# Otherwise, the contents of the tarball may vary depending on the build steps.
scripts/package/PKGBUILD+0−1
@@ -22,7 +22,6 @@ license=(GPL-2.0-only) · 21 unmodified lines
22makedepends=(22makedepends=(
23 bc23 bc
24 bison24 bison
25 cpio
26 flex25 flex
27 gettext26 gettext
28 kmod27 kmod
scripts/package/mkdebian+1−1
@@ -205,7 +205,7 @@ Priority: optional · 204 unmodified lines
205Maintainer: $maintainer205Maintainer: $maintainer
206Rules-Requires-Root: no206Rules-Requires-Root: no
207Build-Depends: debhelper-compat (= 12)207Build-Depends: debhelper-compat (= 12)
208Build-Depends-Arch: bc, bison, cpio, flex,208Build-Depends-Arch: bc, bison, flex,
209 gcc-${host_gnu} <!pkg.${sourcename}.nokernelheaders>,209 gcc-${host_gnu} <!pkg.${sourcename}.nokernelheaders>,
210 kmod, libelf-dev:native,210 kmod, libelf-dev:native,
211 libssl-dev:native, libssl-dev <!pkg.${sourcename}.nokernelheaders>,211 libssl-dev:native, libssl-dev <!pkg.${sourcename}.nokernelheaders>,