diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-06-30 20:58:44 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-07-08 21:10:52 -0400 |
commit | 7199ff7d74003b5aad1e6328bf6128cd8ceea735 (patch) | |
tree | 7a167ba7319986565a82831676b2edbf9e147e2c /kernel/gen_kheaders.sh | |
parent | b60b7c2ea9b7f854d457fefd592c77f621a86580 (diff) |
kheaders: include only headers into kheaders_data.tar.xz
Currently, kheaders_data.tar.xz contains some build scripts as well as
headers. None of them is needed in the header archive.
For ARCH=x86, this commit excludes the following from the archive:
arch/x86/include/asm/Kbuild
arch/x86/include/uapi/asm/Kbuild
include/asm-generic/Kbuild
include/config/auto.conf
include/config/kernel.release
include/config/tristate.conf
include/uapi/asm-generic/Kbuild
include/uapi/Kbuild
kernel/gen_kheaders.sh
This change is actually motivated for the planned header compile-testing
because it will generate more build artifacts, which should not be
included in the archive.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Diffstat (limited to 'kernel/gen_kheaders.sh')
-rwxr-xr-x | kernel/gen_kheaders.sh | 47 |
1 files changed, 16 insertions, 31 deletions
diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index 86a666f5cb17..9ff449888d9c 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh | |||
@@ -4,24 +4,12 @@ | |||
4 | # This script generates an archive consisting of kernel headers | 4 | # This script generates an archive consisting of kernel headers |
5 | # for CONFIG_IKHEADERS. | 5 | # for CONFIG_IKHEADERS. |
6 | set -e | 6 | set -e |
7 | spath="$(dirname "$(readlink -f "$0")")" | 7 | sfile="$(readlink -f "$0")" |
8 | kroot="$spath/.." | ||
9 | outdir="$(pwd)" | 8 | outdir="$(pwd)" |
10 | tarfile=$1 | 9 | tarfile=$1 |
11 | cpio_dir=$outdir/$tarfile.tmp | 10 | cpio_dir=$outdir/$tarfile.tmp |
12 | 11 | ||
13 | # Script filename relative to the kernel source root | 12 | dir_list=" |
14 | # We add it to the archive because it is small and any changes | ||
15 | # to this script will also cause a rebuild of the archive. | ||
16 | sfile="$(realpath --relative-to $kroot "$(readlink -f "$0")")" | ||
17 | |||
18 | src_file_list=" | ||
19 | include/ | ||
20 | arch/$SRCARCH/include/ | ||
21 | $sfile | ||
22 | " | ||
23 | |||
24 | obj_file_list=" | ||
25 | include/ | 13 | include/ |
26 | arch/$SRCARCH/include/ | 14 | arch/$SRCARCH/include/ |
27 | " | 15 | " |
@@ -33,33 +21,29 @@ arch/$SRCARCH/include/ | |||
33 | # Uncomment it for debugging. | 21 | # Uncomment it for debugging. |
34 | # if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter; | 22 | # if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter; |
35 | # else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi | 23 | # else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi |
36 | # find $src_file_list -type f | xargs ls -l > /tmp/src-ls-$iter | 24 | # find $src_file_list -name "*.h" | xargs ls -l > /tmp/src-ls-$iter |
37 | # find $obj_file_list -type f | xargs ls -l > /tmp/obj-ls-$iter | 25 | # find $obj_file_list -name "*.h" | xargs ls -l > /tmp/obj-ls-$iter |
38 | 26 | ||
39 | # include/generated/compile.h is ignored because it is touched even when none | 27 | # include/generated/compile.h is ignored because it is touched even when none |
40 | # of the source files changed. This causes pointless regeneration, so let us | 28 | # of the source files changed. This causes pointless regeneration, so let us |
41 | # ignore them for md5 calculation. | 29 | # ignore them for md5 calculation. |
42 | pushd $kroot > /dev/null | 30 | pushd $srctree > /dev/null |
43 | src_files_md5="$(find $src_file_list -type f | | 31 | src_files_md5="$(find $dir_list -name "*.h" | |
44 | grep -v "include/generated/compile.h" | | 32 | grep -v "include/generated/compile.h" | |
45 | grep -v "include/generated/autoconf.h" | | 33 | grep -v "include/generated/autoconf.h" | |
46 | grep -v "include/config/auto.conf" | | ||
47 | grep -v "include/config/auto.conf.cmd" | | ||
48 | grep -v "include/config/tristate.conf" | | ||
49 | xargs ls -l | md5sum | cut -d ' ' -f1)" | 34 | xargs ls -l | md5sum | cut -d ' ' -f1)" |
50 | popd > /dev/null | 35 | popd > /dev/null |
51 | obj_files_md5="$(find $obj_file_list -type f | | 36 | obj_files_md5="$(find $dir_list -name "*.h" | |
52 | grep -v "include/generated/compile.h" | | 37 | grep -v "include/generated/compile.h" | |
53 | grep -v "include/generated/autoconf.h" | | 38 | grep -v "include/generated/autoconf.h" | |
54 | grep -v "include/config/auto.conf" | | ||
55 | grep -v "include/config/auto.conf.cmd" | | ||
56 | grep -v "include/config/tristate.conf" | | ||
57 | xargs ls -l | md5sum | cut -d ' ' -f1)" | 39 | xargs ls -l | md5sum | cut -d ' ' -f1)" |
58 | 40 | # Any changes to this script will also cause a rebuild of the archive. | |
41 | this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)" | ||
59 | if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi | 42 | if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi |
60 | if [ -f kernel/kheaders.md5 ] && | 43 | if [ -f kernel/kheaders.md5 ] && |
61 | [ "$(cat kernel/kheaders.md5|head -1)" == "$src_files_md5" ] && | 44 | [ "$(cat kernel/kheaders.md5|head -1)" == "$src_files_md5" ] && |
62 | [ "$(cat kernel/kheaders.md5|head -2|tail -1)" == "$obj_files_md5" ] && | 45 | [ "$(cat kernel/kheaders.md5|head -2|tail -1)" == "$obj_files_md5" ] && |
46 | [ "$(cat kernel/kheaders.md5|head -3|tail -1)" == "$this_file_md5" ] && | ||
63 | [ "$(cat kernel/kheaders.md5|tail -1)" == "$tarfile_md5" ]; then | 47 | [ "$(cat kernel/kheaders.md5|tail -1)" == "$tarfile_md5" ]; then |
64 | exit | 48 | exit |
65 | fi | 49 | fi |
@@ -71,16 +55,16 @@ fi | |||
71 | rm -rf $cpio_dir | 55 | rm -rf $cpio_dir |
72 | mkdir $cpio_dir | 56 | mkdir $cpio_dir |
73 | 57 | ||
74 | pushd $kroot > /dev/null | 58 | pushd $srctree > /dev/null |
75 | for f in $src_file_list; | 59 | for f in $dir_list; |
76 | do find "$f" ! -name "*.cmd" ! -name ".*"; | 60 | do find "$f" -name "*.h"; |
77 | done | cpio --quiet -pd $cpio_dir | 61 | done | cpio --quiet -pd $cpio_dir |
78 | popd > /dev/null | 62 | popd > /dev/null |
79 | 63 | ||
80 | # The second CPIO can complain if files already exist which can | 64 | # The second CPIO can complain if files already exist which can |
81 | # happen with out of tree builds. Just silence CPIO for now. | 65 | # happen with out of tree builds. Just silence CPIO for now. |
82 | for f in $obj_file_list; | 66 | for f in $dir_list; |
83 | do find "$f" ! -name "*.cmd" ! -name ".*"; | 67 | do find "$f" -name "*.h"; |
84 | done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 | 68 | done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 |
85 | 69 | ||
86 | # Remove comments except SDPX lines | 70 | # Remove comments except SDPX lines |
@@ -91,6 +75,7 @@ tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null | |||
91 | 75 | ||
92 | echo "$src_files_md5" > kernel/kheaders.md5 | 76 | echo "$src_files_md5" > kernel/kheaders.md5 |
93 | echo "$obj_files_md5" >> kernel/kheaders.md5 | 77 | echo "$obj_files_md5" >> kernel/kheaders.md5 |
78 | echo "$this_file_md5" >> kernel/kheaders.md5 | ||
94 | echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5 | 79 | echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5 |
95 | 80 | ||
96 | rm -rf $cpio_dir | 81 | rm -rf $cpio_dir |