From patchwork Thu Jan 17 04:10:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 155781 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1478316jaa; Wed, 16 Jan 2019 20:11:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN6LB//DpUW++bo1+TgsV2fADBj13OJnJEyx8iMa3yBrAx4Duf1uxpFJFVakbzoddqKZHu5i X-Received: by 2002:a62:1c0a:: with SMTP id c10mr13304362pfc.213.1547698266755; Wed, 16 Jan 2019 20:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547698266; cv=none; d=google.com; s=arc-20160816; b=l6NV1KIsGooajun+39mACyFsrbnmJVuHZZhG3+eUFFaYlXWuDrcKnI1EXILan3hSfv zeqSh1xfT7tDiaFFtnN+j6/4FY500txv7tGTA39MZvSbjO3ORBVrAmGcHBCLGo0/EMpQ CS3DeHqTjNmm3kjGkAIgCGUVqY458HjPS/zUoeFCxgdFHBUye5MwA34FWgR0eN+1oh+j R79zJqh4WufEDwJqY8bU2I1krJ9Ax6YRtUmYI6dxfM0bk1X0yA8KhZ5Ae+EBnIjDEvsH 74W09zVPsNMbUdbQTznd050fVOBGN62HGubCOFtGCfDTKGrDbatQO0aWpYcHQ6j8hk4H NW2g== 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=DeGTimLs2LDTF0UV0F/cvayXY2TZfd8t27YTASSPmfM=; b=wU3ga9aC0VIeYn85yEX4oD9gKBwajUmeIyBHhEnWdgyjlj+VfSYCPi99jKXjHTcI9S Kz+JWVuImo/JuXRGjXsQL0YGaW5eKC9vIOKkAaFfG0FXLK2uGeSK/z9HvqtuO3FQBg7u pirihxvkfrxY6/myMT9PWF2qpbSdwzMHPBsE0XtKHscFB6D4bv/8Zk1rffMmnEoS7BFo q31h7JCWmb7hZicX9wzRw3YD5YxBsp4fmrZ59h3144kFwQkRaqEZk+9Qktp/gO5Tg0Zl WusfbI7BucoLINygqYt0vXLRhH49+x7JV1XtwR661khf1t0UUX5PuvcDrhpA5Su7YnXU ZQ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=kqnlTzrl; 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 q7si433893pgl.303.2019.01.16.20.11.06; Wed, 16 Jan 2019 20:11:06 -0800 (PST) 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=kqnlTzrl; 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 S1728579AbfAQELF (ORCPT + 23 others); Wed, 16 Jan 2019 23:11:05 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:22827 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728525AbfAQELF (ORCPT ); Wed, 16 Jan 2019 23:11:05 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x0H4AYQb007102; Thu, 17 Jan 2019 13:10:34 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x0H4AYQb007102 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547698234; bh=DeGTimLs2LDTF0UV0F/cvayXY2TZfd8t27YTASSPmfM=; h=From:To:Cc:Subject:Date:From; b=kqnlTzrlMSwg8JjpaxTOmqJktov4P0X058ZiUE096VHgLi9LZzzPw6LPYlcK3g++h cwKwXKhggYQHafV6PdmuA6ioUH1/4d42JFXk+lmMgo1zfeA1nYsoMJxCy+JHF1OepO o9ASRpIjF8dK1tpukxJh/s1m/tokzuLSGcM72rUY/Jp9ZAm8nS0lnIr1CJV/v9tHkD crVk9bSjvvMxUUIZw9k+SdDsQSEREYDC9Vw1+4dnsvjfkCdQxRNY368qt7QhzJbGpv qMKvH6C+zOD9mp9jEqgVzU0e8NHBToYg3jGLAPiW3vBm2EqzEksEQK4R2VO11izuzP zQ5yksCSP8QPw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: simplify rules of data compression with size appending Date: Thu, 17 Jan 2019 13:10:29 +0900 Message-Id: <1547698231-20985-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All the callers of size_append pass $(filter-out FORCE,$^). Move $(filter-out FORCE,$^) to the definition of size_append. This makes the callers cleaner because $(call ...) can be omitted to expand a macro with no argument. Signed-off-by: Masahiro Yamada --- scripts/Makefile.lib | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ecad15b..ebaa348 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -321,7 +321,7 @@ dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp) # append the size as a 32-bit littleendian number as gzip does. size_append = printf $(shell \ dec_size=0; \ -for F in $1; do \ +for F in $(filter-out FORCE,$^); do \ fsize=$$($(CONFIG_SHELL) $(srctree)/scripts/file-size.sh $$F); \ dec_size=$$(expr $$dec_size + $$fsize); \ done; \ @@ -335,23 +335,20 @@ printf "%08x\n" $$dec_size | \ ) quiet_cmd_bzip2 = BZIP2 $@ -cmd_bzip2 = (cat $(filter-out FORCE,$^) | \ - bzip2 -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_bzip2 = (cat $(filter-out FORCE,$^) | bzip2 -9 && $(size_append)) > $@ # Lzma # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ -cmd_lzma = (cat $(filter-out FORCE,$^) | \ - lzma -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_lzma = (cat $(filter-out FORCE,$^) | lzma -9 && $(size_append)) > $@ quiet_cmd_lzo = LZO $@ -cmd_lzo = (cat $(filter-out FORCE,$^) | \ - lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_lzo = (cat $(filter-out FORCE,$^) | lzop -9 && $(size_append)) > $@ quiet_cmd_lz4 = LZ4 $@ -cmd_lz4 = (cat $(filter-out FORCE,$^) | \ - lz4c -l -c1 stdin stdout && $(call size_append, $(filter-out FORCE,$^))) > $@ + cmd_lz4 = (cat $(filter-out FORCE,$^) | lz4c -l -c1 stdin stdout && \ + $(size_append)) > $@ # U-Boot mkimage # --------------------------------------------------------------------------- @@ -394,8 +391,7 @@ quiet_cmd_uimage = UIMAGE $@ # decompression mode. A BCJ filter isn't used either. quiet_cmd_xzkern = XZKERN $@ cmd_xzkern = (cat $(filter-out FORCE,$^) | \ - sh $(srctree)/scripts/xz_wrap.sh && \ - $(call size_append, $(filter-out FORCE,$^))) > $@ + sh $(srctree)/scripts/xz_wrap.sh && $(size_append)) > $@ quiet_cmd_xzmisc = XZMISC $@ cmd_xzmisc = (cat $(filter-out FORCE,$^) | \ From patchwork Thu Jan 17 04:10:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 155782 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1478480jaa; Wed, 16 Jan 2019 20:11:20 -0800 (PST) X-Google-Smtp-Source: ALg8bN5iyvBe6yc/7n6Z1Hm45ZZRG87DCftCoGKZ2j6XU9CL7ock0UkmKoPejFajn7GOiW+f6bXE X-Received: by 2002:a17:902:7848:: with SMTP id e8mr13683103pln.100.1547698280211; Wed, 16 Jan 2019 20:11:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547698280; cv=none; d=google.com; s=arc-20160816; b=A5kNHvx3DWagrDP9hdUvlbkhfjkuTYPEGGOdqx+dNXQmdN4wKHDbE2ncl06e9sbu2W ohvpDJqxH2RJ8pXnIZbN7NlxVS8PnrUFLlcP2us+F6yOL5ytr7QaiOi3a+i1F7v9d9WD MK786kP5YBdCJWBMN0wj3RCdcTCmQ8CG5IifrWkDe/CP6X3ghhWWuFV0Upj4Mo9iXOzd rgZqwJgsIcpcp42l+WoeR2YMy6igfdq/RYxMUPSilOpVh7F52jM2QUeWqL8WSnLzgGZe WKhZDxf2HzJ99f4xXij8Vhc1YOlX8FMI0dBZDcOjuN9qn2dSgZXGgUJMtmiwKfsK7vHt 0MJQ== 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=foZhPygMSwpgwvy1W1X5gzceFVUJQ5+RKAbXMqBY8vU=; b=uyLe8+RD6jelkgJldMYL/AuQ9xqvDK2NlcAtCzWzMk688WAJO0aJ11sAghf/jx6/RB xyI3fibarHUEGEPG7kXrceaTCCN2aP3qs/h6O1ZivlbiJasVFOrX6yQRU01Gy4th0pEj jeONkSbQeRSkF7j5Pv652QE6wato4hFhIEWbhzVzjtjYoCVTS1CGg4gWkbiS2kJxXDsY yUsWM3ss40kx2ldp6JiiMP5WVnG5T+dczDCNzrz4oKRc23E8c6soQ7iQxz/fyBePBu4C MBVC73jYU0sKRGTAzgV82BB+sM9RA+LJAC+k1gRfsY2UOnOEUMKya30NcoRk7Vv+MskR 8oXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=ThLbu6Nl; 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 38si491139pgx.460.2019.01.16.20.11.19; Wed, 16 Jan 2019 20:11:20 -0800 (PST) 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=ThLbu6Nl; 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 S1728620AbfAQELH (ORCPT + 23 others); Wed, 16 Jan 2019 23:11:07 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:22828 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728531AbfAQELF (ORCPT ); Wed, 16 Jan 2019 23:11:05 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id x0H4AYQd007102; Thu, 17 Jan 2019 13:10:36 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x0H4AYQd007102 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1547698236; bh=foZhPygMSwpgwvy1W1X5gzceFVUJQ5+RKAbXMqBY8vU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ThLbu6Nlf/V9qCZH3gR9r+yQEarrI7G39j9DGLHu/8dTW0qYKxGe/zw8+ni39tdRl LtANIV5hewjy6k8rlOYYWaMI22QOdENkN1usg6R3Achs3nK6qXsITP8aiyQMV36EOx ah3G9aAib3Q+TvmCz8Jq+/jPOWIvmgjfbyBwvd93Iue4FK4mClIA1XQ1oC8zbDzPR5 xLOM7PP7pAnwRxn1CUVe6qooGoOSw5nI8MFgHuKgJaSuCQeoROdwz7uLHNCMJawCfF Pvj/c3caP9UGQOlO2EJ82HRSaGzJxEO+pt68/r9DbCF+ZGznbLn0OlWFgZkdOXwPG+ auVb1d84g3/gA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] kbuild: remove unnecessary in-subshell execution Date: Thu, 17 Jan 2019 13:10:31 +0900 Message-Id: <1547698231-20985-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547698231-20985-1-git-send-email-yamada.masahiro@socionext.com> References: <1547698231-20985-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The commands surrounded by ( ) are executed in a subshell, but in most cases, we do not need to spawn an extra subshell. Signed-off-by: Masahiro Yamada --- scripts/Makefile.build | 4 ++-- scripts/Makefile.lib | 21 ++++++++++----------- scripts/mkcompile_h | 4 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9800178..f8e2794 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -312,11 +312,11 @@ $(real-obj-m:.o=.s): modkern_aflags := $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE) # # These mirror gensymtypes_c and co above, keep them in synch. cmd_gensymtypes_S = \ - (echo "\#include " ; \ + { echo "\#include " ; \ echo "\#include " ; \ $(CPP) $(a_flags) $< | \ grep "\<___EXPORT_SYMBOL\>" | \ - sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ) | \ + sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \ $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \ $(GENKSYMS) $(if $(1), -T $(2)) \ $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \ diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index c6fc295..c0abd9a 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -271,7 +271,7 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget)) # Generate an assembly file to wrap the output of the device tree compiler quiet_cmd_dt_S_dtb= DTB $@ cmd_dt_S_dtb= \ -( \ +{ \ echo '\#include '; \ echo '.section .dtb.init.rodata,"a"'; \ echo '.balign STRUCT_ALIGNMENT'; \ @@ -281,7 +281,7 @@ cmd_dt_S_dtb= \ echo '__dtb_$(subst -,_,$(*F))_end:'; \ echo '.global __dtb_$(subst -,_,$(*F))_end'; \ echo '.balign STRUCT_ALIGNMENT'; \ -) > $@ +} > $@ $(obj)/%.dtb.S: $(obj)/%.dtb FORCE $(call if_changed,dt_S_dtb) @@ -335,20 +335,20 @@ printf "%08x\n" $$dec_size | \ ) quiet_cmd_bzip2 = BZIP2 $@ - cmd_bzip2 = (cat $(real-prereqs) | bzip2 -9 && $(size_append)) > $@ + cmd_bzip2 = { cat $(real-prereqs) | bzip2 -9 && $(size_append); } > $@ # Lzma # --------------------------------------------------------------------------- quiet_cmd_lzma = LZMA $@ - cmd_lzma = (cat $(real-prereqs) | lzma -9 && $(size_append)) > $@ + cmd_lzma = { cat $(real-prereqs) | lzma -9 && $(size_append); } > $@ quiet_cmd_lzo = LZO $@ - cmd_lzo = (cat $(real-prereqs) | lzop -9 && $(size_append)) > $@ + cmd_lzo = { cat $(real-prereqs) | lzop -9 && $(size_append); } > $@ quiet_cmd_lz4 = LZ4 $@ - cmd_lz4 = (cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ - $(size_append)) > $@ + cmd_lz4 = { cat $(real-prereqs) | lz4c -l -c1 stdin stdout && \ + $(size_append); } > $@ # U-Boot mkimage # --------------------------------------------------------------------------- @@ -390,12 +390,11 @@ quiet_cmd_uimage = UIMAGE $@ # big dictionary would increase the memory usage too much in the multi-call # decompression mode. A BCJ filter isn't used either. quiet_cmd_xzkern = XZKERN $@ - cmd_xzkern = (cat $(real-prereqs) | \ - sh $(srctree)/scripts/xz_wrap.sh && $(size_append)) > $@ + cmd_xzkern = { cat $(real-prereqs) | sh $(srctree)/scripts/xz_wrap.sh && \ + $(size_append); } > $@ quiet_cmd_xzmisc = XZMISC $@ - cmd_xzmisc = (cat $(real-prereqs) | \ - xz --check=crc32 --lzma2=dict=1MiB) > $@ + cmd_xzmisc = cat $(real-prereqs) | xz --check=crc32 --lzma2=dict=1MiB > $@ # ASM offsets # --------------------------------------------------------------------------- diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 87f1fc9..2339f86 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -62,7 +62,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" # Generate a temporary compile.h -( echo /\* This file is auto generated, version $VERSION \*/ +{ echo /\* This file is auto generated, version $VERSION \*/ if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi echo \#define UTS_MACHINE \"$ARCH\" @@ -73,7 +73,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN" echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\" echo \#define LINUX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\" -) > .tmpcompile +} > .tmpcompile # Only replace the real compile.h if the new one is different, # in order to preserve the timestamp and avoid unnecessary