Add ARM support to kexec
Subsystems (2)
PATCH 1/1 Add ARM support to kexec
Add ARM support to kexec including commandline support through ATAGs. The kernel syscall support has already been merged and kernel ATAG exporting is queued for 2.6.25 (its optional for kexec).
Based on work by various people, notably Uli Luckas <[email protected]> for adding ATAG support.
configure.ac +3 -0
@@ -29,6 +29,9 @@ case $target_cpu in powerpc64 ) ARCH="ppc64" ;; + arm* ) + ARCH="arm" + ;; s390x|s390 ) ARCH="s390" ;;
kexec/arch/arm/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# kexec arm (linux booting linux) +# +KEXEC_SRCS+= kexec/arch/arm/kexec-elf-rel-arm.c +KEXEC_SRCS+= kexec/arch/arm/kexec-zImage-arm.c +KEXEC_SRCS+= kexec/arch/arm/kexec-arm.c
kexec/arch/arm/include/arch/options.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef KEXEC_ARCH_ARM_OPTIONS_H +#define KEXEC_ARCH_ARM_OPTIONS_H + +#define OPT_ARCH_MAX (OPT_MAX+0) + +#define KEXEC_ARCH_OPTIONS \ + KEXEC_OPTIONS \ + +#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" + +#endif /* KEXEC_ARCH_ARM_OPTIONS_H */
kexec/arch/arm/kexec-arm.c new file +142 -0
143 lines not on this page · raw message
kexec/arch/arm/kexec-arm.h new file +9 -0
@@ -0,0 +1,9 @@ +#ifndef KEXEC_ARM_H +#define KEXEC_ARM_H + +int zImage_arm_probe (const char *buf,off_t len); +int zImage_arm_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info); +void zImage_arm_usage (void ); + +#endif /* KEXEC_ARM_H */
kexec/arch/arm/kexec-elf-rel-arm.c new file +35 -0
@@ -0,0 +1,35 @@ +#include <stdio.h> +#include <elf.h> +#include "../../kexec.h" +#include "../../kexec-elf.h" + +int machine_verify_elf_rel (struct mem_ehdr *ehdr) +{ +if (ehdr->ei_data !=ELFDATA2MSB ) { +return 0 ; + } +if (ehdr->ei_class !=ELFCLASS32 ) { +return 0 ; + } +if (ehdr->e_machine !=EM_ARM ) + { +return 0 ; + } +return 1 ; +} + +void machine_apply_elf_rel (struct mem_ehdr *ehdr,unsigned long r_type, +void *location,unsigned long address,unsigned long value) +{ +switch (r_type) { +case R_ARM_ABS32 : + *((uint32_t *)location) += value; +break ; +case R_ARM_REL32 : + *((uint32_t *)location) += value - address; +break ; +default : +die ("Unknown rel relocation: %lu\n" , r_type); +break ; + } +}
kexec/arch/arm/kexec-zImage-arm.c new file +279 -0
279 lines not on this page · raw message
kexec/kexec-syscall.h +4 -0
@@ -46,6 +46,9 @@#ifdef __s390__#define __NR_kexec_load 277#endif +#ifdef __arm__ +#define __NR_kexec_load __NR_SYSCALL_BASE + 347 +#endif #ifndef __NR_kexec_load#error Unknown processor architecture. Needs a kexec_load syscall number.#endif
@@ -77,6 +80,7 @@ static inline long kexec_reboot(void)#define KEXEC_ARCH_PPC64 (21 << 16)#define KEXEC_ARCH_IA_64 (50 << 16)#define KEXEC_ARCH_S390 (22 << 16) +#define KEXEC_ARCH_ARM (40 << 16)#define KEXEC_MAX_SEGMENTS 16
purgatory/arch/arm/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# +# Purgatory arm +# + +PURGATORY_SRCS += +
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 6 lines · Richard Purdie
Add ARM support to kexec including commandline support through ATAGs. The kernel syscall support has already been merged and kernel ATAG exporting is queued for 2.6.25 (its optional for kexec).
Based on work by various people, notably Uli Luckas <[email protected]> for adding ATAG support.
Thanks, that looks quite nice indeed. Applied.
Signature · 7 lines
Horms _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec