From patchwork Sun Apr 7 10:43:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 161915 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp2507795jan; Sun, 7 Apr 2019 03:44:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqz84cIFf4Ig9Q+D4aET6qh9RQQbEVneBSBYSYzCLqW4ZdmBJqls/WL9/OSmfhPThywqz2t5 X-Received: by 2002:a63:4101:: with SMTP id o1mr21297441pga.17.1554633867112; Sun, 07 Apr 2019 03:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554633867; cv=none; d=google.com; s=arc-20160816; b=b5Kwf1+L+4T5qnFcMsb0HPPR19gXfkhH3AAZdFm1MkG4rCZ9NmSHR4JFxPYQssKk6P RUMw/4A0KjbZIfl4M20rIYbv6gQIvBbOJdpu5OkAw11gFQXvpyeM6y6VBzbtCMyjB1qz RVw+Y7rNPvmPAyC6iqI64nLk9jpv9D9rOkzTsWVziPIoWcKiqI/LKKWGW6lh/+XKTgTK +VNni60ezJtdpym7G7W3DeGlezm1oor10EFbBA0I+WpxiSfgRIM3Ms15qb3BQNTyXTGu Hkt70bjnc1627FO65I688R/petjXHyDpRriX9rl65OJjH1VPurAzMfXkzP1nLDEQKEUO cL/w== 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=NqfLefqeMtb7bISR8Nkb4quVom6OPYx9k0dm6zvdMLo=; b=rZJUBJacz5w/E6Uyi/J52CJbAcPjwBDVaTYccE6PL1x/3nVK7bU//+YmkiwGdvx9h8 t/86hKOkuIeCTjt48Z943KceobwRdkrXiOx+sPeIpv5JB6GkGYA9I07USwwpriGcnxZ7 mhnuuFadWXb1fRMI0XYP5lLumXN6S+siKXqnv8A7TV7GOjGwDEkC4hLPNnpuDiSx5xTP 1/mMekGFkLRLZmh+nvNsmC4B88yp6NUQy6FQN0JV7H37IJ4RMNUXrKoSI5T3a421I7aw yNFWjV+TB8DOVxigP+lmGyGOM7eKl24JlmkGm8W2dt9jselkNVSF/t+6hVu+CJaPp/vT 8YVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=AUGrk78a; 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 f2si23677061pgv.441.2019.04.07.03.44.26; Sun, 07 Apr 2019 03:44:27 -0700 (PDT) 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=AUGrk78a; 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 S1726468AbfDGKoY (ORCPT + 31 others); Sun, 7 Apr 2019 06:44:24 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:31486 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726199AbfDGKoX (ORCPT ); Sun, 7 Apr 2019 06:44:23 -0400 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-08.nifty.com with ESMTP id x37Ai14J006181; Sun, 7 Apr 2019 19:44:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com x37Ai14J006181 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1554633842; bh=NqfLefqeMtb7bISR8Nkb4quVom6OPYx9k0dm6zvdMLo=; h=From:To:Cc:Subject:Date:From; b=AUGrk78a8R7x2eTQzU5epZhlT+BqblHxmJPpTWvx6eUB+Oj6xGWIKsUC59/iyilAW kJLOyj4RE1yflrmYAe8rXAcyRblLecycOVLCfAiRxvUQnQuWpduM0cdZZ1J3bzHvRa 5d8Q/Yd48ar4sfbYQMUr1ua+ExMua8AcsN/vkfm00nqwGoLtXcVSTnCpMXCrdLrdj5 dms7EHcZm/VdQnUe4SHg5vi3fysFbHUX8WY+u2LBqGfuFhyikjSML+dE/hXX6sj50Y 7b/01YfFcJOzsm9qmh2nRU2RzmtKjZHGrUC6W17GoNOmS26Bgu5379uA2uGqr/PYh+ kFtbPGl1wUBAg== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH] kbuild: check arch/$(SRCARCH)/include/generated before out-of-tree build Date: Sun, 7 Apr 2019 19:43:51 +0900 Message-Id: <1554633831-10303-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 After cross-compiling the kernel, "make mrproper" should be executed with the proper ARCH= option. Otherwise, stale objects will remain under arch/$(SRCARCH)/. One bad scenario is like this: $ make ARCH=arm defconfig all # cross-compile the kernel for arm $ make mrproper # mrproper for host-arch (i.e. x86) $ make ARCH=arm O=build_dir defconfig all If you miss ARCH= for mrproper and cross-compile the kernel with O= and ARCH= options, Kbuild will happily start to build, but may fail due to stale objects in the srctree. If $(srctree)/arch/$(SRCARCH)/include/generated/ exists, let's stop the out-of-tree build. To detect this, mrproper should clean only arch/$(SRCARCH)/include/generated/. Signed-off-by: Masahiro Yamada --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 10643c3..17945ce 100644 --- a/Makefile +++ b/Makefile @@ -1091,7 +1091,9 @@ PHONY += prepare archprepare prepare1 prepare3 prepare3: include/config/kernel.release ifneq ($(srctree),.) @$(kecho) ' Using $(srctree) as source for kernel' - $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ + $(Q)if [ -f $(srctree)/.config -o \ + -d $(srctree)/include/config -o \ + -d $(srctree)/arch/$(SRCARCH)/include/generated ]; then \ echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ echo >&2 " in the '$(srctree)' directory.";\ /bin/false; \ @@ -1350,7 +1352,7 @@ CLEAN_DIRS += $(MODVERDIR) include/ksym # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config usr/include include/generated \ - arch/*/include/generated .tmp_objdiff + arch/$(SRCARCH)/include/generated .tmp_objdiff MRPROPER_FILES += .config .config.old .version \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ signing_key.pem signing_key.priv signing_key.x509 \