Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
To: kexec@lists.infradead.org
Subject: [PATCH 4/6] mips: crashdump: add little-endian support
Date: Fri, 2 Dec 2016 10:49:09 +0100	[thread overview]
Message-ID: <1480672151-18503-5-git-send-email-marcin.nowakowski@imgtec.com> (raw)
In-Reply-To: <1480672151-18503-1-git-send-email-marcin.nowakowski@imgtec.com>

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@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


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2016-12-02  9:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02  9:49 [PATCH 0/6] Kexec fixes and updates for MIPS platforms Marcin Nowakowski
2016-12-02  9:49 ` [PATCH 1/6] mips: remove incorrect arch_usage string Marcin Nowakowski
2016-12-02  9:49 ` [PATCH 2/6] mips: use arch_options for both 32 and 64 bit variants Marcin Nowakowski
2016-12-02  9:49 ` [PATCH 3/6] mips: move arch option parsing from elf loader to common arch code Marcin Nowakowski
2016-12-02  9:49 ` Marcin Nowakowski [this message]
2016-12-02  9:49 ` [PATCH 5/6] mips: add dtb loading support Marcin Nowakowski
2016-12-02  9:49 ` [PATCH 6/6] mips: add option to load initrd from a specified file Marcin Nowakowski
2016-12-09  7:57 ` [PATCH 0/6] Kexec fixes and updates for MIPS platforms Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480672151-18503-5-git-send-email-marcin.nowakowski@imgtec.com \
    --to=marcin.nowakowski@imgtec.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox