From patchwork Fri Sep 28 06:49:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 147783 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp373491lji; Thu, 27 Sep 2018 23:51:16 -0700 (PDT) X-Google-Smtp-Source: ACcGV60jCnkIWwU+/0zndKaCTOrxdE3G6Y7E2xwhM37f7Lp+PHn1fEzSudaMEMjhVFA0hBfJ1R3H X-Received: by 2002:a17:902:7084:: with SMTP id z4-v6mr5440104plk.236.1538117476769; Thu, 27 Sep 2018 23:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538117476; cv=none; d=google.com; s=arc-20160816; b=dDEiQH+kFO3G2Ayfjz3rc+o1/MtXCILD0J6Su2jPneJnQanzVyCuej6XymS+4kBzIV woMPu/l8hpHg4GKGtobKBdAIGMFStD7Ejvu1IvAZhWQysdSdhEeXzgccm/CQ8YpOkN2i QxytdUvGFNhj2za5z32pvJkyFQUpvl5bhK4Vv5WuzKHZGDrCeZkFwvdfgSdQhBgGae50 aTWg+HQTOy27aFPRyvZzT9RqMl0/pzSP8c9ZwrUAAles/6pPdiAoG5s/SLey1NsA4jpG CE3Gcjjm4cUKNiKbV/v4TEJ+8NCtJhFEF8vJS8xpCSf2ofpfmCczkbxqQWob2EUhebMF HH5Q== 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=+jgLJg3F8cUQ4dmT7mf0GMqljUEbkw8vKA4jmhEStJI=; b=DrNCsgdQRVIUBK0KONtuqXCv+mo8XdXwxEm1hNaZSWZi2mphEk7iAwS4M6BmsdpqIp HCpnlfHXQca0t4sNYxeRguMfLNP7I3+mzWYpgvbb1DGAcuvYptEoXG4LEh0uaAB8BdIJ WsTqnun9wzKHS54/z6lrTMTdw2d4PuyzOCv4KfEkuIwGSZzPn+4FjgmcPihYQdKz9Xwd IRjhHtAjnhCcS3IonjME/h9WSKy+LWS9Zx8Q8qmz3d/j2P4BgnRJFEfFzTknlPEi2ZTY LeWPyBUz9NyZ9jV61gTY64GzKpoGG6ERiTepG2q+bZfm6JsJ1pLQasaLswTDCA6PByNX E5gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=GCvLOxuh; 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 e12-v6si3981221pfn.322.2018.09.27.23.51.16; Thu, 27 Sep 2018 23:51:16 -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=GCvLOxuh; 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 S1729008AbeI1NN3 (ORCPT + 32 others); Fri, 28 Sep 2018 09:13:29 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:55053 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728765AbeI1NN3 (ORCPT ); Fri, 28 Sep 2018 09:13:29 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w8S6oBTF027595; Fri, 28 Sep 2018 15:50:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w8S6oBTF027595 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1538117412; bh=+jgLJg3F8cUQ4dmT7mf0GMqljUEbkw8vKA4jmhEStJI=; h=From:To:Cc:Subject:Date:From; b=GCvLOxuhpaTfpMm0kaXLvCOP7aOBsbLnqy6/63r2j8wJ70i6/0Sb9QXwLxBWIOn2P 1AWLNUpzX8L0mOAJjhP0xvBouRk0+k4HFFPFFbRcbBw8F6SrZeprSi/ryTsgeXVMqe FegAv4iPjPOOUSsJj+kiQq+96+xT9hKVRPZMyKiEn2iJWWiLL2DTnxNgB1csCEceMI Vdzyb9fNwyznynN57Q6HPdR160V61jeb/jmTQvFr0t1SL2SA7+6z3dnPekBg5tzOuF R+w338tFD1wQXqutInZBfHZ6Hal0FLgYoq6PAEFqn7Z/7xTPcNhQ35VN3JW13E3+Uv k/uDDVpyX1GTg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: David Howells , Kees Cook , Richard Weinberger , Jeff Dike , Masahiro Yamada , Bjorn Andersson , Arnd Bergmann , linux-kernel@vger.kernel.org, Michal Marek , Andy Gross , Alex Williamson , Gerd Hoffmann Subject: [PATCH] samples: run headers_install for host arch instead of target arch Date: Fri, 28 Sep 2018 15:49:48 +0900 Message-Id: <1538117388-11945-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 Some samples search headers in $(objtree)/usr/include, which is made available by "make headers_install". It is not kernel-space code but host programs that need this header search path. Commit 3fca1700c4c3 ("kbuild: make samples really depend on headers_install") is wrong because it installs headers of the target architecture. Besides, UML fails to build with CONFIG_SAMPLES=y because UML does not support headers_install. Invoke "make headers_install" for the _host_ architecture in the prepare stage. Introduce CONFIG_HOST_HEADERS_INSTALL so that this happens only for samples that need it. I also removed 'Documentation/: headers_install', which I guess is stale code. Fixes: 3fca1700c4c3 ("kbuild: make samples really depend on headers_install") Signed-off-by: Masahiro Yamada Cc: David Howells --- Makefile | 8 ++++---- samples/Kconfig | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/Makefile b/Makefile index 0c90c43..f04564c 100644 --- a/Makefile +++ b/Makefile @@ -1029,10 +1029,9 @@ ifdef CONFIG_GDB_SCRIPTS endif +$(call if_changed,link-vmlinux) -# Build samples along the rest of the kernel. This needs headers_install. +# Build samples along the rest of the kernel. ifdef CONFIG_SAMPLES vmlinux-dirs += samples -samples: headers_install endif # The actual objects are generated when descending, @@ -1098,6 +1097,9 @@ archprepare: archheaders archscripts prepare1 scripts_basic prepare0: archprepare gcc-plugins $(Q)$(MAKE) $(build)=. +ifdef CONFIG_HOST_HEADERS_INSTALL + $(Q)$(MAKE) -f $(srctree)/Makefile ARCH=$(SUBARCH) headers_install +endif # All the preparing.. prepare: prepare0 prepare-objtool @@ -1682,8 +1684,6 @@ endif $(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) \ diff --git a/samples/Kconfig b/samples/Kconfig index bd133ef..fcd6b7c 100644 --- a/samples/Kconfig +++ b/samples/Kconfig @@ -1,3 +1,6 @@ +config HOST_HEADERS_INSTALL + bool + menuconfig SAMPLES bool "Sample kernel code" help @@ -95,6 +98,7 @@ config SAMPLE_CONFIGFS config SAMPLE_CONNECTOR tristate "Build connector sample -- loadable modules only" depends on CONNECTOR && m + select HOST_HEADERS_INSTALL help When enabled, this builds both a sample kernel module for the connector interface and a user space tool to communicate @@ -104,6 +108,7 @@ config SAMPLE_CONNECTOR config SAMPLE_SECCOMP tristate "Build seccomp sample code -- loadable modules only" depends on SECCOMP_FILTER && m + select HOST_HEADERS_INSTALL help Build samples of seccomp filters using various methods of BPF filter construction. @@ -149,6 +154,7 @@ config SAMPLE_VFIO_MDEV_MBOCHS config SAMPLE_STATX bool "Build example extended-stat using code" depends on BROKEN + select HOST_HEADERS_INSTALL help Build example userspace program to use the new extended-stat syscall.