From patchwork Wed Jun 3 13:34:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Zeiger X-Patchwork-Id: 11585695 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6493D1392 for ; Wed, 3 Jun 2020 13:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56BDD20772 for ; Wed, 3 Jun 2020 13:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725905AbgFCNeH (ORCPT ); Wed, 3 Jun 2020 09:34:07 -0400 Received: from mail.talpidae.net ([176.9.32.230]:47889 "EHLO node0.talpidae.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbgFCNeG (ORCPT ); Wed, 3 Jun 2020 09:34:06 -0400 Received: by node0.talpidae.net (mail.talpidae.net, from userid 33) id 59E6D92D28C; Wed, 3 Jun 2020 13:34:05 +0000 (UTC) To: Masahiro Yamada Subject: [PATCH v2] Makefile: install modules.builtin even if CONFIG_MODULES=n X-PHP-Originating-Script: 0:rcube.php MIME-Version: 1.0 Date: Wed, 03 Jun 2020 15:34:05 +0200 From: Jonas Zeiger Cc: Linux Kbuild mailing list , Michal Marek Organization: talpidae.net In-Reply-To: References: <288d045f9429fc4cfd9ffb244e1be2f8@talpidae.net> Message-ID: <3cd1a050fe692425352745672295033c@talpidae.net> X-Sender: jonas.zeiger@talpidae.net User-Agent: Roundcube Webmail/1.2.3 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Many applications check for available kernel features via: - /proc/modules (loaded modules, present if CONFIG_MODULES=y) - $(MODLIB)/modules.builtin (builtin modules) They fail to detect features if the kernel was built with CONFIG_MODULES=n and modules.builtin isn't installed. Therefore, add the target "_builtin_inst_" and make "install" and "modules_install" depend on it. Tests results: - make install: kernel image is copied as before, modules.builtin copied - make modules_install: (CONFIG_MODULES=n) nothing is copied, exit 1 Signed-off-by: Jonas Zeiger --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a7bc91cbac8f..a160efd62897 100644 --- a/Makefile +++ b/Makefile @@ -1315,6 +1315,16 @@ dt_binding_check: scripts_dtc # --------------------------------------------------------------------------- # Modules +# install modules.builtin regardless of CONFIG_MODULES +PHONY += _builtin_inst_ +_builtin_inst_: + @mkdir -p $(MODLIB)/ + @cp -f modules.builtin $(MODLIB)/ + @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ + +PHONY += install +install: _builtin_inst_ + ifdef CONFIG_MODULES # By default, build modules as well @@ -1344,7 +1354,7 @@ PHONY += modules_install modules_install: _modinst_ _modinst_post PHONY += _modinst_ -_modinst_: +_modinst_: _builtin_inst_ @rm -rf $(MODLIB)/kernel @rm -f $(MODLIB)/source @mkdir -p $(MODLIB)/kernel @@ -1354,8 +1364,6 @@ _modinst_: ln -s $(CURDIR) $(MODLIB)/build ; \ fi @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order - @cp -f modules.builtin $(MODLIB)/ - @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst # This depmod is only for convenience to give the initial