From patchwork Tue Sep 18 08:45:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10603859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CF7813AD for ; Tue, 18 Sep 2018 08:46:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CCCB2A6C1 for ; Tue, 18 Sep 2018 08:46:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 005272A6C7; Tue, 18 Sep 2018 08:46:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4ED172A6C1 for ; Tue, 18 Sep 2018 08:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729344AbeIROR5 (ORCPT ); Tue, 18 Sep 2018 10:17:57 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:55702 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729250AbeIROR5 (ORCPT ); Tue, 18 Sep 2018 10:17:57 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w8I8juLQ029470; Tue, 18 Sep 2018 17:45:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w8I8juLQ029470 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1537260357; bh=oc89FkiRS8fOvTIsgqiQMWyosxvDE18DMW1VoU1FMUk=; h=From:To:Cc:Subject:Date:From; b=fZzgtvoEI8HQFXTrv2gJvY+IRd1wnTVjq+Ze1YP9RZpLpx06iQ7THljTCzLe9TSH0 U2LWfNlvmlq97FTQ/jnil1cc0hEAaa7o4FdntOg2T6f+FV12yclQxX1SUTc1V7l4MQ NNmGIWssAeSgU5jGkfzuW+J/btKej3f/B4rZu0ALu/MJxyMiZ2p9+WcFA456VnKSfD FchFaERglfr8WFTy7TDGYbHXbzrNFomeuZndXK8J6+OT9mTFREMDJaVAKfti2kWzpb /IEA/W4tyrY5RhWryS9x6eLmiKEvmyO2mslu657hL6C4tm14QJ+6tLh1sPlvnk3twe irUZspLbb0TeA== 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/4] kbuild: remove VERSION and PATCHLEVEL from $(objtree)/Makefile Date: Tue, 18 Sep 2018 17:45:51 +0900 Message-Id: <1537260354-30082-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Neither VERSION nor PATCHLEVEL is used in any useful way. Signed-off-by: Masahiro Yamada --- Makefile | 3 +-- scripts/mkmakefile | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d2976b5..6e1a059 100644 --- a/Makefile +++ b/Makefile @@ -482,8 +482,7 @@ PHONY += outputmakefile outputmakefile: ifneq ($(KBUILD_SRC),) $(Q)ln -fsn $(srctree) source - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \ - $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(objtree) endif ifeq ($(cc-name),clang) diff --git a/scripts/mkmakefile b/scripts/mkmakefile index e19d656..e2106444 100755 --- a/scripts/mkmakefile +++ b/scripts/mkmakefile @@ -7,9 +7,6 @@ # Usage # $1 - Kernel src directory # $2 - Output directory -# $3 - version -# $4 - patchlevel - test ! -r $2/Makefile -o -O $2/Makefile || exit 0 # Only overwrite automatically generated Makefiles @@ -25,9 +22,6 @@ fi cat << EOF > $2/Makefile # Automatically generated by $0: don't edit -VERSION = $3 -PATCHLEVEL = $4 - lastword = \$(word \$(words \$(1)),\$(1)) makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) From patchwork Tue Sep 18 08:45:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10603865 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C24A13AD for ; Tue, 18 Sep 2018 08:46:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DCDE2A6CA for ; Tue, 18 Sep 2018 08:46:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 324862A6D3; Tue, 18 Sep 2018 08:46:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9EDC2A6CA for ; Tue, 18 Sep 2018 08:46:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729535AbeIROR7 (ORCPT ); Tue, 18 Sep 2018 10:17:59 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:55700 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729238AbeIROR6 (ORCPT ); Tue, 18 Sep 2018 10:17:58 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w8I8juLR029470; Tue, 18 Sep 2018 17:45:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w8I8juLR029470 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1537260358; bh=tpqAk1tRE54kXw4Ec4Ttm2Zhd5ozu9gJ+O1B/hU+QsM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d1v74CtGFJeP8/UF4eD0/R2oSHnqUjcF4Pie6pqXlkd+Miklc21KED7QxDnLDbTfI P17FFsc/2b79Xah38ch6HKRfPlV69bOrl0x9g0a6CD4hvjjC+cKKIsZC3yffxMpLJz D1KU//qJXk8/X3mEDh8aasYKC9CEndZavCiU1HxgFbBKPFGh9/oBiPYIVVYPR1uIHL Ltm9kBsMwQON2KKOm5+qu0OgM4qgQY3gjwvsG7m9YsnLgXOZ0NdFAvQVJR20Uexd2n 7Nra9iWsCT97AhMyJJyJ9cfjUJzfJztVPJcKJ5NX4LjcfoqBrk8WFBV+HXFaBfd3e7 VwnfA/4sFZ75w== 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 2/4] kbuild: remove user ID check in scripts/mkmakefile Date: Tue, 18 Sep 2018 17:45:52 +0900 Message-Id: <1537260354-30082-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537260354-30082-1-git-send-email-yamada.masahiro@socionext.com> References: <1537260354-30082-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This line was added by commit fd5f0cd6b0ce ("kbuild: Do not overwrite makefile as anohter user"). Its commit description says the intention was to prevent $(objtree)/Makefile from being owned by root when e.g. running 'make install'. However, as commit 19514fc665ff ("arm, kbuild: make "make install" not depend on vmlinux") stated, installation targets must not modify the source tree in the first place. If they do, we are already screwed up. We must fix the root cause. Installation targets should just copy files verbatim, hence we never expect $(objtree)/Makefile is touched by root. The user ID check in scripts/mkmakefile is unneeded. Signed-off-by: Masahiro Yamada --- scripts/mkmakefile | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/mkmakefile b/scripts/mkmakefile index e2106444..2435428 100755 --- a/scripts/mkmakefile +++ b/scripts/mkmakefile @@ -8,7 +8,6 @@ # $1 - Kernel src directory # $2 - Output directory -test ! -r $2/Makefile -o -O $2/Makefile || exit 0 # Only overwrite automatically generated Makefiles # (so we do not overwrite kernel Makefile) if test -e $2/Makefile && ! grep -q Automatically $2/Makefile From patchwork Tue Sep 18 08:45:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10603861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B51A613AD for ; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A62562A6C1 for ; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9951C2A6CA; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 496C42A6C1 for ; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729316AbeIROR7 (ORCPT ); Tue, 18 Sep 2018 10:17:59 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:55701 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729192AbeIROR6 (ORCPT ); Tue, 18 Sep 2018 10:17:58 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w8I8juLS029470; Tue, 18 Sep 2018 17:45:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w8I8juLS029470 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1537260358; bh=tj2rDC3SWOGJr3wJdUY3fa/p8CdfSaT2qhILVPE4uOE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HMJavHzZxwnpbmVY0l8Jkpm+jPaGV4inLTD/7hAmqWlPLNfXu0Zp7sPYx4Juz+lHa WpEPdjYykXXaUi8qWE0PbNTdYqOusKm5hvidYCIZcHdNGY6LV0h/Gz823S6rA43vq8 Rr+Qof73w7cV4ID3cmUn66T8FC+RIGPZ3zCUz0XA7Q0Ck6GcHv6yN/MhrkMIJ+1SQw H3/StEs0AYQRpdMauI08Qib6bSn9AjTd5ZzUZIgh2NDYOzFYkmgZ8BwPmJkQB40UVG FI1PFEo8USTZ0oRc2AC1+NoTsN+dpJHG8al7qiUq45+cDXIrsNnQVdils3ZRn3KYcB kSvur4gFGpZew== 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/4] kbuild: do not pass $(objtree) to scripts/mkmakefile Date: Tue, 18 Sep 2018 17:45:53 +0900 Message-Id: <1537260354-30082-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537260354-30082-1-git-send-email-yamada.masahiro@socionext.com> References: <1537260354-30082-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since $(objtree) is always '.', it is not useful to pass it to scripts/mkmakefile. I assume nobody wants to run this script directly. Signed-off-by: Masahiro Yamada --- Makefile | 2 +- scripts/mkmakefile | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6e1a059..3799bc5 100644 --- a/Makefile +++ b/Makefile @@ -482,7 +482,7 @@ PHONY += outputmakefile outputmakefile: ifneq ($(KBUILD_SRC),) $(Q)ln -fsn $(srctree) source - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) $(objtree) + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile $(srctree) endif ifeq ($(cc-name),clang) diff --git a/scripts/mkmakefile b/scripts/mkmakefile index 2435428..85995f9 100755 --- a/scripts/mkmakefile +++ b/scripts/mkmakefile @@ -6,19 +6,18 @@ # Usage # $1 - Kernel src directory -# $2 - Output directory # Only overwrite automatically generated Makefiles # (so we do not overwrite kernel Makefile) -if test -e $2/Makefile && ! grep -q Automatically $2/Makefile +if test -e Makefile && ! grep -q Automatically Makefile then exit 0 fi if [ "${quiet}" != "silent_" ]; then - echo " GEN $2/Makefile" + echo " GEN Makefile" fi -cat << EOF > $2/Makefile +cat << EOF > Makefile # Automatically generated by $0: don't edit lastword = \$(word \$(words \$(1)),\$(1)) From patchwork Tue Sep 18 08:45:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10603863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DFF6515E8 for ; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D10BF2A6C1 for ; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C51EA2A6C7; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B2212A6C5 for ; Tue, 18 Sep 2018 08:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729570AbeIROR7 (ORCPT ); Tue, 18 Sep 2018 10:17:59 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:55703 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729316AbeIROR6 (ORCPT ); Tue, 18 Sep 2018 10:17:58 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w8I8juLT029470; Tue, 18 Sep 2018 17:45:58 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w8I8juLT029470 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1537260359; bh=8QvWQPQnnkID6eS2uCqPUDx2wVrHT/2j5vswBJskWpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zJ55wceY2mLsd/+EjxLcsx2yZERv+sopitEKQ/nCbQOrQmxsY4kEwpai3ke7FOAxP IZQ9wHv1ofbD6OtoidthOS23dLJVzwSfEu7iGZizLgNZdmAuyZ1LHGdCclkW/+7RHh 86dlGhKbrcZIcTKxBGlfGDTzFlvOFZO/wLORJNPml+ZHxpnJy0lEli9DcqBlJK67hz BK6A3NaNtD8SxlqzkwSyTCaBbPlLrMByovUDC58AVB5zU71+AJW7FEqz7rBFrh6jzX 5drsYBzVavADmaCp8DPiPj5xSGTzv2sTTb8gOKKN9yo8I0RgTvMYGfbzGc1uUEurWN P6zc0oSAYCmjA== 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 4/4] kbuild: simplify command line creation in scripts/mkmakefile Date: Tue, 18 Sep 2018 17:45:54 +0900 Message-Id: <1537260354-30082-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1537260354-30082-1-git-send-email-yamada.masahiro@socionext.com> References: <1537260354-30082-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Assuming we never invoke the generated Makefile from outside of the $(objtree) directory, $(CURDIR) points to the absolute path of $(objtree). BTW, 'lastword' is natively supported by GNU Make 3.81+, which is the current requirement for building the kernel. Signed-off-by: Masahiro Yamada --- scripts/mkmakefile | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/mkmakefile b/scripts/mkmakefile index 85995f9..412f13f 100755 --- a/scripts/mkmakefile +++ b/scripts/mkmakefile @@ -20,9 +20,6 @@ fi cat << EOF > Makefile # Automatically generated by $0: don't edit -lastword = \$(word \$(words \$(1)),\$(1)) -makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) - ifeq ("\$(origin V)", "command line") VERBOSE := \$(V) endif @@ -30,15 +27,12 @@ ifneq (\$(VERBOSE),1) Q := @ endif -MAKEARGS := -C $1 -MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir)) - MAKEFLAGS += --no-print-directory .PHONY: __sub-make \$(MAKECMDGOALS) __sub-make: - \$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS) + \$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS) \$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make @: