From patchwork Tue Oct 8 12:05:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175481 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5610159ill; Tue, 8 Oct 2019 05:06:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyhMCh6vdSjhipClVQdLt6bQayqyK7X+S2kM1oTICL4uO1KFhFHJljrbcQhPjYOEZIrPD6V X-Received: by 2002:a17:906:9395:: with SMTP id l21mr1709576ejx.161.1570536417911; Tue, 08 Oct 2019 05:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570536417; cv=none; d=google.com; s=arc-20160816; b=j0RFRNWz87SybJYE30OAnoDXUD2SG8ep5HDFMJHBKjzSxQbMYkuWHEfH9qE6CRBW6j qHQyTmaBLRcE3GJdlxiok6hjpwURLZER7KET8R/gkEGFxq2ENWNhugWxvPcPZ3+kEP5X +GZQK0B8113cp9EdDWK/n3N7MIOENl7B8slKd2o6yKsNWJj0vI1cp9Xhqs12J68wA5ZV AtzwL/2mzWOLPSg9FE+RtHnxdAtufOthu8qFnnCudpMf2mtLkWhDPpQJgTeFJe1Efmt/ d6DPGAjV7EnG2JcpfzF90og8oYUgpozQ8FcUcq3RnMK6ktQ+GsqM5DPE/IB+esQh/C7X C4ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=5sMplte1orpkOBofj2bSvoYhmGY/7D1FKE2MtMgI2c0=; b=ViIs8AHrBkaw1VTr2SCo1+6LWw/EPQP75tmOWm8t4Ou9mcPZdFTdsS7pXUZATNS6eg Bu0HcJ+bsbh/LjZrwjG0ny/8ymQU4vFePrN+4/UeVbguc4Do6HJaI6/MVaIAmTUi2qbe 5/dVogNmHuMviiHSmB5UiSrNhbb5jBuY8aYdK0JubldUCkfFy7yDEiFHe92R/Udf1c4/ em4pn5vu6It8Ab5Dr33oSCDuNzN0LBQE92tov3eQq67RGG9Uo59oDMqzCl7FmAxgiGZC n14s7TGGJ00QNXor9K5Vc2T6mRnOR1ylDP2tP6mWVfy7sF2XR0dxRqTmFSgY4Ren1Zv6 KfEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=IOQ7bFge; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si7451923eju.406.2019.10.08.05.06.57; Tue, 08 Oct 2019 05:06:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=IOQ7bFge; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731013AbfJHMG4 (ORCPT + 26 others); Tue, 8 Oct 2019 08:06:56 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:28280 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730727AbfJHMGn (ORCPT ); Tue, 8 Oct 2019 08:06:43 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x98C6133021176; Tue, 8 Oct 2019 21:06:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x98C6133021176 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570536362; bh=5sMplte1orpkOBofj2bSvoYhmGY/7D1FKE2MtMgI2c0=; h=From:To:Cc:Subject:Date:From; b=IOQ7bFgeGXun0TVQbxqC2WiLnBmTXZJ29pNWIZOiuQ4PdzzSneeEoT/1cYhD4lEX6 OrpTDrJxbx2/LOImspUh8yHQKHPo3r+UdwAI8j2kzXBV8S3lSN9Il+xqjGQG3iCL0L m/qA3wQQNmanGuxtEkXuWfQIKvenYeGMNTwdijJj5sWX/npbg4KyZAIG/NpL7zvoPD XhreK5JkAxhlNBLmDyDosTRUC4cYbAaORTr+MpQlB62yDTOGpHneft7FLJX/smuXJs hKZraK5ERsohMeC7TbYfm6w0++8827zMXqB3fYmd5c8fDS78xiTkUIFAf1gMDosYHp W/RBZl3FlCcew== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg KH , Joel Fernandes , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] kheaders: remove unneeded 'cat' command piped to 'head' / 'tail' Date: Tue, 8 Oct 2019 21:05:52 +0900 Message-Id: <20191008120556.4263-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'head' and 'tail' commands can take a file path directly. So, you do not need to run 'cat'. cat kernel/kheaders.md5 | head -1 ... is equivalent to: head -1 kernel/kheaders.md5 and the latter saves forking one process. While I was here, I replaced 'head -1' with 'head -n 1'. I also replaced '==' with '=' since we do not have a good reason to use the bashism. Signed-off-by: Masahiro Yamada --- kernel/gen_kheaders.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index aff79e461fc9..8aa6d3c37ba7 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -41,10 +41,10 @@ obj_files_md5="$(find $dir_list -name "*.h" | this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)" if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi if [ -f kernel/kheaders.md5 ] && - [ "$(cat kernel/kheaders.md5|head -1)" == "$src_files_md5" ] && - [ "$(cat kernel/kheaders.md5|head -2|tail -1)" == "$obj_files_md5" ] && - [ "$(cat kernel/kheaders.md5|head -3|tail -1)" == "$this_file_md5" ] && - [ "$(cat kernel/kheaders.md5|tail -1)" == "$tarfile_md5" ]; then + [ "$(head -n 1 kernel/kheaders.md5)" = "$src_files_md5" ] && + [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$obj_files_md5" ] && + [ "$(head -n 3 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && + [ "$(tail -n 1 kernel/kheaders.md5)" = "$tarfile_md5" ]; then exit fi From patchwork Tue Oct 8 12:05:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175479 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5609914ill; Tue, 8 Oct 2019 05:06:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIqqxPtQGANv6dknVCqHllMAZJHc6mz2JlJFb7EoWpaoiO8iW6q6dCbA5aoqgxmDLNJlpn X-Received: by 2002:a17:906:a2c7:: with SMTP id by7mr28223884ejb.13.1570536407442; Tue, 08 Oct 2019 05:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570536407; cv=none; d=google.com; s=arc-20160816; b=bHVtJMrH0MxXicJuHpuQBIXUHqpW3qT8UJQaMwokwPA77uIieN9HyDy6ETAxTX4T9/ xkl04rP8hkLffnwRjnrpQqU9E7jTnD/CKk1hOme/Hvwl+5LbmX7npsw2+ivEyhJpJCR9 ZejuQxOMgC7P6aKN0VIDNfbki6ljvvqfPT+ul3UAeB9bc5JSoZr24hzstCqFr98XGh/p ek+X1940w41uv774G/OiKloy138h5cmTm7ZLyFSXzqHJ1lKQFyQnQXpCpj1oNMLKFwOl aopt/Xn54xbeOjWknl+9QtadruQZNxxfF1gofoc47p7NhvNLCcj8ayt3lHyMOoGjrcqo 1PRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=acaNKDKpGidTrv+O/oEz3Pcbxkt2cuge+GJ8iZc9IzI=; b=D+IZJiGv5S8z6UyefrLafr+yQH7ifdY0P5+xD86LiuEK0IrLG5n2tN12a7rHBev7XY x9Rv99b/Gkbb+IukZPfTb2nSj4vqPGPwECPWmv6eocLzXBaQxKM+XqqveM/UoCjYFU2a FvbKMdRNFBQhal0UXKc73K3AZ1d6ikIas38nA+prIjm/40OZqH5nHVOFZ2l/Z2kE8AYg CprdTz7/UFcn1SZwrvGD7d/7nh3ue8KBbdMXHdRrBS/GqqPldvXmr2XTXzHOMPguJJR1 TjwJkauw+BcUUNL+VZGbUmwFtHNEHK3bI8mhuQbhlxFzOBCU/qiUpq1NQvZVgQlpXiBo uJsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=VDCtBo+R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p23si7581617eju.435.2019.10.08.05.06.47; Tue, 08 Oct 2019 05:06:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=VDCtBo+R; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730991AbfJHMGq (ORCPT + 26 others); Tue, 8 Oct 2019 08:06:46 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:28279 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730751AbfJHMGn (ORCPT ); Tue, 8 Oct 2019 08:06:43 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x98C6134021176; Tue, 8 Oct 2019 21:06:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x98C6134021176 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570536362; bh=acaNKDKpGidTrv+O/oEz3Pcbxkt2cuge+GJ8iZc9IzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VDCtBo+R+3yIxcR10B8QSEsv+jIbQLIVF4V1qUYRsI0BIEemLFBbZUaCtOL1U81lb xmsRzmXSvcQ8iFUqEH42jXrBt2/kW2n50xJC4jzkexWXzTaCqy2fHURAYaWQlqKaCj luoYm8MNCSnIq5J+Zd6pJCHnmPdWHyzuIAeZP6TfOSxmGiF2vJuME9xiawi3YiOwZP Mwq4LPzTgB4ypthpepvWZl+n5piaCVlFRws8A8OvQ4p1o/iLJEeuD7Jxi8csQPL7gM +iUl6STJUI2r8AR1HfBaFRjp9uwfvWh34Y84Stq0iZjoaiDLbycJ/47FKT0DJK0fcR W6Zq44Qoa0wLA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg KH , Joel Fernandes , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 2/5] kheaders: optimize md5sum calculation for in-tree builds Date: Tue, 8 Oct 2019 21:05:53 +0900 Message-Id: <20191008120556.4263-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008120556.4263-1-yamada.masahiro@socionext.com> References: <20191008120556.4263-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This script computes md5sum of headers in srctree and in objtree. However, when we are building in-tree, we know the srctree and the objtree are the same. That is, we end up with the same computation twice. In fact, the first two lines of kernel/kheaders.md5 are always the same for in-tree builds. Unify the two md5sum calculations. For in-tree builds ($building_out_of_srctree is empty), we check only two directories, include, and arch/$SRCARCH/include. For out-of-tree builds ($building_out_of_srctree is 1), we check 4 directories, $srctree/include, $srctree/arch/$SRCARCH/include, include, and arch/$SRCARCH/include since we know they are all different. Signed-off-by: Masahiro Yamada --- kernel/gen_kheaders.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index 8aa6d3c37ba7..5f8e664977f8 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -21,29 +21,30 @@ arch/$SRCARCH/include/ # Uncomment it for debugging. # if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter; # else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi -# find $src_file_list -name "*.h" | xargs ls -l > /tmp/src-ls-$iter -# find $obj_file_list -name "*.h" | xargs ls -l > /tmp/obj-ls-$iter +# find $all_dirs -name "*.h" | xargs ls -l > /tmp/ls-$iter + +all_dirs= +if [ "$building_out_of_srctree" ]; then + for d in $dir_list; do + all_dirs="$all_dirs $srctree/$d" + done +fi +all_dirs="$all_dirs $dir_list" # include/generated/compile.h is ignored because it is touched even when none # of the source files changed. This causes pointless regeneration, so let us # ignore them for md5 calculation. -pushd $srctree > /dev/null -src_files_md5="$(find $dir_list -name "*.h" | - grep -v "include/generated/compile.h" | - grep -v "include/generated/autoconf.h" | - xargs ls -l | md5sum | cut -d ' ' -f1)" -popd > /dev/null -obj_files_md5="$(find $dir_list -name "*.h" | - grep -v "include/generated/compile.h" | - grep -v "include/generated/autoconf.h" | +headers_md5="$(find $all_dirs -name "*.h" | + grep -v "include/generated/compile.h" | + grep -v "include/generated/autoconf.h" | xargs ls -l | md5sum | cut -d ' ' -f1)" + # Any changes to this script will also cause a rebuild of the archive. this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)" if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi if [ -f kernel/kheaders.md5 ] && - [ "$(head -n 1 kernel/kheaders.md5)" = "$src_files_md5" ] && - [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$obj_files_md5" ] && - [ "$(head -n 3 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && + [ "$(head -n 1 kernel/kheaders.md5)" = "$headers_md5" ] && + [ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] && [ "$(tail -n 1 kernel/kheaders.md5)" = "$tarfile_md5" ]; then exit fi @@ -76,8 +77,7 @@ tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ --owner=0 --group=0 --sort=name --numeric-owner \ -Jcf $tarfile -C $cpio_dir/ . > /dev/null -echo "$src_files_md5" > kernel/kheaders.md5 -echo "$obj_files_md5" >> kernel/kheaders.md5 +echo $headers_md5 > kernel/kheaders.md5 echo "$this_file_md5" >> kernel/kheaders.md5 echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5 From patchwork Tue Oct 8 12:05:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175478 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5609892ill; Tue, 8 Oct 2019 05:06:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrpjXTve7HyCSuDaXGJjx0dEx5I91zuTsdqWeiYvuKEx4YBpT7nbYrmI6jxD3DLFigkicB X-Received: by 2002:a17:906:3486:: with SMTP id g6mr18764986ejb.262.1570536405573; Tue, 08 Oct 2019 05:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570536405; cv=none; d=google.com; s=arc-20160816; b=V16gmMx2uifl0OLfmO+mCa444hGfHKdSz7k59vexJwQnzwLbb3ePD73HMffaqT9If1 Jv1Ltkk3/Jh8B5otVKuiGOfqvdldjk31k85aGmNaa7wTv44KGfwNI1R086FWvL4uaEUO RpILKQzCPmooClRmwIsBL7z7y4buu/x9zitrwXK6Kr18O8fQquUEZYqinmadhEXJT7UQ IuZzsaiv6/2bVd6NDJAhnpojOpvjDqk3D7d4vOL7rGBQnOHXkdOmknPRiJmHQ/jKD5Ro ndBqWYspeNvLBuBVIM87nSxo9lxqoN7mS/ngUYAlPEb9/aIU9uqsRogbTbti3HupFp7G NScQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=ky+LkOLJvLz7GQrqNxbqax/IF2ZqOBtCIPZVaij14hc=; b=e37KdPp0BrV9epcWP0w360UrycYSl8ASGjJAmtcHrT1tXOTdF/XGCS5t4l2mxsUGIN wgHSTt0+OWN/0Q+jcc/o0pig1P/EcgKTnVYv1prfAfHOxA8daa2oULN4zibLPOk3QkAV 7tjZUMtXJ3x4AEF1G5qewsAxOLhR525gZyJ3QesUL2q87HSxiXkMjHlZmC08Qw30thsa NPN5LH6ownIRjD4J9neiD2yMQ0BW5ofDWu4wqISgvRPP4CoKdzcLtQOhtlOSloe8Kh2M AzogsHooSLYQnRX2Mem8wZPjn/Ao6F7K6T/CDVIP6zpxGDwnLbSc9b0oyuae2Aph2Jwm xKKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CouozuWh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p23si7581617eju.435.2019.10.08.05.06.45; Tue, 08 Oct 2019 05:06:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=CouozuWh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730981AbfJHMGo (ORCPT + 26 others); Tue, 8 Oct 2019 08:06:44 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:28282 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730719AbfJHMGn (ORCPT ); Tue, 8 Oct 2019 08:06:43 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x98C6135021176; Tue, 8 Oct 2019 21:06:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x98C6135021176 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570536363; bh=ky+LkOLJvLz7GQrqNxbqax/IF2ZqOBtCIPZVaij14hc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CouozuWhUbGuiISjMHzx2mHgMpE1ijsXTbEu0z88EKiN2NIg+GP4wXu7zejtJufXU VdslYdQ6cSgR1rY5hOEVSwTz1Abl5LdojENGoCg79DJjhwL2ni9zz7SlTUYnNdTfql ZgO3f+ze824TMw60Msc3GXYj9czZVPev3B1BVTtvqagNORSkHIcsC2nQztuDbU5V2i H8rUguRBm7+6f03ywI9FNe2Z1/hNTj0D6aWHZ3PVdHefZ485eX+RPIYh0zveXJlz8L SpQwkuXA+wRtsDlrYXJcMuesotxo/q+jFphzS2+7D6eB/u0kMDclL6GSCtgNVcJAqO rFFbYC5xduR8w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg KH , Joel Fernandes , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 3/5] kheaders: optimize header copy for in-tree builds Date: Tue, 8 Oct 2019 21:05:54 +0900 Message-Id: <20191008120556.4263-3-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008120556.4263-1-yamada.masahiro@socionext.com> References: <20191008120556.4263-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- kernel/gen_kheaders.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index 5f8e664977f8..dd40a1b86f96 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -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 From patchwork Tue Oct 8 12:05:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175477 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5609878ill; Tue, 8 Oct 2019 05:06:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqylS8GWvGLEDtzoFsLhhftEhV8NSseKjUgRmYrEVhqBg9yoZFW3XsL8okjC6qEJF9GOPLIZ X-Received: by 2002:a17:906:5847:: with SMTP id h7mr27702664ejs.218.1570536404987; Tue, 08 Oct 2019 05:06:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570536404; cv=none; d=google.com; s=arc-20160816; b=ncTdyJYjTXCB0wAf3cyCOzYp3ma/a0gX6FPggn9FrtZ3KQUHjObSSdQCl1LViQuRlz iQt2R3lCX49/3TfmoLMhCluqN11QOFdaPfIL/QLcjX5GM9ESupTP8X1T0svMRC7gguJe 4IYeKRt4aoYX1bJE4F4W7mtZnuDfQFL38CrE0kTY0EPpwe2DX1NaOwYU3Xc1Lz/IUP3Q Rqlf0BpSlK5WyHLx6mx/QQH4NnabQbs9CF77gi27b8DKa9HygESJezHoo/Oa5BH8uwT3 bWQmisebijOxyAyenxH6FvP3UEHS+ySfvJq2z7DSZJHHV/v+JVpBMDLHv4DXS1n0FElv N32g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=PgC6Hu85mI6smUhbjGbKEy1lzgBgshSxS8+Ygx9AYwc=; b=VxHbfdjloc4kYi5sNsVWdiL+RkWVRkJ/GXdluxi3a3oOe1HJckozTaJUS5VS2Rc5Rh sSpBjPmrZLQQbXWhUI3k6zNticEvbW2WFV+N+4C+pV6xg4V2n+PXXCmoqPQnPRgrPYti 7kzi6DUkwzmqeeSLDQOfcQwSLCNWTk5X5YkZacuU9wxHbPHo3bfNmu/hPZXBMdABh/zW 9zwhCOQqAzPpoGjEW9wI8jzggDU9BQEUr0dqPNAU24ejacjxo5Z5nMFVAvxgncIYo2Df Mnd49/Qn+leW+g/cggywNhdC3c5lWwm8naQPXx9vmGp+5NXzNqS4Ur59rqOR+VZSDI5v B/hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="gHzP/IZA"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p23si7581617eju.435.2019.10.08.05.06.44; Tue, 08 Oct 2019 05:06:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b="gHzP/IZA"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730971AbfJHMGn (ORCPT + 26 others); Tue, 8 Oct 2019 08:06:43 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:28283 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730683AbfJHMGm (ORCPT ); Tue, 8 Oct 2019 08:06:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x98C6136021176; Tue, 8 Oct 2019 21:06:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x98C6136021176 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570536364; bh=PgC6Hu85mI6smUhbjGbKEy1lzgBgshSxS8+Ygx9AYwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gHzP/IZAEvhFKy7tFjejGrZpEytl4EnUKO5lhkb8JCB4OKcqTNh+GJBkd5w0uB2rG 5hFATSHxB6200o7GzxuBkDnAZ7xXS57bbjbDcbnrVjWhfZe5qfli5KhBwcsp5f9c3K m5K5K5dlBy8Ox7gUVzRzuRwVenmqdt5mESVs5bowYFfTi/l4yiCAFpFNhcrLbySN2o N1rHs6L4DjJ0tgm+PrT7JNd+4umTYSIrNq7R/z3eHIqdMbYEYhroX9TL34Mhf2izNC vpn7S//dTpL/y4IRjiVHsKdFoGrRZjX93TZLbGOiYb12G4h0gev9DxQu38DJ8CLPJB 2eodAtaQUdkUA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg KH , Joel Fernandes , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 4/5] kheaders: remove the last bashism to allow sh to run it Date: Tue, 8 Oct 2019 21:05:55 +0900 Message-Id: <20191008120556.4263-4-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008120556.4263-1-yamada.masahiro@socionext.com> References: <20191008120556.4263-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 'pushd' ... 'popd' is the last bash-specific code in this script. One way to avoid it is to run the code in a sub-shell. With that addressed, you can run this script with sh. I replaced $(BASH) with $(CONFIG_SHELL), and I changed the hashbang to #!/bin/sh. Signed-off-by: Masahiro Yamada --- kernel/Makefile | 2 +- kernel/gen_kheaders.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/kernel/Makefile b/kernel/Makefile index daad787fb795..42557f251fea 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -128,7 +128,7 @@ $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz - cmd_genikh = $(BASH) $(srctree)/kernel/gen_kheaders.sh $@ + cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_kheaders.sh $@ $(obj)/kheaders_data.tar.xz: FORCE $(call cmd,genikh) diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index dd40a1b86f96..6c5f88f3ca2d 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # SPDX-License-Identifier: GPL-2.0 # This script generates an archive consisting of kernel headers @@ -57,11 +57,12 @@ rm -rf $cpio_dir mkdir $cpio_dir 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 + ( + cd $srctree + for f in $dir_list + do find "$f" -name "*.h"; + done | cpio --quiet -pd $cpio_dir + ) fi # The second CPIO can complain if files already exist which can happen with out From patchwork Tue Oct 8 12:05:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 175480 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp5610065ill; Tue, 8 Oct 2019 05:06:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7UBQMsPJQgTiqOwumfNeSQIPfcjO9gKtFCUawhuGdZvprSeO+s2US8o+BV5sScx9p0mT9 X-Received: by 2002:aa7:c6c6:: with SMTP id b6mr32956800eds.19.1570536413909; Tue, 08 Oct 2019 05:06:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570536413; cv=none; d=google.com; s=arc-20160816; b=ciHf6EMmw5a3IybUmvHYbOpe1FneyApvM7XoV/k+S2fJtQ0oR7/iCH/JmDCZGX+Clz i+cYDpwK0S3qxroGqA+JJxGcWtdduLSlvHFjHFShHJ7mxUvyt5IecY9B8riID1DIeXLU jt9njOyr5Ce1XkY7Wtky2LJENr1f+gbq0o/0tAo7hF2Rf2DgeBBttsvnSA6iPZoPd8rG ga6UD7UlyNikvTaBsaep5O1Xstos+Sx06CIEZGYr4Ua9iMbM0nUdrfgky7G8/zK6Ok8w 9vKksCMO/1GK6Hl/ceNwUvUIUaRR11tFoymDRHKK+GzwmLtR8AWlKeRgUn2C+eCEUr3F 7Zdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=o08jjtAXayQQibqWZRK6KQghEgpMnJSKKT2mpiY9c0U=; b=s/9A3P1pqAghbBYBVCdN8l+rrEF/iqT3DdnshZw+m+gn9H9ds22tR5FPV4qQxpGCTJ DD3vRe95RzG+WiRxDGOUtDqVEO3xFef/tx9NcnWwmbbBDMt32L8GE2LELj4vJuWxQgBA T+VoRLAo9QlGR/szzr6PEpCYXh0ZaoTqEh/WSdrpsueydLyEk2t7pDzoAgmi6+9OWkGt 4CEGV3/4G1F8CCYOVD3mWDYTsbmp8WjYMmAmW8J9Y7bzRINSPgTKIazJS2w4YxUK/FFj YNpP/Zdnio9dZg0wGMIWe+9kJFKTJMm1rtxdclMgtYgEWwoeqEEC1TX1q+NCEhSo2rvU WxdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2Uu9Qr+8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si7451923eju.406.2019.10.08.05.06.53; Tue, 08 Oct 2019 05:06:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2Uu9Qr+8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730960AbfJHMGn (ORCPT + 26 others); Tue, 8 Oct 2019 08:06:43 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:28287 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730648AbfJHMGm (ORCPT ); Tue, 8 Oct 2019 08:06:42 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x98C6137021176; Tue, 8 Oct 2019 21:06:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x98C6137021176 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1570536365; bh=o08jjtAXayQQibqWZRK6KQghEgpMnJSKKT2mpiY9c0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Uu9Qr+8AGGzvZd0q21inKfPqkb3+LMAVmxPBumQEdVjLZ3i/EXLi8qnf6VOzyIvr NcIteZbNS121zvZNqlfXSJNr/R1AireeQYJTDrJ3Lff3VhRZ2W3pm6+7sHX+nlr5Te 8jcKIg8Rc83tFGhW4eJG5H5qPmyBeFwD24pVr7BZYVPJRIvBpfklJ7b613JD6iltzw JaPKxFdHBfjLL4tRVGOBWi7ZaOaCKewtd9sfxRUT0bbdl0RfJRA38ukFmFHqJTdNAa EVG8g0WUUGLfE2PKeGCsHOi7AtKte8oW8UH4aYzis7LsQ91o0N7YETeQ8TNGniFb5O Bj1/7DImlJvPg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Greg KH , Joel Fernandes , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 5/5] kheaders: explain why include/config/autoconf.h is excluded from md5sum Date: Tue, 8 Oct 2019 21:05:56 +0900 Message-Id: <20191008120556.4263-5-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191008120556.4263-1-yamada.masahiro@socionext.com> References: <20191008120556.4263-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This comment block explains why include/generated/compile.h is omitted, but nothing about include/generated/autoconf.h, which might be more difficult to understand. Add more comments. Signed-off-by: Masahiro Yamada --- kernel/gen_kheaders.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh index 6c5f88f3ca2d..b229a84693e5 100755 --- a/kernel/gen_kheaders.sh +++ b/kernel/gen_kheaders.sh @@ -32,8 +32,15 @@ fi all_dirs="$all_dirs $dir_list" # include/generated/compile.h is ignored because it is touched even when none -# of the source files changed. This causes pointless regeneration, so let us -# ignore them for md5 calculation. +# of the source files changed. +# +# When Kconfig regenerates include/generated/autoconf.h, its timestamp is +# updated, but the contents might be still the same. When any CONFIG option is +# changed, Kconfig touches the corresponding timestamp file include/config/*.h. +# Hence, the md5sum detects the configuration change anyway. We do not need to +# check include/generated/autoconf.h explicitly. +# +# Ignore them for md5 calculation to avoid pointless regeneration. headers_md5="$(find $all_dirs -name "*.h" | grep -v "include/generated/compile.h" | grep -v "include/generated/autoconf.h" |