kexec-tools: mips: support big-endian mips
Subsystems (2)
PATCH 1/1 kexec-tools: mips: support big-endian mips
Hi,
this patch switches the mips support in kexec-tools around a little bit. All the files and directories containing "mipsel" have been renamed to contain "mips" instead.
This is kind of consistent with the way that ARCH=mips in the kernel works for both big and little endian.
After a small amount of tweaking, which is also included in this patch, the code compiles and works fine for big endian mips as well as small endian mips. All you need to do is compile using an appropriate compiler.
That is to say, kexec-tools's build system doesn't need to be told about which endienness the code is being compiled for.
I have added kept mipsel as a supported "architecture" via ./configure, though its just an alias for mips now. This is consistent with how other architectures such as sh are treated. But I'm happy to remove mipsel from ./configure if the mips people want that.
I tested this patch using qemu and the 2.6.24.3 tag of the mips-2.6 git tree compiled for the qemu machine type for both big and little endian. The qemu machine type has subsequently been removed, and kexec-tools needs some work in order to function with qemu - as far as I understand the way the boot parameters are passed needs to be fixed, likely in purgatory. However, this is not related to the changes introduced in this patch.
I intend to merge this patch into kexec-tools-testing if no alarm bells are sounded.
---
configure.ac | 5 kexec/Makefile | 2 kexec/arch/mips/Makefile | 12 + kexec/arch/mips/include/arch/options.h | 11 + kexec/arch/mips/kexec-elf-mips.c | 183 +++++++++++++++++++++++++++++ kexec/arch/mips/kexec-elf-rel-mips.c | 42 ++++++ kexec/arch/mips/kexec-mips.c | 188 ++++++++++++++++++++++++++++++ kexec/arch/mips/kexec-mips.h | 17 ++ kexec/arch/mips/mips-setup-simple.S | 110 +++++++++++++++++ kexec/arch/mipsel/Makefile | 12 - kexec/arch/mipsel/include/arch/options.h | 11 - kexec/arch/mipsel/kexec-elf-mipsel.c | 183 ----------------------------- kexec/arch/mipsel/kexec-elf-rel-mipsel.c | 42 ------ kexec/arch/mipsel/kexec-mipsel.c | 188 ------------------------------ kexec/arch/mipsel/kexec-mipsel.h | 17 -- kexec/arch/mipsel/mipsel-setup-simple.S | 110 ----------------- kexec/kexec-syscall.h | 2 purgatory/Makefile | 2 purgatory/arch/mips/Makefile | 11 + purgatory/arch/mips/console-mips.c | 5 purgatory/arch/mips/purgatory-mips.c | 7 + purgatory/arch/mips/purgatory-mips.h | 6 purgatory/arch/mipsel/Makefile | 11 - purgatory/arch/mipsel/console-mipsel.c | 5 purgatory/arch/mipsel/purgatory-mipsel.c | 7 - purgatory/arch/mipsel/purgatory-mipsel.h | 6 26 files changed, 599 insertions(+), 596 deletions(-)
configure.ac +4 -1
@@ -38,7 +38,10 @@ case $target_cpu in sh4|sh4a|sh3|sh ) ARCH="sh" ;; - ia64|x86_64|alpha|mipsel ) + mips|mipsel ) + ARCH="mips" + ;; + ia64|x86_64|alpha ) ARCH="$target_cpu" ;; * )
kexec/kexec-syscall.h +1 -1
@@ -49,7 +49,7 @@#ifdef __arm__#define __NR_kexec_load __NR_SYSCALL_BASE + 347#endif -#ifdef __MIPSEL__ +#if defined(__mips__)#define __NR_kexec_load 4311#endif #ifndef __NR_kexec_load
kexec/Makefile +1 -1
@@ -33,7 +33,7 @@ include $(srcdir)/kexec/arch/alpha/Makef include $(srcdir)/kexec/arch/arm/Makefile include $(srcdir)/kexec/arch/i386/Makefile include $(srcdir)/kexec/arch/ia64/Makefile -include $(srcdir)/kexec/arch/mipsel/Makefile +include $(srcdir)/kexec/arch/mips/Makefile include $(srcdir)/kexec/arch/ppc/Makefile include $(srcdir)/kexec/arch/ppc64/Makefile include $(srcdir)/kexec/arch/s390/Makefile
kexec/arch/mips/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# +# kexec mips (linux booting linux) +# +mips_KEXEC_SRCS = kexec/arch/mips/kexec-mips.c +mips_KEXEC_SRCS += kexec/arch/mips/kexec-elf-mips.c +mips_KEXEC_SRCS += kexec/arch/mips/kexec-elf-rel-mips.c +mips_KEXEC_SRCS += kexec/arch/mips/mips-setup-simple.S + +dist += kexec/arch/mips/Makefile $(mips_KEXEC_SRCS) \ + kexec/arch/mips/kexec-mips.h \ + kexec/arch/mips/include/arch/options.h +
kexec/arch/mips/include/arch/options.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef KEXEC_ARCH_MIPS_OPTIONS_H +#define KEXEC_ARCH_MIPS_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_MIPS_OPTIONS_H */
kexec/arch/mips/kexec-elf-mips.c new file +183 -0
183 lines not on this page · raw message
kexec/arch/mips/kexec-elf-rel-mips.c new file +42 -0
42 lines not on this page · raw message
kexec/arch/mips/kexec-mips.c new file +188 -0
188 lines not on this page · raw message
kexec/arch/mips/kexec-mips.h new file +17 -0
@@ -0,0 +1,17 @@ +#ifndef KEXEC_MIPS_H +#define KEXEC_MIPS_H + +extern unsigned char setup_simple_start[]; +extern uint32_t setup_simple_size; + +extern struct { +uint32_t spr8; +uint32_t spr9; +} setup_simple_regs; + +int elf_mips_probe (const char *buf,off_t len); +int elf_mips_load (int argc,char **argv,const char *buf,off_t len, +struct kexec_info *info); +void elf_mips_usage (void ); + +#endif /* KEXEC_MIPS_H */
kexec/arch/mips/mips-setup-simple.S new file +110 -0
110 lines not on this page · raw message
kexec/arch/mipsel/Makefile deleted +0 -12
@@ -1,12 +0,0 @@ -# -# kexec mipsel (linux booting linux) -# -mipsel_KEXEC_SRCS = kexec/arch/mipsel/kexec-mipsel.c -mipsel_KEXEC_SRCS += kexec/arch/mipsel/kexec-elf-mipsel.c -mipsel_KEXEC_SRCS += kexec/arch/mipsel/kexec-elf-rel-mipsel.c -mipsel_KEXEC_SRCS += kexec/arch/mipsel/mipsel-setup-simple.S - -dist += kexec/arch/mipsel/Makefile $(mipsel_KEXEC_SRCS) \ - kexec/arch/mipsel/kexec-mipsel.h \ - kexec/arch/mipsel/include/arch/options.h -
kexec/arch/mipsel/include/arch/options.h deleted +0 -11
@@ -1,11 +0,0 @@ -#ifndef KEXEC_ARCH_MIPS_OPTIONS_H -#define KEXEC_ARCH_MIPS_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_MIPS_OPTIONS_H */
kexec/arch/mipsel/kexec-elf-mipsel.c deleted +0 -183
183 lines not on this page · raw message
kexec/arch/mipsel/kexec-elf-rel-mipsel.c deleted +0 -42
42 lines not on this page · raw message
kexec/arch/mipsel/kexec-mipsel.c deleted +0 -188
188 lines not on this page · raw message
kexec/arch/mipsel/kexec-mipsel.h deleted +0 -17
@@ -1,17 +0,0 @@ -#ifndef KEXEC_MIPS_H -#define KEXEC_MIPS_H - -extern unsigned char setup_simple_start[]; -extern uint32_t setup_simple_size; - -extern struct { -uint32_t spr8; -uint32_t spr9; -} setup_simple_regs; - -int elf_mipsel_probe (const char *buf,off_t len); -int elf_mipsel_load (int argc,char **argv,const char *buf,off_t len, -struct kexec_info *info); -void elf_mipsel_usage (void ); - -#endif /* KEXEC_MIPS_H */
kexec/arch/mipsel/mipsel-setup-simple.S deleted +0 -110
110 lines not on this page · raw message
purgatory/Makefile +1 -1
@@ -20,7 +20,7 @@ include $(srcdir)/purgatory/arch/alpha/M include $(srcdir)/purgatory/arch/arm/Makefile include $(srcdir)/purgatory/arch/i386/Makefile include $(srcdir)/purgatory/arch/ia64/Makefile -include $(srcdir)/purgatory/arch/mipsel/Makefile +include $(srcdir)/purgatory/arch/mips/Makefile include $(srcdir)/purgatory/arch/ppc/Makefile include $(srcdir)/purgatory/arch/ppc64/Makefile include $(srcdir)/purgatory/arch/s390/Makefile
purgatory/arch/mips/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# +# Purgatory mips +# + +mips_PURGATORY_SRCS+= purgatory/arch/mips/purgatory-mips.c +mips_PURGATORY_SRCS+= purgatory/arch/mips/console-mips.c + +dist += purgatory/arch/mips/Makefile $(mips_PURGATORY_C_SRCS) \ + purgatory/arch/mips/include/limits.h \ + purgatory/arch/mips/purgatory-mips.h +
purgatory/arch/mips/console-mips.c new file +5 -0
@@ -0,0 +1,5 @@ +#include <purgatory.h> +void putchar (int ch) +{ +/* Nothing for now */ +}
purgatory/arch/mips/purgatory-mips.c new file +7 -0
@@ -0,0 +1,7 @@ +#include <purgatory.h> +#include "purgatory-mips.h" + +void setup_arch (void ) +{ +/* Nothing for now */ +}
purgatory/arch/mips/purgatory-mips.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef PURGATORY_MIPSEL_H +#define PURGATORY_MIPSEL_H + +/* nothing yet */ + +#endif /* PURGATORY_MIPSEL_H */
purgatory/arch/mipsel/Makefile deleted +0 -11
@@ -1,11 +0,0 @@ -# -# Purgatory mipsel -# - -mipsel_PURGATORY_C_SRCS+= purgatory/arch/mipsel/purgatory-mipsel.c -mipsel_PURGATORY_C_SRCS+= purgatory/arch/mipsel/console-mipsel.c - -dist += purgatory/arch/mipsel/Makefile $(mipsel_PURGATORY_C_SRCS) \ - purgatory/arch/mipsel/include/limits.h \ - purgatory/arch/mipsel/purgatory-mipsel.h -
purgatory/arch/mipsel/console-mipsel.c deleted +0 -5
@@ -1,5 +0,0 @@ -#include <purgatory.h> -void putchar (int ch) -{ -/* Nothing for now */ -}
purgatory/arch/mipsel/purgatory-mipsel.c deleted +0 -7
@@ -1,7 +0,0 @@ -#include <purgatory.h> -#include "purgatory-mipsel.h" - -void setup_arch (void ) -{ -/* Nothing for now */ -}
purgatory/arch/mipsel/purgatory-mipsel.h deleted +0 -6
@@ -1,6 +0,0 @@ -#ifndef PURGATORY_MIPSEL_H -#define PURGATORY_MIPSEL_H - -/* nothing yet */ - -#endif /* PURGATORY_MIPSEL_H */
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec