From patchwork Wed Jul 17 16:05:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 2828823 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD089C0AB2 for ; Wed, 17 Jul 2013 16:05:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 628C520372 for ; Wed, 17 Jul 2013 16:05:55 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64DBE20354 for ; Wed, 17 Jul 2013 16:05:50 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UzUEX-0007jg-Qj; Wed, 17 Jul 2013 16:05:42 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UzUEV-0000IN-1J; Wed, 17 Jul 2013 16:05:39 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UzUER-0000HV-KL for linux-arm-kernel@lists.infradead.org; Wed, 17 Jul 2013 16:05:36 +0000 Received: by mail-bk0-f49.google.com with SMTP id mz10so803313bkb.36 for ; Wed, 17 Jul 2013 09:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=fL6oejL2wpH9JQHktwvtEtHZQjOvYmEd0faYwYIf4Dg=; b=b9yNp/5RQB/4ZAX5/u/ifcZobOkCNSPbOsID6gPcdBvde0z5w4CUsz0PbmyHjWQ7WE Vk8aO0ThmoLWOoGoczZNKqo07cq0PaxmUJ27tfhDjp1usS1ie+dDkNvVNsbYHW3lhI8w qzlIHIf9Cwe3QWVDaxXleOZ2j6CqSzWsUcZDq8Q/cV0RrJwLQgKu4+VACmGhB2vvE0fB 9PxlsS1a4yiVO2Ff0A+s+53VCuiCjenWTDEndnWHQk8LmqKY121uy7fh/zoe7wY5VHzT EHv5XSUoVRTfGwTijt+qbb5sCjy4x1kBBDv6UXS52ZQsa8HJ2qYKVe0lVGQ0RxkkQlk/ 1S9g== X-Received: by 10.205.3.5 with SMTP id nw5mr1153016bkb.137.1374077110559; Wed, 17 Jul 2013 09:05:10 -0700 (PDT) Received: from rric.localhost (g224197179.adsl.alicedsl.de. [92.224.197.179]) by mx.google.com with ESMTPSA id m6sm2243734bki.7.2013.07.17.09.05.08 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Jul 2013 09:05:09 -0700 (PDT) Date: Wed, 17 Jul 2013 18:05:06 +0200 From: Robert Richter To: Linus Torvalds , Russell King Subject: [PATCH] arm, kbuild: make "make install" not depend on vmlinux Message-ID: <20130717160506.GI8731@rric.localhost> References: <20130710133742.GA29368@emu.suse.cz> <20130711135445.GA21500@sepie.suse.cz> <20130712105721.GF8731@rric.localhost> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130712105721.GF8731@rric.localhost> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130717_120535_912084_F1766A7F X-CRM114-Status: GOOD ( 24.70 ) X-Spam-Score: -2.6 (--) Cc: Michal Marek , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP (trimmed cc list) On 12.07.13 11:57:21, Robert Richter wrote: > On 11.07.13 10:16:18, Linus Torvalds wrote: > > On Thu, Jul 11, 2013 at 6:54 AM, Michal Marek wrote: > > > > > > Yeah. It also reveals another bug that we rewrite the kernel.release > > > file each time. > > The odd thing I have in a specific configuration is that depmod is > missing the kernelrelease when I only build install rules, though I > had built everything before and kernelrelease should be there: > > $ make > $ make modules_install zinstall > ... > DEPMOD > Usage: .../scripts/depmod.sh /sbin/depmod > > Note that makeflags include the -j option, INSTALL_MOD_PATH and > INSTALL_PATH variables set, so no root perms required in this case. I narrowed this down. The problem is that zinstall on ARCH=arm has a dependency to vmlinux which does a prepare/prepare3 and finally does a forced rebuild of kernel.release even if it exists already. Rebuilding it removes kernel.release first and then recreates it. This might race with another parallel make job running depmod. So on arm and maybe other archs we need the same as for x86: 1648e4f8 x86, kbuild: make "make install" not depend on vmlinux The patch below fixes this for arm. It is build-tested in my environment, but please test it in others too if possible. Thanks, -Robert From 7e751c909830af4459296e7f2e0cb2321295e661 Mon Sep 17 00:00:00 2001 From: Robert Richter Date: Wed, 17 Jul 2013 16:17:20 +0200 Subject: [PATCH] arm, kbuild: make "make install" not depend on vmlinux Install targets (install, zinstall, uinstall) on arm have a dependency to vmlinux. This may cause parts of the kernel to be rebuilt during installation. We must avoid this since this may run as root. Install targets "ABSOLUTELY MUST NOT MODIFY THE SOURCE TREE." as Linus emphasized this in: http://lkml.org/lkml/2013/7/10/600 So on arm and maybe other archs we need the same as for x86: 1648e4f8 x86, kbuild: make "make install" not depend on vmlinux This patch fixes this for arm. Dependencies are removed and instead a check to install.sh is added for the files that are needed. This issue was uncovered by this build error where the -j option is used in conjunction with install targets: $ make $ make zinstall ... DEPMOD Usage: .../scripts/depmod.sh /sbin/depmod (INSTALL_MOD_PATH and INSTALL_PATH variables set, so no root perms required in this case.) The problem is that zinstall on arm due to its dependency to vmlinux does a prepare/prepare3 and finally does a forced rewrite of kernel.release even if it exists already. Rebuilding kernel.release removes it first and then recreates it. This might race with another parallel make job running depmod. So this patch should fix this one too. Also quoting $(KERNELRELEASE) arg for install.sh as this messes argument order in case it is empty (which is the case if the kernel was not built yet). Signed-off-by: Robert Richter Signed-off-by: Robert Richter Acked-by: Michal Marek . --- arch/arm/Makefile | 9 +++++++-- arch/arm/boot/Makefile | 16 ++++++++-------- arch/arm/boot/install.sh | 14 ++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c0ac0f5..fe63986 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -295,10 +295,15 @@ archprepare: # Convert bzImage to zImage bzImage: zImage -zImage Image xipImage bootpImage uImage: vmlinux +BOOT_TARGETS = zImage Image xipImage bootpImage uImage +INSTALL_TARGETS = zinstall uinstall install + +PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) + +$(BOOT_TARGETS): vmlinux $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@ -zinstall uinstall install: vmlinux +$(INSTALL_TARGETS): $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ %.dtb: | scripts diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile index 84aa2ca..ec2f806 100644 --- a/arch/arm/boot/Makefile +++ b/arch/arm/boot/Makefile @@ -95,24 +95,24 @@ initrd: @test "$(INITRD)" != "" || \ (echo You must specify INITRD; exit -1) -install: $(obj)/Image - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ +install: + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ $(obj)/Image System.map "$(INSTALL_PATH)" -zinstall: $(obj)/zImage - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ +zinstall: + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ $(obj)/zImage System.map "$(INSTALL_PATH)" -uinstall: $(obj)/uImage - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ +uinstall: + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ $(obj)/uImage System.map "$(INSTALL_PATH)" zi: - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ $(obj)/zImage System.map "$(INSTALL_PATH)" i: - $(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \ + $(CONFIG_SHELL) $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" \ $(obj)/Image System.map "$(INSTALL_PATH)" subdir- := bootp compressed dts diff --git a/arch/arm/boot/install.sh b/arch/arm/boot/install.sh index 06ea7d4..2a45092 100644 --- a/arch/arm/boot/install.sh +++ b/arch/arm/boot/install.sh @@ -20,6 +20,20 @@ # $4 - default install path (blank if root directory) # +verify () { + if [ ! -f "$1" ]; then + echo "" 1>&2 + echo " *** Missing file: $1" 1>&2 + echo ' *** You need to run "make" before "make install".' 1>&2 + echo "" 1>&2 + exit 1 + fi +} + +# Make sure the files actually exist +verify "$2" +verify "$3" + # User may have a custom install script if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi