mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] startup: introduce global.endianity variable
@ 2020-04-03 12:26 Antony Pavlov
  2020-04-03 12:39 ` Ahmad Fatoum
  0 siblings, 1 reply; 3+ messages in thread
From: Antony Pavlov @ 2020-04-03 12:26 UTC (permalink / raw)
  To: barebox

The global.endianity variable make it possible
to determine current endian mode from command
line or from script on bi-endian capable system.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
---
 common/globalvar.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/common/globalvar.c b/common/globalvar.c
index c87f2c9339..7632cb6418 100644
--- a/common/globalvar.c
+++ b/common/globalvar.c
@@ -591,6 +591,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)
 
 static int globalvar_init(void)
 {
+	const char *endianity;
+
 	register_device(&global_device);
 
 	if (IS_ENABLED(CONFIG_NVVAR))
@@ -598,11 +600,19 @@ static int globalvar_init(void)
 
 	globalvar_add_simple("version", UTS_RELEASE);
 
+	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
+		endianity = "big";
+	else
+		endianity = "little";
+
+	globalvar_add_simple("endianity", endianity);
+
 	return 0;
 }
 pure_initcall(globalvar_init);
 
 BAREBOX_MAGICVAR_NAMED(global_version, global.version, "The barebox version");
+BAREBOX_MAGICVAR_NAMED(global_endianity, global.endianity, "The barebox endianity");
 
 /**
  * nvvar_save - save NV variables to persistent environment
-- 
2.25.0


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

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

* Re: [PATCH] startup: introduce global.endianity variable
  2020-04-03 12:26 [PATCH] startup: introduce global.endianity variable Antony Pavlov
@ 2020-04-03 12:39 ` Ahmad Fatoum
  2020-04-06 12:12   ` Antony Pavlov
  0 siblings, 1 reply; 3+ messages in thread
From: Ahmad Fatoum @ 2020-04-03 12:39 UTC (permalink / raw)
  To: Antony Pavlov, barebox

Hi,

On 4/3/20 2:26 PM, Antony Pavlov wrote:
> The global.endianity variable make it possible

I'd prefer you call it endianness, as that's the term we are
using elsewhere in barebox.

(unless you've a good reason to introduce a new name,
 if so that should be part of the commit message)

Cheers
Ahmad

> to determine current endian mode from command
> line or from script on bi-endian capable system.
> 
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
>  common/globalvar.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/common/globalvar.c b/common/globalvar.c
> index c87f2c9339..7632cb6418 100644
> --- a/common/globalvar.c
> +++ b/common/globalvar.c
> @@ -591,6 +591,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)
>  
>  static int globalvar_init(void)
>  {
> +	const char *endianity;
> +
>  	register_device(&global_device);
>  
>  	if (IS_ENABLED(CONFIG_NVVAR))
> @@ -598,11 +600,19 @@ static int globalvar_init(void)
>  
>  	globalvar_add_simple("version", UTS_RELEASE);
>  
> +	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
> +		endianity = "big";
> +	else
> +		endianity = "little";
> +
> +	globalvar_add_simple("endianity", endianity);
> +
>  	return 0;
>  }
>  pure_initcall(globalvar_init);
>  
>  BAREBOX_MAGICVAR_NAMED(global_version, global.version, "The barebox version");
> +BAREBOX_MAGICVAR_NAMED(global_endianity, global.endianity, "The barebox endianity");
>  
>  /**
>   * nvvar_save - save NV variables to persistent environment
> 

-- 
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] 3+ messages in thread

* Re: [PATCH] startup: introduce global.endianity variable
  2020-04-03 12:39 ` Ahmad Fatoum
@ 2020-04-06 12:12   ` Antony Pavlov
  0 siblings, 0 replies; 3+ messages in thread
From: Antony Pavlov @ 2020-04-06 12:12 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Fri, 3 Apr 2020 14:39:27 +0200
Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:

Hi Ahmad,

You are right! There are several mentions of "endianness"
in current barebox codebase and there is no "endianity" mention.

I'll resend fixed patch soon.

-- 
Best regards,
  Antony Pavlov

> Hi,
> 
> On 4/3/20 2:26 PM, Antony Pavlov wrote:
> > The global.endianity variable make it possible
> 
> I'd prefer you call it endianness, as that's the term we are
> using elsewhere in barebox.
> 
> (unless you've a good reason to introduce a new name,
>  if so that should be part of the commit message)
> 
> Cheers
> Ahmad
> 
> > to determine current endian mode from command
> > line or from script on bi-endian capable system.
> > 
> > Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> > ---
> >  common/globalvar.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/common/globalvar.c b/common/globalvar.c
> > index c87f2c9339..7632cb6418 100644
> > --- a/common/globalvar.c
> > +++ b/common/globalvar.c
> > @@ -591,6 +591,8 @@ int globalvar_add_simple_ip(const char *name, IPaddr_t *ip)
> >  
> >  static int globalvar_init(void)
> >  {
> > +	const char *endianity;
> > +
> >  	register_device(&global_device);
> >  
> >  	if (IS_ENABLED(CONFIG_NVVAR))
> > @@ -598,11 +600,19 @@ static int globalvar_init(void)
> >  
> >  	globalvar_add_simple("version", UTS_RELEASE);
> >  
> > +	if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
> > +		endianity = "big";
> > +	else
> > +		endianity = "little";
> > +
> > +	globalvar_add_simple("endianity", endianity);
> > +
> >  	return 0;
> >  }
> >  pure_initcall(globalvar_init);
> >  
> >  BAREBOX_MAGICVAR_NAMED(global_version, global.version, "The barebox version");
> > +BAREBOX_MAGICVAR_NAMED(global_endianity, global.endianity, "The barebox endianity");
> >  
> >  /**
> >   * nvvar_save - save NV variables to persistent environment
> > 
> 
> -- 
> 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] 3+ messages in thread

end of thread, other threads:[~2020-04-06 12:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 12:26 [PATCH] startup: introduce global.endianity variable Antony Pavlov
2020-04-03 12:39 ` Ahmad Fatoum
2020-04-06 12:12   ` Antony Pavlov

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