[PATCH 4/6] mips: crashdump: add little-endian support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Elf header for crashdump has until now been hardcoded as big-endian.
Change that to use the native endianness for the compile target so that
the crashdumps are generated properly for each CPU type.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski at imgtec.com>
---
 kexec/arch/mips/crashdump-mips.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
index e56b3ef..278ee01 100644
--- a/kexec/arch/mips/crashdump-mips.c
+++ b/kexec/arch/mips/crashdump-mips.c
@@ -288,9 +288,17 @@ static int cmdline_add_elfcorehdr(char *cmdline, unsigned long addr)
 	return 0;
 }
 
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define ELFDATALOCAL ELFDATA2LSB
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define ELFDATALOCAL ELFDATA2MSB
+#else
+# error Unknown byte order
+#endif
+
 static struct crash_elf_info elf_info64 = {
 	class: ELFCLASS64,
-	data : ELFDATA2MSB,
+	data : ELFDATALOCAL,
 	machine : EM_MIPS,
 	page_offset : PAGE_OFFSET,
 	lowmem_limit : MAXMEM,
@@ -298,7 +306,7 @@ static struct crash_elf_info elf_info64 = {
 
 static struct crash_elf_info elf_info32 = {
 	class: ELFCLASS32,
-	data : ELFDATA2MSB,
+	data : ELFDATALOCAL,
 	machine : EM_MIPS,
 	page_offset : PAGE_OFFSET,
 	lowmem_limit : MAXMEM,
-- 
2.7.4




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux