RISC-V: add kexec_load support for vmlinuz
Subsystems (3)
PATCH 1/1 RISC-V: add kexec_load support for vmlinuz
Copy arm64 code and change for riscv so that the kexec -c can load a vmlinuz image.
--- kexec/arch/riscv/Makefile | 1 + kexec/arch/riscv/image-header.h | 12 +++ kexec/arch/riscv/kexec-riscv.c | 1 + kexec/arch/riscv/kexec-riscv.h | 6 ++ kexec/arch/riscv/kexec-vmlinuz-riscv.c | 112 +++++++++++++++++++++++++ 5 files changed, 132 insertions(+) create mode 100644 kexec/arch/riscv/kexec-vmlinuz-riscv.c
kexec/arch/riscv/Makefile +1 -0
@@ -4,6 +4,7 @@ riscv_KEXEC_SRCS = kexec/arch/riscv/crashdump-riscv.c riscv_KEXEC_SRCS += kexec/arch/riscv/kexec-elf-riscv.c riscv_KEXEC_SRCS += kexec/arch/riscv/kexec-image-riscv.c +riscv_KEXEC_SRCS += kexec/arch/riscv/kexec-vmlinuz-riscv.c riscv_KEXEC_SRCS += kexec/arch/riscv/kexec-riscv.c riscv_DT_OPS += kexec/dt-ops.c
kexec/arch/riscv/image-header.h +12 -0
@@ -85,4 +85,16 @@ static inline uint64_t riscv_header_image_size(const struct riscv_image_header * return le64toh(h->image_size); } +static const uint8_t riscv_image_pe_sig[2 ] = {'M' ,'Z' }; +static const uint8_t riscv_pe_machtype[6 ] = {'P' ,'E' ,0x0 ,0x0 ,0x64 ,0x50 }; + +static inline int riscv_header_check_pe_sig (const struct riscv_image_header *h) +{ +if (!h) +return 0 ; + +return (*((char *)&(h->code0)) == riscv_image_pe_sig[0 ] && + *((char *)&(h->code0) +1 ) == riscv_image_pe_sig[1 ]); +} +#endif
kexec/arch/riscv/kexec-riscv.c +1 -0
@@ -34,6 +34,7 @@ const struct arch_map_entry arches[] = {struct file_type file_type[] = { {"elf-riscv" , elf_riscv_probe, elf_riscv_load, elf_riscv_usage}, {"image-riscv" , image_riscv_probe, image_riscv_load, image_riscv_usage}, + {"vmlinuz-riscv" , pez_riscv_probe, pez_riscv_load, pez_riscv_usage}, };int file_types =sizeof (file_type) /sizeof (file_type[0 ]);
kexec/arch/riscv/kexec-riscv.h +6 -0
@@ -51,3 +51,9 @@ int image_riscv_probe(const char *buf, off_t len);void image_riscv_usage (void );int image_riscv_load (int argc,char **argv,const char *buf,off_t len,struct kexec_info *info); + +/* kexec-vmlinuz-riscv.c */ +int pez_riscv_probe (const char *buf,off_t len); +void pez_riscv_usage (void ); +int pez_riscv_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info);
kexec/arch/riscv/kexec-vmlinuz-riscv.c new file +112 -0
112 lines not on this page · raw message
Signature · 1 line
2.47.0
Simon Horman
AppliedQuoted 4 lines · Tao Liu
Copy arm64 code and change for riscv so that the kexec -c can load a vmlinuz image.
Signed-off-by Tao Liu <[email protected]>
Thanks, applied.
Quoted 7 lines · Simon Horman
Quoted 4 lines · Tao Liu
Copy arm64 code and change for riscv so that the kexec -c can load a vmlinuz image.
Signed-off-by Tao Liu <[email protected]>Thanks, applied.
... here:
- RISC-V: add kexec_load support for vmlinuz
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=771e89dc104e
Hi Simon,
Quoted 6 lines · Simon Horman
Quoted 4 lines · Simon Horman
Quoted 3 lines · Tao Liu
Copy arm64 code and change for riscv so that the kexec -c can load a vmlinuz image.
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Tao Liu <[email protected]>Thanks, applied.
... here:
- RISC-V: add
kexec_loadsupport for vmlinuz
https://git.kernel.org/pub/scm/utils/kernel/kexec/kexec-tools.git/commit/?id=771e89dc104e
Thanks a lot for that! :)
Thanks,
Tao Liu