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
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 {
_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec