Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp852507pxf; Thu, 1 Apr 2021 15:46:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl5Wco5IXXb7yRhuwpsogQvYlABIvB8i1d46i6TrE8fBGPyI6ppDo4FHJc6kwUNGJ4UPo2 X-Received: by 2002:a50:ed96:: with SMTP id h22mr12238017edr.39.1617317216375; Thu, 01 Apr 2021 15:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617317216; cv=none; d=google.com; s=arc-20160816; b=qHIge6FP/Z51fp3ziuXst5lkrtLMyYCUVn5DjYyx62xqmOxVJJavsAZy0SWxj+yAE1 krMBQ847717NcKTo2mWZvQ5gCqD1p1UzhgeZKdKDQHP/lgQENWecBmL8zdwu3lej+UWC ZvbOUdJdH8A95mF6rtFoV5e5liDO48P3OvlT1jDIiSMjt8C8vOsB4jj5dTlcC3p3xhaM YvAn6ys9KwtEpklKhqMo6iAtj/OGlsDF3M0VxxbVLBQd0GV4WcpqEUNUWesbbS6S0jAw qTR/Zbw3RqYq/Pe6eQd5FDlYe46HxyzVphnU2Zeo/k9Eke1Kg616bvpaTkt2i4gZKLzO U09Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=A53yj3nIQFBVPr6/IX3KxkMn7wiNMdFKrKr0dqTJoro=; b=1HN+H4PWbAtFkyvAN9sUq34vFEuroV6MRtSL48oOwcmZ+LYzFPn15KOlEvh84Cjt9r wWWe9xP6QkckMmP/uLo7vCzGJywOrrTLE4RglhqhORQSrA2W1S4nkDCl+30FMHqqt/MR taVLHmmGQ4RbRQufR00LQWQk+cXi/d6kqEiZrRP+rQcPxPVIuRAyg8IgCKj06IaS1zuU TsGy1PUs7TJnBJApO8DuNbabeJLfSXwt4tbazX7UD4hxTOfzR01iNjvGIWE3VxRd0kOP YEGti3v8y1xLHqoy7DHsu7QUeRzgoVuzZ5j49BPiMC//52smxGe6eVYXoPMd4Ety5XU/ xhGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ENooTuWB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p15si5086101ejr.236.2021.04.01.15.46.32; Thu, 01 Apr 2021 15:46:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ENooTuWB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbhDAWpb (ORCPT + 99 others); Thu, 1 Apr 2021 18:45:31 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:29743 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234043AbhDAWpa (ORCPT ); Thu, 1 Apr 2021 18:45:30 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1617317130; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=A53yj3nIQFBVPr6/IX3KxkMn7wiNMdFKrKr0dqTJoro=; b=ENooTuWB5h4pCTW/RtfAPDTlZ4s5aZXjQu7CnTAxPuixohTwIrc6KGKSVuV9bcFjyPoDzBhl NX8XfXm1gBk1OZqsoaIdQ5G1rBwNfi6IWkTveJ8li/m/is7crijAEYbY02jau18nmpOK6RSG ewXPTuNRpc3yqLmTGqPzdRl3lM8= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n02.prod.us-west-2.postgun.com with SMTP id 60664d028807bcde1d43dce1 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 01 Apr 2021 22:45:22 GMT Sender: eberman=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id BAFAFC433CA; Thu, 1 Apr 2021 22:45:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from eberman-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: eberman) by smtp.codeaurora.org (Postfix) with ESMTPSA id 939C8C433C6; Thu, 1 Apr 2021 22:45:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 939C8C433C6 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=eberman@codeaurora.org From: Elliot Berman To: Masahiro Yamada , Michal Marek Cc: Elliot Berman , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Maennich , Trilok Soni Subject: [PATCH] Kbuild: Update config_data.gz only if KCONFIG_CONFIG materially changed Date: Thu, 1 Apr 2021 15:44:32 -0700 Message-Id: <1617317072-26770-1-git-send-email-eberman@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If you update the timestamp of KCONFIG_CONFIG without actually changing anything, config_data.gz is re-generated and causes vmlinux to re-link. When Link Time Optimization is enabled, unnecessary re-linking of vmlinux is highly desirable since it adds several minutes to build time. Avoid touching config_data.gz by using filechk to compare the existing config_data.gz and update only if it changed. The .config can be touched, for instance, by a build script which installs the default defconfig and then applies a defconfig fragment on top. For a simple example on my x86 machine, I modified x86 default defconfig to set CONFIG_IKCONFIG=y and run: make -j50 defconfig tiny.config vmlinux make -j50 defconfig tiny.config vmlinux With this patch, vmlinux is not re-built as a result of config_data.gz change. Signed-off-by: Elliot Berman --- kernel/Makefile | 2 +- scripts/Makefile.lib | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/Makefile b/kernel/Makefile index 320f1f3..bd4e558 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -140,7 +140,7 @@ $(obj)/configs.o: $(obj)/config_data.gz targets += config_data.gz $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE - $(call if_changed,gzip) + $(call filechk,gzip) $(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index a4fbaf8..81d3ec1 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -282,6 +282,8 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ quiet_cmd_gzip = GZIP $@ cmd_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 > $@ +filechk_gzip = cat $(real-prereqs) | $(KGZIP) -n -f -9 + # DTC # --------------------------------------------------------------------------- DTC ?= $(objtree)/scripts/dtc/dtc -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project