Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
@ 2015-09-09  1:19 Juro Bystricky
  2015-09-09  9:21 ` Phil Blundell
  0 siblings, 1 reply; 5+ messages in thread
From: Juro Bystricky @ 2015-09-09  1:19 UTC (permalink / raw)
  To: openembedded-core; +Cc: richard.purdie

Avoid "ERROR: cannot map <cpu> to a linux kernel architecture"
Not being able to map a CPU to a kernel architecture should not be treated as
an error when building baremetal toolchains for CPU <cpu> which does not have
a kernel source tree.

Rather then individually enumerating each additional (baremetal) CPU, allow them all.
This way the kernel-arch.bbclass does not need to be modified each time a support
for a new baremetal CPU is added.

Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
---
 meta/classes/kernel-arch.bbclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meta/classes/kernel-arch.bbclass b/meta/classes/kernel-arch.bbclass
index 211b72b..3ffe47c 100644
--- a/meta/classes/kernel-arch.bbclass
+++ b/meta/classes/kernel-arch.bbclass
@@ -31,6 +31,7 @@ def map_kernel_arch(a, d):
     elif re.match('microblazee[bl]', a):        return 'microblaze'
     elif a in valid_archs:                      return a
     else:
+        if d.getVar("TCLIBC", True) == "baremetal": return a;
         bb.error("cannot map '%s' to a linux kernel architecture" % a)
 
 export ARCH = "${@map_kernel_arch(d.getVar('TARGET_ARCH', True), d)}"
-- 
1.9.1



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

* Re: [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
  2015-09-09  1:19 [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs Juro Bystricky
@ 2015-09-09  9:21 ` Phil Blundell
  2015-09-09 21:27   ` Bystricky, Juro
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Blundell @ 2015-09-09  9:21 UTC (permalink / raw)
  To: Juro Bystricky; +Cc: richard.purdie, openembedded-core

On Tue, 2015-09-08 at 18:19 -0700, Juro Bystricky wrote:
> Avoid "ERROR: cannot map <cpu> to a linux kernel architecture"
> Not being able to map a CPU to a kernel architecture should not be treated as
> an error when building baremetal toolchains for CPU <cpu> which does not have
> a kernel source tree.

Why is map_kernel_arch() even being invoked for a baremetal
configuration?  That sounds like it is the real bug here.

p.




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

* Re: [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
  2015-09-09  9:21 ` Phil Blundell
@ 2015-09-09 21:27   ` Bystricky, Juro
  2015-09-09 22:00     ` Phil Blundell
  0 siblings, 1 reply; 5+ messages in thread
From: Bystricky, Juro @ 2015-09-09 21:27 UTC (permalink / raw)
  To: Phil Blundell; +Cc: Purdie, Richard, openembedded-core@lists.openembedded.org

I would not call it a real bug. The code just tries to initialize ARCH  (which may not be used
for baremetal situations). The name "map_kernel_arch" is a bit misleading
in this (baremetal) context.


> -----Original Message-----
> From: Phil Blundell [mailto:pb@pbcl.net]
> Sent: Wednesday, September 9, 2015 2:21 AM
> To: Bystricky, Juro
> Cc: openembedded-core@lists.openembedded.org; Purdie, Richard
> Subject: Re: [OE-core] [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
> 
> On Tue, 2015-09-08 at 18:19 -0700, Juro Bystricky wrote:
> > Avoid "ERROR: cannot map <cpu> to a linux kernel architecture"
> > Not being able to map a CPU to a kernel architecture should not be
> > treated as an error when building baremetal toolchains for CPU <cpu>
> > which does not have a kernel source tree.
> 
> Why is map_kernel_arch() even being invoked for a baremetal
> configuration?  That sounds like it is the real bug here.
> 
> p.
> 


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

* Re: [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
  2015-09-09 21:27   ` Bystricky, Juro
@ 2015-09-09 22:00     ` Phil Blundell
  2015-09-10 17:50       ` Bystricky, Juro
  0 siblings, 1 reply; 5+ messages in thread
From: Phil Blundell @ 2015-09-09 22:00 UTC (permalink / raw)
  To: Bystricky, Juro; +Cc: Purdie, Richard, openembedded-core@lists.openembedded.org

I think what I'm saying is that the whole ARCH thing is a linuxism that
should not be popping up in a baremetal (or any other non-linux)
configuration, and hacking map_kernel_arch() to return some
benign-but-bogus value seems like the wrong fix for it.  Particularly if
this hacking is based on the value of TCLIBC which, conceptually, is not
all that tightly bound to a kernel.

If there are places in the metadata that "inherit kernel-arch" in a
non-linux-specific context then I think we should figure out some way to
eliminate them.  In the longer term I think it would make sense to have
a "kernel" -> "linux" renaming to make these assumptions more explicit.

p.

On Wed, 2015-09-09 at 21:27 +0000, Bystricky, Juro wrote:
> I would not call it a real bug. The code just tries to initialize ARCH  (which may not be used
> for baremetal situations). The name "map_kernel_arch" is a bit misleading
> in this (baremetal) context.
> 
> 
> > -----Original Message-----
> > From: Phil Blundell [mailto:pb@pbcl.net]
> > Sent: Wednesday, September 9, 2015 2:21 AM
> > To: Bystricky, Juro
> > Cc: openembedded-core@lists.openembedded.org; Purdie, Richard
> > Subject: Re: [OE-core] [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
> > 
> > On Tue, 2015-09-08 at 18:19 -0700, Juro Bystricky wrote:
> > > Avoid "ERROR: cannot map <cpu> to a linux kernel architecture"
> > > Not being able to map a CPU to a kernel architecture should not be
> > > treated as an error when building baremetal toolchains for CPU <cpu>
> > > which does not have a kernel source tree.
> > 
> > Why is map_kernel_arch() even being invoked for a baremetal
> > configuration?  That sounds like it is the real bug here.
> > 
> > p.
> > 
> 




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

* Re: [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
  2015-09-09 22:00     ` Phil Blundell
@ 2015-09-10 17:50       ` Bystricky, Juro
  0 siblings, 0 replies; 5+ messages in thread
From: Bystricky, Juro @ 2015-09-10 17:50 UTC (permalink / raw)
  To: Phil Blundell; +Cc: Purdie, Richard, openembedded-core@lists.openembedded.org

No argument here. I agree that baremetal builds should be/could be streamlined.
In particular,  the code should support self-contained baremetal CPU specific meta layers 
so there would be no need to add new (baremetal) CPUs into various tables in meta/siteinfo.bbclass
and meta/insane.bbclass.


> -----Original Message-----
> From: Phil Blundell [mailto:pb@pbcl.net]
> Sent: Wednesday, September 9, 2015 3:01 PM
> To: Bystricky, Juro
> Cc: openembedded-core@lists.openembedded.org; Purdie, Richard
> Subject: Re: [OE-core] [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs
> 
> I think what I'm saying is that the whole ARCH thing is a linuxism that should
> not be popping up in a baremetal (or any other non-linux) configuration, and
> hacking map_kernel_arch() to return some benign-but-bogus value seems
> like the wrong fix for it.  Particularly if this hacking is based on the value of
> TCLIBC which, conceptually, is not all that tightly bound to a kernel.
> 
> If there are places in the metadata that "inherit kernel-arch" in a non-linux-
> specific context then I think we should figure out some way to eliminate
> them.  In the longer term I think it would make sense to have a "kernel" ->
> "linux" renaming to make these assumptions more explicit.
> 
> p.
> 
> On Wed, 2015-09-09 at 21:27 +0000, Bystricky, Juro wrote:
> > I would not call it a real bug. The code just tries to initialize ARCH
> > (which may not be used for baremetal situations). The name
> > "map_kernel_arch" is a bit misleading in this (baremetal) context.
> >
> >
> > > -----Original Message-----
> > > From: Phil Blundell [mailto:pb@pbcl.net]
> > > Sent: Wednesday, September 9, 2015 2:21 AM
> > > To: Bystricky, Juro
> > > Cc: openembedded-core@lists.openembedded.org; Purdie, Richard
> > > Subject: Re: [OE-core] [PATCH] kernel-arch.bbclass: Allow
> > > 'baremetal' CPUs
> > >
> > > On Tue, 2015-09-08 at 18:19 -0700, Juro Bystricky wrote:
> > > > Avoid "ERROR: cannot map <cpu> to a linux kernel architecture"
> > > > Not being able to map a CPU to a kernel architecture should not be
> > > > treated as an error when building baremetal toolchains for CPU
> > > > <cpu> which does not have a kernel source tree.
> > >
> > > Why is map_kernel_arch() even being invoked for a baremetal
> > > configuration?  That sounds like it is the real bug here.
> > >
> > > p.
> > >
> >
> 


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

end of thread, other threads:[~2015-09-10 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09  1:19 [PATCH] kernel-arch.bbclass: Allow 'baremetal' CPUs Juro Bystricky
2015-09-09  9:21 ` Phil Blundell
2015-09-09 21:27   ` Bystricky, Juro
2015-09-09 22:00     ` Phil Blundell
2015-09-10 17:50       ` Bystricky, Juro

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