summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@windriver.com>2014-02-10 15:15:29 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-11 11:56:56 +0000
commitb6bfcaa312f4d271692b78d3b615d34d7d66da7f (patch)
treeb73da2aa77649e90eea764fc78a8555d4d888b78
parent6bf21ce08264e18c0b27b373af3cebef1ca18098 (diff)
downloadpoky-b6bfcaa312f4d271692b78d3b615d34d7d66da7f.tar.gz
kernel: stop using -exec rm for deleting files
Removing files from the source tree via find, exec and rm is not the most efficient operation, due to (among other things) the many forked processes. If we use -delete, it saves a significant amount of time. But -delete does not work with -prune (since it forces -depth). To maintain the lib, tools and scripts source files, we can hide them temporarily, skip their hidden directories and then finally restore them. Time for install before this change: real 2m48.563s user 0m35.220s sys 0m33.036s Time for install after this change: real 1m21.301s user 0m33.160s sys 0m28.388s We could further speed this up by using inline perl to delete the files, but that complexity is avoided for now. (From OE-Core rev: 01932d6bbc71e86fd903097b5339e91f76846388) Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/kernel.bbclass18
1 files changed, 15 insertions, 3 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 51626b03f8..db5d479000 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -260,9 +260,21 @@ kernel_do_install() {
260 # we clean the scripts dir while leaving the generated config 260 # we clean the scripts dir while leaving the generated config
261 # and include files. 261 # and include files.
262 # 262 #
263 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean 263 oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean _mrproper_scripts
264 make -C $kerneldir _mrproper_scripts 264
265 find $kerneldir -path $kerneldir/lib -prune -o -path $kerneldir/tools -prune -o -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}' \; 265 # hide directories that shouldn't have their .c, s and S files deleted
266 for d in tools scripts lib; do
267 mv $kerneldir/$d $kerneldir/.$d
268 done
269
270 # delete .c, .s and .S files, unless we hid a directory as .<dir>. This technique is
271 # much faster than find -prune and -exec
272 find $kerneldir -not -path '*/\.*' -type f -name "*.[csS]" -delete
273
274 # put the hidden dirs back
275 for d in tools scripts lib; do
276 mv $kerneldir/.$d $kerneldir/$d
277 done
266 278
267 # As of Linux kernel version 3.0.1, the clean target removes 279 # As of Linux kernel version 3.0.1, the clean target removes
268 # arch/powerpc/lib/crtsavres.o which is present in 280 # arch/powerpc/lib/crtsavres.o which is present in