summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2008-03-17 10:25:43 +0900
committerSimon Horman <horms@verge.net.au>2008-03-18 11:34:44 +0900
commit3973e307e10c865712ad59b3f609e27f1e2bddfc (patch)
treeb1fbee6624b7763278fd92ab243a9ecee0b37177
parentbbe2590b0b03240ff54cb24b563e9a853b6dd4a2 (diff)
kexec-tools: mips: support big-endian mips (repost)
[ Reposted with correct linux-mips address ] 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. Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--configure.ac5
-rw-r--r--kexec/Makefile2
-rw-r--r--kexec/arch/mips/Makefile12
-rw-r--r--kexec/arch/mips/include/arch/options.h (renamed from kexec/arch/mipsel/include/arch/options.h)0
-rw-r--r--kexec/arch/mips/kexec-elf-mips.c (renamed from kexec/arch/mipsel/kexec-elf-mipsel.c)10
-rw-r--r--kexec/arch/mips/kexec-elf-rel-mips.c (renamed from kexec/arch/mipsel/kexec-elf-rel-mipsel.c)2
-rw-r--r--kexec/arch/mips/kexec-mips.c (renamed from kexec/arch/mipsel/kexec-mipsel.c)14
-rw-r--r--kexec/arch/mips/kexec-mips.h (renamed from kexec/arch/mipsel/kexec-mipsel.h)6
-rw-r--r--kexec/arch/mips/mips-setup-simple.S (renamed from kexec/arch/mipsel/mipsel-setup-simple.S)2
-rw-r--r--kexec/arch/mipsel/Makefile12
-rw-r--r--kexec/kexec-syscall.h2
-rw-r--r--purgatory/Makefile2
-rw-r--r--purgatory/arch/mips/Makefile11
-rw-r--r--purgatory/arch/mips/console-mips.c (renamed from purgatory/arch/mipsel/console-mipsel.c)0
-rw-r--r--purgatory/arch/mips/purgatory-mips.c (renamed from purgatory/arch/mipsel/purgatory-mipsel.c)2
-rw-r--r--purgatory/arch/mips/purgatory-mips.h (renamed from purgatory/arch/mipsel/purgatory-mipsel.h)0
-rw-r--r--purgatory/arch/mipsel/Makefile11
17 files changed, 48 insertions, 45 deletions
diff --git a/configure.ac b/configure.ac
index 7b62974..321ddea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"
;;
* )
diff --git a/kexec/Makefile b/kexec/Makefile
index d08280f..cf6f043 100644
--- a/kexec/Makefile
+++ b/kexec/Makefile
@@ -33,7 +33,7 @@ include $(srcdir)/kexec/arch/alpha/Makefile
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
diff --git a/kexec/arch/mips/Makefile b/kexec/arch/mips/Makefile
new file mode 100644
index 0000000..8cba55e
--- /dev/null
+++ b/kexec/arch/mips/Makefile
@@ -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
+
diff --git a/kexec/arch/mipsel/include/arch/options.h b/kexec/arch/mips/include/arch/options.h
index bc5f706..bc5f706 100644
--- a/kexec/arch/mipsel/include/arch/options.h
+++ b/kexec/arch/mips/include/arch/options.h
diff --git a/kexec/arch/mipsel/kexec-elf-mipsel.c b/kexec/arch/mips/kexec-elf-mips.c
index 6642260..8220829 100644
--- a/kexec/arch/mipsel/kexec-elf-mipsel.c
+++ b/kexec/arch/mips/kexec-elf-mips.c
@@ -1,5 +1,5 @@
/*
- * kexec-elf-mipsel.c - kexec Elf loader for mips
+ * kexec-elf-mips.c - kexec Elf loader for mips
* Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
* Copyright (C) 2007 Tvblob s.r.l.
*
@@ -26,7 +26,7 @@
#include <ip_checksum.h>
#include "../../kexec.h"
#include "../../kexec-elf.h"
-#include "kexec-mipsel.h"
+#include "kexec-mips.h"
#include <arch/options.h>
static const int probe_debug = 0;
@@ -72,7 +72,7 @@ static struct boot_notes {
#define OPT_APPEND (OPT_ARCH_MAX+0)
-int elf_mipsel_probe(const char *buf, off_t len)
+int elf_mips_probe(const char *buf, off_t len)
{
struct mem_ehdr ehdr;
@@ -97,7 +97,7 @@ int elf_mipsel_probe(const char *buf, off_t len)
return result;
}
-void elf_mipsel_usage(void)
+void elf_mips_usage(void)
{
printf(" --command-line=STRING Set the kernel command line to "
"STRING.\n"
@@ -105,7 +105,7 @@ void elf_mipsel_usage(void)
"STRING.\n");
}
-int elf_mipsel_load(int argc, char **argv, const char *buf, off_t len,
+int elf_mips_load(int argc, char **argv, const char *buf, off_t len,
struct kexec_info *info)
{
struct mem_ehdr ehdr;
diff --git a/kexec/arch/mipsel/kexec-elf-rel-mipsel.c b/kexec/arch/mips/kexec-elf-rel-mips.c
index 2dda30a..6442fb9 100644
--- a/kexec/arch/mipsel/kexec-elf-rel-mipsel.c
+++ b/kexec/arch/mips/kexec-elf-rel-mips.c
@@ -1,5 +1,5 @@
/*
- * kexec-elf-rel-mipsel.c - kexec Elf relocation routines
+ * kexec-elf-rel-mips.c - kexec Elf relocation routines
* Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
* Copyright (C) 2007 Tvblob s.r.l.
*
diff --git a/kexec/arch/mipsel/kexec-mipsel.c b/kexec/arch/mips/kexec-mips.c
index 3aca5bd..b17a20b 100644
--- a/kexec/arch/mipsel/kexec-mipsel.c
+++ b/kexec/arch/mips/kexec-mips.c
@@ -1,9 +1,9 @@
/*
- * kexec-mipsel.c - kexec for mips
+ * kexec-mips.c - kexec for mips
* Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
* Copyright (C) 2007 Tvblob s.r.l.
*
- * derived from ../ppc/kexec-mipsel.c
+ * derived from ../ppc/kexec-mips.c
* Copyright (C) 2004, 2005 Albert Herranz
*
* This source code is licensed under the GNU General Public License,
@@ -19,7 +19,7 @@
#include <sys/utsname.h>
#include "../../kexec.h"
#include "../../kexec-syscall.h"
-#include "kexec-mipsel.h"
+#include "kexec-mips.h"
#include <arch/options.h>
#define MAX_MEMORY_RANGES 64
@@ -92,7 +92,7 @@ int get_memory_ranges(struct memory_range **range, int *ranges, unsigned long ke
}
struct file_type file_type[] = {
- {"elf-mipsel", elf_mipsel_probe, elf_mipsel_load, elf_mipsel_usage},
+ {"elf-mips", elf_mips_probe, elf_mips_load, elf_mips_usage},
};
int file_types = sizeof(file_type) / sizeof(file_type[0]);
@@ -152,7 +152,7 @@ void arch_update_purgatory(struct kexec_info *info)
}
/*
- * Adding a dummy function, so that build on mipsel will not break.
+ * Adding a dummy function, so that build on mips will not break.
* Need to implement the actual checking code
*/
int is_crashkernel_mem_reserved(void)
@@ -166,7 +166,7 @@ unsigned long virt_to_phys(unsigned long addr)
}
/*
- * add_segment() should convert base to a physical address on mipsel,
+ * add_segment() should convert base to a physical address on mips,
* while the default is just to work with base as is */
void add_segment(struct kexec_info *info, const void *buf, size_t bufsz,
unsigned long base, size_t memsz)
@@ -175,7 +175,7 @@ void add_segment(struct kexec_info *info, const void *buf, size_t bufsz,
}
/*
- * add_buffer() should convert base to a physical address on mipsel,
+ * add_buffer() should convert base to a physical address on mips,
* while the default is just to work with base as is */
unsigned long add_buffer(struct kexec_info *info, const void *buf,
unsigned long bufsz, unsigned long memsz,
diff --git a/kexec/arch/mipsel/kexec-mipsel.h b/kexec/arch/mips/kexec-mips.h
index 2fbe5a9..13f82be 100644
--- a/kexec/arch/mipsel/kexec-mipsel.h
+++ b/kexec/arch/mips/kexec-mips.h
@@ -9,9 +9,9 @@ extern struct {
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,
+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_mipsel_usage(void);
+void elf_mips_usage(void);
#endif /* KEXEC_MIPS_H */
diff --git a/kexec/arch/mipsel/mipsel-setup-simple.S b/kexec/arch/mips/mips-setup-simple.S
index 94df5c6..1acdee3 100644
--- a/kexec/arch/mipsel/mipsel-setup-simple.S
+++ b/kexec/arch/mips/mips-setup-simple.S
@@ -1,5 +1,5 @@
/*
- * mipsel-setup-simple.S - code to execute before kernel to handle command line
+ * mips-setup-simple.S - code to execute before kernel to handle command line
* Copyright (C) 2007 Francesco Chiechi, Alessandro Rubini
* Copyright (C) 2007 Tvblob s.r.l.
*
diff --git a/kexec/arch/mipsel/Makefile b/kexec/arch/mipsel/Makefile
deleted file mode 100644
index a5a41d7..0000000
--- a/kexec/arch/mipsel/Makefile
+++ /dev/null
@@ -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
-
diff --git a/kexec/kexec-syscall.h b/kexec/kexec-syscall.h
index 5c44110..d12a11c 100644
--- a/kexec/kexec-syscall.h
+++ b/kexec/kexec-syscall.h
@@ -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
diff --git a/purgatory/Makefile b/purgatory/Makefile
index 6103544..6c747b1 100644
--- a/purgatory/Makefile
+++ b/purgatory/Makefile
@@ -20,7 +20,7 @@ include $(srcdir)/purgatory/arch/alpha/Makefile
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
diff --git a/purgatory/arch/mips/Makefile b/purgatory/arch/mips/Makefile
new file mode 100644
index 0000000..9ec0c8b
--- /dev/null
+++ b/purgatory/arch/mips/Makefile
@@ -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
+
diff --git a/purgatory/arch/mipsel/console-mipsel.c b/purgatory/arch/mips/console-mips.c
index 389b7be..389b7be 100644
--- a/purgatory/arch/mipsel/console-mipsel.c
+++ b/purgatory/arch/mips/console-mips.c
diff --git a/purgatory/arch/mipsel/purgatory-mipsel.c b/purgatory/arch/mips/purgatory-mips.c
index f8780de..cb25bf7 100644
--- a/purgatory/arch/mipsel/purgatory-mipsel.c
+++ b/purgatory/arch/mips/purgatory-mips.c
@@ -1,5 +1,5 @@
#include <purgatory.h>
-#include "purgatory-mipsel.h"
+#include "purgatory-mips.h"
void setup_arch(void)
{
diff --git a/purgatory/arch/mipsel/purgatory-mipsel.h b/purgatory/arch/mips/purgatory-mips.h
index c57b402..c57b402 100644
--- a/purgatory/arch/mipsel/purgatory-mipsel.h
+++ b/purgatory/arch/mips/purgatory-mips.h
diff --git a/purgatory/arch/mipsel/Makefile b/purgatory/arch/mipsel/Makefile
deleted file mode 100644
index c6e0580..0000000
--- a/purgatory/arch/mipsel/Makefile
+++ /dev/null
@@ -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
-