From: Pingfan Liu <piliu@redhat.com>
To: kexec@lists.infradead.org
Cc: Pingfan Liu <piliu@redhat.com>, Dave Young <dyoung@redhat.com>,
horms@verge.net.au, ardb@kernel.org, jeremy.linton@arm.com
Subject: [PATCHv7 2/5] kexec: Introduce a member kernel_fd in kexec_info
Date: Thu, 3 Aug 2023 10:41:49 +0800 [thread overview]
Message-ID: <20230803024152.11663-3-piliu@redhat.com> (raw)
In-Reply-To: <20230803024152.11663-1-piliu@redhat.com>
Utilize the image load interface to export the kernel fd, which points
to the uncompressed kernel and will be passed to kexec_file_load.
The credit goes to the Dave Young, who contributes the original code.
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Co-authored-by: Dave Young <dyoung@redhat.com>
To: kexec@lists.infradead.org
Cc: horms@verge.net.au
Cc: ardb@kernel.org
Cc: jeremy.linton@arm.com
---
kexec/kexec.c | 8 ++++++++
kexec/kexec.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/kexec/kexec.c b/kexec/kexec.c
index d132eb5..c3b182e 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1292,6 +1292,7 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
info.kexec_flags = flags;
info.file_mode = 1;
+ info.kernel_fd = -1;
info.initrd_fd = -1;
if (!is_kexec_file_load_implemented())
@@ -1337,6 +1338,13 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
return ret;
}
+ /*
+ * image type specific load functioin detect the capsule kernel type
+ * and create another fd for file load. For example the zboot kernel.
+ */
+ if (info.kernel_fd != -1)
+ kernel_fd = info.kernel_fd;
+
/*
* If there is no initramfs, set KEXEC_FILE_NO_INITRAMFS flag so that
* kernel does not return error with negative initrd_fd.
diff --git a/kexec/kexec.h b/kexec/kexec.h
index 0d820ad..ed3b499 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -164,6 +164,7 @@ struct kexec_info {
unsigned long file_mode :1;
/* Filled by kernel image processing code */
+ int kernel_fd;
int initrd_fd;
char *command_line;
int command_line_len;
--
2.31.1
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2023-08-03 2:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-03 2:41 [PATCHv7 0/5] arm64: zboot support Pingfan Liu
2023-08-03 2:41 ` [PATCHv7 1/5] kexec/arm64: Simplify the code for zImage Pingfan Liu
2023-08-07 13:21 ` Simon Horman
2023-08-07 13:26 ` Dave Young
2023-08-10 12:11 ` Simon Horman
2023-08-11 0:31 ` Dave Young
2023-08-03 2:41 ` Pingfan Liu [this message]
2023-08-11 1:23 ` [PATCHv7 2/5] kexec: Introduce a member kernel_fd in kexec_info Dave Young
2023-08-03 2:41 ` [PATCHv7 3/5] kexec/zboot: Add arch independent zboot support Pingfan Liu
2023-08-07 13:22 ` Simon Horman
2023-08-07 15:22 ` Pingfan Liu
2023-08-03 2:41 ` [PATCHv7 4/5] arm64: Add ZBOOT PE containing compressed image support Pingfan Liu
2023-08-03 2:41 ` [PATCHv7 5/5] arm64: Hook up the ZBOOT support as vmlinuz Pingfan Liu
2023-08-11 7:29 ` [PATCHv7 0/5] arm64: zboot support Simon Horman
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=20230803024152.11663-3-piliu@redhat.com \
--to=piliu@redhat.com \
--cc=ardb@kernel.org \
--cc=dyoung@redhat.com \
--cc=horms@verge.net.au \
--cc=jeremy.linton@arm.com \
--cc=kexec@lists.infradead.org \
/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