kexec: uImage tidying and SH support.
Subsystems (2)
PATCH 1/1 kexec: uImage tidying and SH support.
Here is a trivial patch series for tidying up the uImage support a bit as well as wiring it up on SH. Nothing terribly exciting, just a bit of refactoring and updating. In addition to testing on SH, it's also been compile tested on ARM, which at present is the only other platform that makes use of this code.
The patch series can be pulled directly from:
git://github.com/pmundt/kexec-tools-sh.git sh/uImage
Which contains:
Paul Mundt (3):
kexec: Move the uImage header to a better place.
kexec: Bring the uImage definitions in sync with upstream.
kexec-sh: uImage support.
include/Makefile | 1 + .../arch/arm/kexec-uImage-arm.h => include/image.h | 41 ++++++++++--------- kexec/arch/arm/Makefile | 1 - kexec/arch/arm/kexec-uImage-arm.c | 2 +- kexec/arch/sh/Makefile | 1 + kexec/arch/sh/kexec-sh.c | 9 +++- kexec/arch/sh/kexec-sh.h | 4 ++ kexec/arch/sh/kexec-uImage-sh.c | 35 +++++++++++++++++ 8 files changed, 70 insertions(+), 24 deletions(-) rename kexec/arch/arm/kexec-uImage-arm.h => include/image.h (85%) create mode 100644 kexec/arch/sh/kexec-uImage-sh.c
---
And here is the patch, for reference.
include/Makefile +1 -0
@@ -5,6 +5,7 @@ dist += include/Makefile \ include/x86/mb_info.h \ include/x86/mb_header.h \ include/elf.h \ + include/image.h \ include/boot/linuxbios_tables.h \ include/boot/beoboot.h \ include/boot/elf_boot.h
include/image.h new file +164 -0
164 lines not on this page · raw message
kexec/arch/arm/Makefile +0 -1
@@ -8,5 +8,4 @@ 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-uImage-arm.c +1 -1
@@ -4,9 +4,9 @@#include <stdint.h> #include <string.h> #include <sys/types.h> +#include <image.h> #include "../../kexec.h" #include "kexec-arm.h" -#include "kexec-uImage-arm.h" int uImage_arm_probe (const char *buf,off_t len) {
kexec/arch/arm/kexec-uImage-arm.h deleted +0 -161
161 lines not on this page · raw message
kexec/arch/sh/Makefile +1 -0
@@ -2,6 +2,7 @@ # kexec sh (linux booting linux) # sh_KEXEC_SRCS += kexec/arch/sh/kexec-sh.c +sh_KEXEC_SRCS += kexec/arch/sh/kexec-uImage-sh.c sh_KEXEC_SRCS += kexec/arch/sh/kexec-zImage-sh.c sh_KEXEC_SRCS += kexec/arch/sh/kexec-netbsd-sh.c sh_KEXEC_SRCS += kexec/arch/sh/kexec-elf-sh.c
kexec/arch/sh/kexec-sh.c +6 -3
@@ -73,9 +73,12 @@ int get_memory_ranges(struct memory_range **range, int *ranges,/* Supported file types and callbacks */ struct file_type file_type[] = { - {"zImage-sh" , zImage_sh_probe, zImage_sh_load, zImage_sh_usage}, - {"elf-sh" , elf_sh_probe, elf_sh_load, elf_sh_usage}, - {"netbsd-sh" , netbsd_sh_probe, netbsd_sh_load, netbsd_sh_usage}, +/* uImage is probed before zImage because the latter also accepts +uncompressed images. */ + {"uImage-sh" , uImage_sh_probe, uImage_sh_load, zImage_sh_usage }, + {"zImage-sh" , zImage_sh_probe, zImage_sh_load, zImage_sh_usage }, + {"elf-sh" , elf_sh_probe, elf_sh_load, elf_sh_usage }, + {"netbsd-sh" , netbsd_sh_probe, netbsd_sh_load, netbsd_sh_usage }, };int file_types =sizeof (file_type) /sizeof (file_type[0 ]);
kexec/arch/sh/kexec-sh.h +4 -0
@@ -3,6 +3,10 @@#define COMMAND_LINE_SIZE 2048 +int uImage_sh_probe (const char *buf,off_t len); +int uImage_sh_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info); +int zImage_sh_probe (const char *buf,off_t len);int zImage_sh_load (int argc,char **argv,const char *buf,off_t len,struct kexec_info *info);
kexec/arch/sh/kexec-uImage-sh.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* uImage support added by Marc Andre Tanner <[email protected]> +* +* Cloned from ARM by Paul Mundt, 2009. +*/ +#include <stdint.h> +#include <string.h> +#include <sys/types.h> +#include <image.h> +#include "../../kexec.h" +#include "kexec-sh.h" + +int uImage_sh_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_sh_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info) +{ +return zImage_sh_load (argc, argv, buf +sizeof (struct image_header ), + len -sizeof (struct image_header ), info); +}
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 8 lines · Paul Mundt
Here is a trivial patch series for tidying up the uImage support a bit as well as wiring it up on SH. Nothing terribly exciting, just a bit of refactoring and updating. In addition to testing on SH, it's also been compile tested on ARM, which at present is the only other platform that makes use of this code.
The patch series can be pulled directly from:
Quoted 8 lines
git://github.com/pmundt/kexec-tools-sh.gitsh/uImageWhich contains:
Paul Mundt (3):
kexec: Move the uImage header to a better place.
kexec: Bring the uImage definitions in sync with upstream.
kexec-sh: uImage support.
Thanks Paul, pulled and pushed up to kernel.org.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec