kexec-arm: add uImage support
Subsystems (2)
PATCH 1/1 kexec-arm: add uImage support
uImages are basically just zImages with a special header, we therefore just skip the header and let the normal zImage infrastructure do the actual work.
--- kexec/arch/arm/Makefile | 2 + kexec/arch/arm/kexec-arm.c | 3 + kexec/arch/arm/kexec-arm.h | 4 + kexec/arch/arm/kexec-uImage-arm.c | 33 ++++++++ kexec/arch/arm/kexec-uImage-arm.h | 161 +++++++++++++++++++++++++++++++++++++ 5 files changed, 203 insertions(+), 0 deletions(-) create mode 100644 kexec/arch/arm/kexec-uImage-arm.c create mode 100644 kexec/arch/arm/kexec-uImage-arm.h
kexec/arch/arm/Makefile +2 -0
@@ -3,8 +3,10 @@ # arm_KEXEC_SRCS= kexec/arch/arm/kexec-elf-rel-arm.c arm_KEXEC_SRCS+= kexec/arch/arm/kexec-zImage-arm.c +arm_KEXEC_SRCS+= kexec/arch/arm/kexec-uImage-arm.c arm_KEXEC_SRCS+= kexec/arch/arm/kexec-arm.c dist += kexec/arch/arm/Makefile $(arm_KEXEC_SRCS) \ kexec/arch/arm/kexec-arm.h \ + kexec/arch/arm/kexec-uImage-arm.h \ kexec/arch/arm/include/arch/options.h
kexec/arch/arm/kexec-arm.c +3 -0
@@ -74,6 +74,9 @@ int get_memory_ranges(struct memory_range **range, int *ranges,/* Supported file types and callbacks */ struct file_type file_type[] = { +/* uImage is probed before zImage because the latter also accepts +uncompressed images. */ + {"uImage" , uImage_arm_probe, uImage_arm_load, zImage_arm_usage}, {"zImage" , zImage_arm_probe, zImage_arm_load, zImage_arm_usage}, };int file_types =sizeof (file_type) /sizeof (file_type[0 ]);
kexec/arch/arm/kexec-arm.h +4 -0
@@ -6,4 +6,8 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len, struct kexec_info *info);void zImage_arm_usage (void ); +int uImage_arm_probe (const char *buf,off_t len); +int uImage_arm_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info); +#endif /* KEXEC_ARM_H */
kexec/arch/arm/kexec-uImage-arm.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* uImage support added by Marc Andre Tanner <[email protected]> +*/ +#include <stdint.h> +#include <string.h> +#include <sys/types.h> +#include "../../kexec.h" +#include "kexec-arm.h" +#include "kexec-uImage-arm.h" + +int uImage_arm_probe (const char *buf,off_t len) +{ +struct image_header header; + +if (len <sizeof (header)) +return -1 ; + +memcpy (&header, buf,sizeof (header)); + +if (cpu_to_be32 (header.ih_magic) !=IH_MAGIC ) +return -1 ; + +/* XXX: check CRC Checksum? */ + +return 0 ; +} + +int uImage_arm_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info) +{ +return zImage_arm_load (argc, argv, buf +sizeof (struct image_header ), + len -sizeof (struct image_header ), info); +}
kexec/arch/arm/kexec-uImage-arm.h new file +161 -0
161 lines not on this page · raw message
Signature · 7 lines
1.6.5 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 3 lines · Marc Andre Tanner
uImages are basically just zImages with a special header, we therefore just skip the header and let the normal zImage infrastructure do the actual work.
This looks entirely reasonable to me.
Unless someone jumps in and comments
in the next few days I'll apply it.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 8 lines · Simon Horman
Quoted 3 lines · Marc Andre Tanner
uImages are basically just zImages with a special header, we therefore just skip the header and let the normal zImage infrastructure do the actual work.
This looks entirely reasonable to me.
Unless someone jumps in and comments
in the next few days I'll apply it.
I've gone ahead an applied this change.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 11 lines · Simon Horman
Quoted 8 lines · Simon Horman
Quoted 3 lines · Marc Andre Tanner
uImages are basically just zImages with a special header, we therefore just skip the header and let the normal zImage infrastructure do the actual work.
This looks entirely reasonable to me.
Unless someone jumps in and comments
in the next few days I'll apply it.I've gone ahead an applied this change.
Thanks,
Marc
Signature · 6 lines
Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Tested on armv5te. Works perfectly.
Already added to OpenEmbedded metadata.
Thanks!
Andrea
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec