Skip to content

Commit ea79e51

Browse files
committed
kheaders: optimize header copy for in-tree builds
This script copies headers by the cpio command twice; first from srctree, and then from objtree. However, when we building in-tree, we know the srctree and the objtree are the same. That is, all the headers copied by the first cpio are overwritten by the second one. Skip the first cpio when we are building in-tree. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent 0e11773 commit ea79e51

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

kernel/gen_kheaders.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,16 @@ fi
5656
rm -rf $cpio_dir
5757
mkdir $cpio_dir
5858

59-
pushd $srctree > /dev/null
60-
for f in $dir_list;
61-
do find "$f" -name "*.h";
62-
done | cpio --quiet -pd $cpio_dir
63-
popd > /dev/null
59+
if [ "$building_out_of_srctree" ]; then
60+
pushd $srctree > /dev/null
61+
for f in $dir_list
62+
do find "$f" -name "*.h";
63+
done | cpio --quiet -pd $cpio_dir
64+
popd > /dev/null
65+
fi
6466

65-
# The second CPIO can complain if files already exist which can
66-
# happen with out of tree builds. Just silence CPIO for now.
67+
# The second CPIO can complain if files already exist which can happen with out
68+
# of tree builds having stale headers in srctree. Just silence CPIO for now.
6769
for f in $dir_list;
6870
do find "$f" -name "*.h";
6971
done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1

0 commit comments

Comments
 (0)