Skip to content

Commit

Permalink
kheaders: optimize header copy for in-tree builds
Browse files Browse the repository at this point in the history
commit ea79e51 upstream.

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>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
masahir0y authored and gregkh committed Sep 3, 2020
1 parent a1d0c6e commit 18f4870
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions kernel/gen_kheaders.sh
Expand Up @@ -56,14 +56,16 @@ fi
rm -rf $cpio_dir
mkdir $cpio_dir

pushd $srctree > /dev/null
for f in $dir_list;
do find "$f" -name "*.h";
done | cpio --quiet -pd $cpio_dir
popd > /dev/null
if [ "$building_out_of_srctree" ]; then
pushd $srctree > /dev/null
for f in $dir_list
do find "$f" -name "*.h";
done | cpio --quiet -pd $cpio_dir
popd > /dev/null
fi

# The second CPIO can complain if files already exist which can
# happen with out of tree builds. Just silence CPIO for now.
# 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 -pd $cpio_dir >/dev/null 2>&1
Expand Down

0 comments on commit 18f4870

Please sign in to comment.