From patchwork Wed Dec 11 15:05:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 181239 Delivered-To: patch@linaro.org Received: by 2002:ac9:44c4:0:0:0:0:0 with SMTP id t4csp916487och; Wed, 11 Dec 2019 07:22:40 -0800 (PST) X-Google-Smtp-Source: APXvYqz+LpERckWEa40ANaREuddpb7o4DdXyDPT4D23V2qLoYGe7JInYzEVsavp/EmSsn8RgA9lL X-Received: by 2002:a05:6808:8ed:: with SMTP id d13mr3038484oic.93.1576077759909; Wed, 11 Dec 2019 07:22:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576077759; cv=none; d=google.com; s=arc-20160816; b=fWZ3Mi8fU6m7Can/CSdMf7oz+cHm3d5+LZQhXqhbgzHir9ZKsXwmSlh99ENSaiBddD 9RT42KauDFZlLivhP4xNoBUBAy4C2Ubc7DkLU4m+Rr8hNapJHEZ9RXt7XIAatePeyc1a nUZDP1nsKWQ6pGdsKGAbTDrX+NfsaOGagFficAseQm+q6vl0O6lvWuxnIHknTb5eXXmf MTV2uiaMoIns5ir0gvbAIvRFXZAbtqwvgDoU7hoLX6fn7atMCH1hadeeAa/9qC+AF+f0 4dNKse+nWk/0/6paE/Fn4KgjysYW8mnTSNExXsZOu18s+klt2s4ZefMT6LbcWIkMdrQB 8nAQ== 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=2D5meARvVuI5WBzVX79tC6SmH9VtE1kawG/csoRvBGI=; b=FNnd3t9VyMNtwAkvFEbEDRX3NI/++YcXd80HBjQANmNuwFpI3SUd2hp4EM6ylhFsn6 fMlSmYpzgPyUYWIXCVr54Vhs/xwsI2NXC4L84uc4AZTsA6odPqBdyJkFnpBFvuwNPRdx wqpkVyc9Yxkoar6heFXO3f0Us5WG3hPqwQQxbxYCQXey9Yp79GeL5icJpvDMq8t9wb6t EISF32zlj/494X6P8V/TO/pacC/AZaPMj086VLGyRgWS9uq5Lym5ASY3KsCJ2Lr1xtKv 1G2uHRWduJtFLndr3ZxidHD66KHnMW8IBLvgobMx3acCtt7hpdJuqKULS4QaoS4H2pMP gwRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tDU8+U3G; 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 n137si1340735oig.127.2019.12.11.07.22.39; Wed, 11 Dec 2019 07:22:39 -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=@kernel.org header.s=default header.b=tDU8+U3G; 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 S1732158AbfLKPWi (ORCPT + 27 others); Wed, 11 Dec 2019 10:22:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:53378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732615AbfLKPWg (ORCPT ); Wed, 11 Dec 2019 10:22:36 -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 CA4FC2073D; Wed, 11 Dec 2019 15:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576077755; bh=Z5AqVrIC8GjWQ/SiK2JLzDiahAB4oiEWSlkGKafYMJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tDU8+U3GoVuWK2wSiTZhbvqehhnj2avQLSNBRYdp12anOCjDcm1iArSbQkyl/YB42 dVnuUDqbRnS8yjIy4tHLYOc9ybrkgJLVZgb8sxNAHc8ZNneD/yl0a42Gi4oXmV2vn6 Aaw44Y93WA/+HdhWUrpxCUbNLTHEouHmOj5j/BxM= 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.19 159/243] kbuild: fix single target build for external module Date: Wed, 11 Dec 2019 16:05:21 +0100 Message-Id: <20191211150349.899539555@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191211150339.185439726@linuxfoundation.org> References: <20191211150339.185439726@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 f9ebb74e8e43f..471acfc74998b 100644 --- a/Makefile +++ b/Makefile @@ -1507,9 +1507,6 @@ else # KBUILD_EXTMOD # We are always building modules KBUILD_MODULES := 1 -PHONY += crmodverdir -crmodverdir: - $(cmd_crmodverdir) PHONY += $(objtree)/Module.symvers $(objtree)/Module.symvers: @@ -1521,7 +1518,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) @@ -1562,7 +1559,8 @@ help: # Dummies... PHONY += prepare scripts -prepare: ; +prepare: + $(cmd_crmodverdir) scripts: ; endif # KBUILD_EXTMOD @@ -1689,17 +1687,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