All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	Borislav Petkov <bp@alien8.de>, Andy Lutomirski <luto@kernel.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Kbuild Mailing List <linux-kbuild@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
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	[thread overview]
Message-ID: <20210419205438.1531413-4-hpa@zytor.com> (raw)
In-Reply-To: <20210419205438.1531413-1-hpa@zytor.com>

From: "H. Peter Anvin" (Intel) <hpa@zytor.com>

Make it easy to generate a disk image which includes the all-modules
initramfs image.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
---
 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' < $< > $@
 
-- 
2.30.2


      parent reply	other threads:[~2021-04-19 20:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 20:54 [PATCH 0/3] x86 disk image and modules initramfs generation H. Peter Anvin
2021-04-19 20:54 ` [PATCH 1/3] x86/boot: Modernize genimage script; hdimage support; remove bzlilo H. Peter Anvin
2021-04-19 20:54 ` [PATCH 2/3] usr, modules: Add build target for creating a modules initramfs image H. Peter Anvin
2021-04-19 20:54 ` H. Peter Anvin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419205438.1531413-4-hpa@zytor.com \
    --to=hpa@zytor.com \
    --cc=bp@alien8.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.