|
7 | 7 | sfile="$(readlink -f "$0")"
|
8 | 8 | outdir="$(pwd)"
|
9 | 9 | tarfile=$1
|
10 |
| -cpio_dir=$outdir/${tarfile%/*}/.tmp_cpio_dir |
| 10 | +tmpdir=$outdir/${tarfile%/*}/.tmp_dir |
11 | 11 |
|
12 | 12 | dir_list="
|
13 | 13 | include/
|
|
65 | 65 |
|
66 | 66 | echo " GEN $tarfile"
|
67 | 67 |
|
68 |
| -rm -rf $cpio_dir |
69 |
| -mkdir $cpio_dir |
| 68 | +rm -rf "${tmpdir}" |
| 69 | +mkdir "${tmpdir}" |
70 | 70 |
|
71 | 71 | if [ "$building_out_of_srctree" ]; then
|
72 | 72 | (
|
73 | 73 | cd $srctree
|
74 | 74 | for f in $dir_list
|
75 | 75 | do find "$f" -name "*.h";
|
76 |
| - done | cpio --quiet -pd $cpio_dir |
| 76 | + done | cpio --quiet -pd "${tmpdir}" |
77 | 77 | )
|
78 | 78 | fi
|
79 | 79 |
|
80 | 80 | # The second CPIO can complain if files already exist which can happen with out
|
81 | 81 | # of tree builds having stale headers in srctree. Just silence CPIO for now.
|
82 | 82 | for f in $dir_list;
|
83 | 83 | do find "$f" -name "*.h";
|
84 |
| -done | cpio --quiet -pdu $cpio_dir >/dev/null 2>&1 |
| 84 | +done | cpio --quiet -pdu "${tmpdir}" >/dev/null 2>&1 |
85 | 85 |
|
86 | 86 | # Always exclude include/generated/utsversion.h
|
87 | 87 | # Otherwise, the contents of the tarball may vary depending on the build steps.
|
88 |
| -rm -f "${cpio_dir}/include/generated/utsversion.h" |
| 88 | +rm -f "${tmpdir}/include/generated/utsversion.h" |
89 | 89 |
|
90 | 90 | # Remove comments except SDPX lines
|
91 |
| -find $cpio_dir -type f -print0 | |
| 91 | +find "${tmpdir}" -type f -print0 | |
92 | 92 | xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;'
|
93 | 93 |
|
94 | 94 | # Create archive and try to normalize metadata for reproducibility.
|
95 | 95 | tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
|
96 | 96 | --owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \
|
97 |
| - -I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null |
| 97 | + -I $XZ -cf $tarfile -C "${tmpdir}/" . > /dev/null |
98 | 98 |
|
99 | 99 | echo $headers_md5 > kernel/kheaders.md5
|
100 | 100 | echo "$this_file_md5" >> kernel/kheaders.md5
|
101 | 101 | echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5
|
102 | 102 |
|
103 |
| -rm -rf $cpio_dir |
| 103 | +rm -rf "${tmpdir}" |
0 commit comments