Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] fitImage support on ARM64
@ 2018-06-12 13:35 Arnaud Ferraris
  2018-06-14  5:50 ` Bhupesh Sharma
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaud Ferraris @ 2018-06-12 13:35 UTC (permalink / raw)
  To: kexec; +Cc: horms

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

Hi,

I started working on implementing fitImage support in kexec.

Regarding image parsing & loading, things are going quite well, but I 
realized the only way to load a device tree and/or initramfs for now was 
to have them stored in files separated from the kernel.

I came up with a solution that requires appending new fields to the 
kexec_info structure (see attached patch), and wonder if that sounds 
right to you ? I guess other architectures might benefit from this 
support, so I didn't want an ARM64-specific solution.

Any comment will be welcome !

Regards,
Arnaud

[-- Attachment #2: kexec-arm64-fitimage-loading.patch --]
[-- Type: text/x-patch, Size: 1308 bytes --]

diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
index 62f3758..5888a6c 100644
--- a/kexec/arch/arm64/kexec-arm64.c
+++ b/kexec/arch/arm64/kexec-arm64.c
@@ -544,6 +544,10 @@ int arm64_load_other_segments(struct kexec_info *info,
 	if (arm64_opts.dtb) {
 		dtb.name = "dtb_user";
 		dtb.buf = slurp_file(arm64_opts.dtb, &dtb.size);
+	} else if (info->dtb) {
+		dtb.name = "dtb_fit";
+		dtb.buf = info->dtb;
+		dtb.size = info->dtb_size;
 	} else {
 		result = read_1st_dtb(&dtb);

@@ -568,8 +572,13 @@ int arm64_load_other_segments(struct kexec_info *info,
 	else
 		hole_max = ULONG_MAX;

-	if (arm64_opts.initrd) {
-		initrd_buf = slurp_file(arm64_opts.initrd, &initrd_size);
+	if (arm64_opts.initrd || info->initrd) {
+		if (arm64_opts.initrd)
+			initrd_buf = slurp_file(arm64_opts.initrd, &initrd_size);
+		else {
+			initrd_buf = info->initrd;
+			initrd_size = info->initrd_size;
+		}

 		if (!initrd_buf)
 			fprintf(stderr, "kexec: Empty ramdisk file.\n");
diff --git a/kexec/kexec.h b/kexec/kexec.h
index d445fbe..9ac1537 100644
--- a/kexec/kexec.h
+++ b/kexec/kexec.h
@@ -166,6 +166,10 @@ struct kexec_info {
 	int initrd_fd;
 	char *command_line;
 	int command_line_len;
+	char *initrd;
+	off_t initrd_size;
+	char *dtb;
+	off_t dtb_size;
 };

 struct arch_map_entry {

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-14 13:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-12 13:35 [RFC] fitImage support on ARM64 Arnaud Ferraris
2018-06-14  5:50 ` Bhupesh Sharma
2018-06-14 13:52   ` Arnaud Ferraris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox