From patchwork Mon Apr 19 20:54:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Peter Anvin" X-Patchwork-Id: 12212753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE2A7C433B4 for ; Mon, 19 Apr 2021 21:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5FE6613AE for ; Mon, 19 Apr 2021 21:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233068AbhDSViy (ORCPT ); Mon, 19 Apr 2021 17:38:54 -0400 Received: from terminus.zytor.com ([198.137.202.136]:60677 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbhDSVix (ORCPT ); Mon, 19 Apr 2021 17:38:53 -0400 X-Greylist: delayed 2559 seconds by postgrey-1.27 at vger.kernel.org; Mon, 19 Apr 2021 17:38:53 EDT Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8602:8be0:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 13JKslbW2399793 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 19 Apr 2021 13:54:58 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 13JKslbW2399793 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021032801; t=1618865698; bh=s4Q4KeT+aEE/OwsAE9aacFN8BXDaHZAzNphILgcRt3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B7wFVncMlEl0LsPcexbIIrru/6YdcNhrI1+H/ipS4EgVGRDPG4xJoVlovV6+ROBxn PqarEgDrRLLusc6s1YPTZU5VGh/4ljnHsZp+61ZAjZhInE/ZTIsZ6DQ6vPoFh+D/Y2 Tvoe4MgUjtaiqXqS0kX+kCK1cCuswq/FmFBP0/EBvCTH4VnuJUrw5QK/jYJBBzeeAY e6IZ/eT75GXBXDcGp26YB04XbsBpKJycWH7xAPHABw67YkJeBWHE5BssI2LywuTMQB WZtU8DdE4SZ9ga4pJajaisaH2R7pqaQUOM88NcmtpqEiyrWdpp9SUS4YT6hS1R+Z7j HkPm/omtydE/g== From: "H. Peter Anvin" To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Alexander Viro , Masahiro Yamada , Michal Marek Cc: Linux Kernel Mailing List , Kbuild Mailing List , "H. Peter Anvin" Subject: [PATCH 3/3] x86/boot: Add option to add modules.img to {fd,hd,iso}image Date: Mon, 19 Apr 2021 13:54:38 -0700 Message-Id: <20210419205438.1531413-4-hpa@zytor.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419205438.1531413-1-hpa@zytor.com> References: <20210419205438.1531413-1-hpa@zytor.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org From: "H. Peter Anvin" (Intel) Make it easy to generate a disk image which includes the all-modules initramfs image. Signed-off-by: H. Peter Anvin (Intel) --- arch/x86/Makefile | 3 ++- arch/x86/boot/Makefile | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 943f26a32834..74f4e66568d7 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -309,7 +309,8 @@ define archhelp echo ' isoimage - Create a boot CD-ROM image (arch/x86/boot/image.iso)' echo ' bzdisk/fdimage*/hdimage/isoimage also accept:' echo ' FDARGS="..." arguments for the booted kernel' - echo ' FDINITRD=file initrd for the booted kernel' + echo ' FDINITRD=file initrd for the booted kernel' + echo ' FDMODS=1 to include all modules as an initrd' echo '' echo ' kvm_guest.config - Enable Kconfig items for running this kernel as a KVM guest' echo ' xen.config - Enable Kconfig items for running this kernel as a Xen guest' diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index dfbc26a8e924..601ade7adc70 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -119,9 +119,20 @@ $(obj)/compressed/vmlinux: FORCE FDARGS = # Set this if you want one or more initrds included in the image FDINITRD = +# Set this to 1 if you want usr/modules.img included in the image +FDMODS = imgdeps = $(obj)/bzImage $(obj)/mtools.conf $(src)/genimage.sh +ifneq ($(FDMODS),) +imgdeps += $(objtree)/usr/modules.img +FDINITRD += $(objtree)/usr/modules.img + +$(objtree)/usr/modules.img: + $(Q)$(MAKE) -f $(srctree)/Makefile usr/modules.img +KBUILD_MODULES := 1 +endif + $(obj)/mtools.conf: $(src)/mtools.conf.in sed -e 's|@OBJ@|$(obj)|g' < $< > $@