From patchwork Thu Dec 19 18:32:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 182165 Delivered-To: patch@linaro.org Received: by 2002:a92:d0a:0:0:0:0:0 with SMTP id 10csp858833iln; Thu, 19 Dec 2019 10:43:58 -0800 (PST) X-Google-Smtp-Source: APXvYqxXq6f2AC2a3REUBjnJOUKB/j4exL7E4Q72g9M4nziz63Wz8doJc9FJbsq3Cr3efJ6iOAA4 X-Received: by 2002:a05:6830:2099:: with SMTP id y25mr9930430otq.87.1576781038631; Thu, 19 Dec 2019 10:43:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576781038; cv=none; d=google.com; s=arc-20160816; b=GSgPmi06Ns1oi9jVGIjWzG229IoI18ivgITtlfwAOz0VSRNbG6Dak+26ZzRyAjGkOi jnCtyM31XN6MuH7Ji5H2yOoDJJW8JGdAB0UpMesYYrsNFNNxGi2HLFG3fJB69VfExW9n AU8cTGIjNgmI6iktEgZL5OOlMtVH8sMRFC9wtDqCxSxCR+Xm2jEAp2bmrOL8y2v/Onf6 HZNFJ05I8H5iUjmLSGZ8yhyiYIsY+fZToEIZj9+4HyH+dBx3fUyCkrRIpVQGohpa7A1X tpIjBNHjK0c8pVcwXUW3gp4ff3W3yrTWDCURD/n12gWcisooya3bpUUz2x5FuL7QDki0 ahOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PqkM/3z6HLcxEC5eFmElEDFH+B2Mpbc5hvvzpeKGFrA=; b=v6HPHfUqlxgA0ObTzgGoAOiQ8pwKUDFKZf/Lc8JxXJxSJQwdmukw/S5LHSWF+qS2GH kQg8paVQF9+e73Oaue332d8YlrzR2tDp8jE+AD0kYfuoTcczWWqIga5KQy4P/lfAzA9M 7PIBoLhm15vIAKVGCinfAJPgu+KeuBNeecdxigBVoXPJ0fQlgHP1vyJdYt8CR0M6ooUk L4t0jY0xyTS3rIk6MXn7u7JXdkTBTG+sx/KYYT5FNuj3e3q4t3vM5PnTfoTtg3Rky21V ZTM9aepZEapJa9MA/tR/Gx7EnDGuL2vq4PEx4gx0L8K2DWcIRxzaxxGKZpeGVt6Fexjt J39A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UxKl6Srn; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 s22si3729952otq.10.2019.12.19.10.43.58; Thu, 19 Dec 2019 10:43:58 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-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=@kernel.org header.s=default header.b=UxKl6Srn; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728320AbfLSSn5 (ORCPT + 14 others); Thu, 19 Dec 2019 13:43:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:35792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728923AbfLSSn4 (ORCPT ); Thu, 19 Dec 2019 13:43:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2930C222C2; Thu, 19 Dec 2019 18:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576781036; bh=5c+/LOE4VJVhhZOOjd+xD/vKB1b/odbuOaqjEBdegP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UxKl6SrnktfWnF9log1T/B+97jvRGwCSrcQhOKKtaT0uWHBW3DIpk++DegTnOa5/M kdpZHBY6JqWuZS31bL/d00er/gqMdECS9sKyg3Nm9o6D8vD9z8ftwyGZ8GrhsDQRGi jBjWgWcvzsB1c8uDf+IUpc1DDkIHgYFMjgHkq3ME= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Sasha Levin Subject: [PATCH 4.9 057/199] kbuild: fix single target build for external module Date: Thu, 19 Dec 2019 19:32:19 +0100 Message-Id: <20191219183218.120498975@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191219183214.629503389@linuxfoundation.org> References: <20191219183214.629503389@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masahiro Yamada [ Upstream commit e07db28eea38ed4e332b3a89f3995c86b713cb5b ] Building a single target in an external module fails due to missing .tmp_versions directory. For example, $ make -C /lib/modules/$(uname -r)/build M=$PWD foo.o will fail in the following way: CC [M] /home/masahiro/foo/foo.o /bin/sh: 1: cannot create /home/masahiro/foo/.tmp_versions/foo.mod: Directory nonexistent This is because $(cmd_crmodverdir) is executed only before building /, %/, %.ko single targets of external modules. Create .tmp_versions in the 'prepare' target. Signed-off-by: Masahiro Yamada Signed-off-by: Sasha Levin --- Makefile | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) -- 2.20.1 diff --git a/Makefile b/Makefile index 55a91bc3d8f9c..6baf1e6324255 100644 --- a/Makefile +++ b/Makefile @@ -1521,9 +1521,6 @@ else # KBUILD_EXTMOD # We are always building modules KBUILD_MODULES := 1 -PHONY += crmodverdir -crmodverdir: - $(cmd_crmodverdir) PHONY += $(objtree)/Module.symvers $(objtree)/Module.symvers: @@ -1535,7 +1532,7 @@ $(objtree)/Module.symvers: module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) PHONY += $(module-dirs) modules -$(module-dirs): crmodverdir $(objtree)/Module.symvers +$(module-dirs): prepare $(objtree)/Module.symvers $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) modules: $(module-dirs) @@ -1576,7 +1573,8 @@ help: # Dummies... PHONY += prepare scripts -prepare: ; +prepare: + $(cmd_crmodverdir) scripts: ; endif # KBUILD_EXTMOD @@ -1701,17 +1699,14 @@ endif # Modules /: prepare scripts FORCE - $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) # Make sure the latest headers are built for Documentation Documentation/ samples/: headers_install %/: prepare scripts FORCE - $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) %.ko: prepare scripts FORCE - $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \ $(build)=$(build-dir) $(@:.ko=.o) $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost