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 (Intel)" <hpa@zytor.com>
Subject: [PATCH v2 3/3] x86/boot: Add option to add modules.img to {fd,hd,iso}image
Date: Mon, 19 Apr 2021 16:02:52 -0700 [thread overview]
Message-ID: <20210419230252.1583169-4-hpa@zytor.com> (raw)
In-Reply-To: <20210419230252.1583169-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 | 20 ++++++++++++++++----
2 files changed, 18 insertions(+), 5 deletions(-)
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..a4f8c66a63d0 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -116,11 +116,23 @@ $(obj)/compressed/vmlinux: FORCE
# Set this if you want to pass append arguments to the
# bzdisk/fdimage/hdimage/isoimage kernel
-FDARGS =
+FDARGS :=
# Set this if you want one or more initrds included in the image
-FDINITRD =
+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
+imgdeps := $(obj)/bzImage $(obj)/mtools.conf $(src)/genimage.sh
+fdinitrds := $(FDINITRD)
+
+ifneq ($(FDMODS),)
+imgdeps += $(objtree)/usr/modules.img
+fdinitrds += $(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' < $< > $@
@@ -131,7 +143,7 @@ targets += mtools.conf
# external dependencies.
quiet_cmd_genimage = GENIMAGE $3
cmd_genimage = $(BASH) $(srctree)/$(src)/genimage.sh $2 $3 $(obj)/bzImage \
- $(obj)/mtools.conf '$(FDARGS)' $(FDINITRD)
+ $(obj)/mtools.conf '$(FDARGS)' $(fdinitrds)
PHONY += bzdisk fdimage fdimage144 fdimage288 hdimage isoimage install
--
2.30.2
next prev parent reply other threads:[~2021-04-19 23:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 23:02 [PATCH 0/3] x86 disk image and modules initramfs generation H. Peter Anvin
2021-04-19 23:02 ` [PATCH v2 1/3] x86/boot: Modernize genimage script; hdimage support; remove bzlilo H. Peter Anvin
2021-04-19 23:02 ` [PATCH v2 2/3] usr, modules: Add build target for creating a modules initramfs image H. Peter Anvin
2021-04-22 18:55 ` Masahiro Yamada
2021-04-19 23:02 ` H. Peter Anvin [this message]
2021-04-20 8:30 ` [PATCH 0/3] x86 disk image and modules initramfs generation David Laight
2021-04-20 8:39 ` H. Peter Anvin
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=20210419230252.1583169-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®