mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] imd: add optional endianness= parameter for bi-endian systems
@ 2022-02-10 13:46 Antony Pavlov
  2022-02-11 10:35 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Antony Pavlov @ 2022-02-10 13:46 UTC (permalink / raw)
  To: barebox

MIPS architecture supports both little- and big-endian modes.
It's handy to have means to determine endianness of barebox
image. This patch adds necessary record into imd block.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 common/Kconfig       |  6 ++++++
 common/imd-barebox.c | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index 667b0a1e79..f8d99bd48c 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -730,6 +730,12 @@ config IMD
 	select CRC32
 	bool "barebox metadata support"
 
+config IMD_ENDIANNESS
+	bool "add endianness record to metadata"
+	depends on IMD
+	depends on SYS_SUPPORTS_LITTLE_ENDIAN && SYS_SUPPORTS_BIG_ENDIAN
+	default y
+
 choice
 	prompt "console support"
 	default CONSOLE_FULL
diff --git a/common/imd-barebox.c b/common/imd-barebox.c
index e11fdca845..7877c8de39 100644
--- a/common/imd-barebox.c
+++ b/common/imd-barebox.c
@@ -23,6 +23,16 @@ __BAREBOX_IMD_SECTION(.barebox_imd_end) = {
 	.type = cpu_to_le32(IMD_TYPE_END),
 };
 
+#ifdef CONFIG_IMD_ENDIANNESS
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+#define IMD_ENDIANNESS "little"
+#else
+#define IMD_ENDIANNESS "big"
+#endif
+BAREBOX_IMD_TAG_STRING(imd_endianness_tag, IMD_TYPE_PARAMETER,
+			"endianness=" IMD_ENDIANNESS, 1);
+#endif /* CONFIG_IMD_ENDIANNESS */
+
 BAREBOX_IMD_TAG_STRING(imd_build_tag, IMD_TYPE_BUILD, UTS_VERSION, 1);
 BAREBOX_IMD_TAG_STRING(imd_release_tag, IMD_TYPE_RELEASE, UTS_RELEASE, 1);
 BAREBOX_IMD_TAG_STRING(imd_buildsystem_version_tag, IMD_TYPE_BUILDSYSTEM, BUILDSYSTEM_VERSION, 1);
-- 
2.33.0


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] imd: add optional endianness= parameter for bi-endian systems
  2022-02-10 13:46 [PATCH] imd: add optional endianness= parameter for bi-endian systems Antony Pavlov
@ 2022-02-11 10:35 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-02-11 10:35 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox

On Thu, Feb 10, 2022 at 04:46:39PM +0300, Antony Pavlov wrote:
> MIPS architecture supports both little- and big-endian modes.
> It's handy to have means to determine endianness of barebox
> image. This patch adds necessary record into imd block.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  common/Kconfig       |  6 ++++++
>  common/imd-barebox.c | 10 ++++++++++
>  2 files changed, 16 insertions(+)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-11 10:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 13:46 [PATCH] imd: add optional endianness= parameter for bi-endian systems Antony Pavlov
2022-02-11 10:35 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox