From: Tom Zanussi <tom.zanussi@intel.com>
To: Darren Hart <dvhart@linux.intel.com>
Cc: yocto@yoctoproject.org
Subject: Re: [PATCH 4/8] yocto-bsp: add kernel interface
Date: Fri, 02 Mar 2012 11:34:39 -0600 [thread overview]
Message-ID: <1330709679.2319.86.camel@elmorro> (raw)
In-Reply-To: <4F50FF3D.7080802@linux.intel.com>
On Fri, 2012-03-02 at 09:11 -0800, Darren Hart wrote:
>
> On 03/01/2012 11:01 PM, tom.zanussi@intel.com wrote:
> > From: Tom Zanussi <tom.zanussi@intel.com>
> >
> > Yocto BSP kernel-related functions, for interacting with the kernel
> > tools and implementing the machinery behind the 'yocto-kernel'
> > command.
> >
> > Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
> > ---
> > scripts/lib/bsp/kernel.py | 679 +++++++++++++++++++++++++++++++++++++++++++++
> > 1 files changed, 679 insertions(+), 0 deletions(-)
> > create mode 100644 scripts/lib/bsp/kernel.py
> >
> > diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py
> > new file mode 100644
> > index 0000000..1b88b2f
> > --- /dev/null
> > +++ b/scripts/lib/bsp/kernel.py
> > @@ -0,0 +1,679 @@
> > +# ex:ts=4:sw=4:sts=4:et
> > +# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
> > +#
> > +# Copyright 2012 Intel Corporation
> > +# Authored-by: Tom Zanussi <tom.zanussi@intel.com>
> > +#
> > +# This program is free software; you can redistribute it and/or modify
> > +# it under the terms of the GNU General Public License version 2 as
> > +# published by the Free Software Foundation.
> > +#
> > +# This program is distributed in the hope that it will be useful,
> > +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > +# GNU General Public License for more details.
> > +#
> > +# You should have received a copy of the GNU General Public License along
> > +# with this program; if not, write to the Free Software Foundation, Inc.,
> > +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
> > +
> > +import sys
> > +import os
> > +import shutil
> > +from tags import *
> > +import glob
> > +
> > +
> > +def find_bblayers(scripts_path):
> > + """
> > + Find and return a sanitized list of the layers found in BBLAYERS.
> > + """
> > + bblayers_conf = os.path.join(scripts_path, "../build/conf/bblayers.conf")
> > +
> > + layers = []
> > +
> > + f = open(bblayers_conf, "r")
> > + lines = f.readlines()
> > + for line in lines:
> > + line = line.strip()
> > + in_bblayers = False
> > + if line.startswith("BBLAYERS"):
> > + in_bblayers = True
> > + if line.startswith("/"):
> > + if line.endswith("\\"):
> > + line = line[:-1].strip()
> > + layers.append(line)
>
>
> This does not appear to handle something like:
>
> BBLAYERS = " \
> /path/to/layer1 \
> /path/to/layer2"
>
> Need to strip the " from the end of the last line.
>
> Also doesn't handle:
>
> BBLAYERS += "/path/to/layer3"
>
> As it looks for lines starting with / and doesn't handle the " as
> mentioned above.
>
> > + f.close()
> > +
> > + return layers
> > +
> > +
> > +def find_meta_layer(scripts_path):
> > + """
> > + Find and return the meta layer in BBLAYERS.
> > + """
> > + layers = find_bblayers(scripts_path)
> > +
> > + for layer in layers:
> > + if layer.endswith("meta"):
> > + return layer
> > +
> > + return None
>
> I wonder if you could just use the bitbake-layers show-layers command?
>
> $ bitbake-layers show-layers
> Parsing recipes..WARNING: No recipes available for:
>
> /home/dvhart/source/poky/layers/poky-extras/meta-kernel-dev/recipes-kernel/linux/linux-yocto_2.6.34.bbappend
>
> /home/dvhart/source/poky/layers/meta-intel/meta-fri2/recipes-kernel/linux/linux-yocto-tiny_3.2.bbappend
>
> /home/dvhart/source/poky/layers/poky-extras/meta-kernel-dev/recipes-kernel/linux/linux-yocto-rt_2.6.34.bbappend
> done.
>
> layer path priority
> ==========================================================================
> meta /home/dvhart/source/poky/meta 5
> meta-yocto /home/dvhart/source/poky/meta-yocto 5
> meta-intel /home/dvhart/source/poky/layers/meta-intel 5
> meta-fri2
> /home/dvhart/source/poky/layers/meta-intel/meta-fri2 5
> meta-kernel-dev
> /home/dvhart/source/poky/layers/poky-extras/meta-kernel-dev 0
>
>
> It's slow as snot in January in Toronto, but it avoids having to
> re-implement all the bblayers parsing and the various corner cases that
> bitbake already handles...
>
Yeah, good suggestion - makes a lot of sense to me - I'll see what I can
do to leverage that work.
>
> > +
> > +def find_bsp_layer(scripts_path, machine):
> > + """
> > + Find and return a machine's BSP layer in BBLAYERS.
> > + """
> > + layers = find_bblayers(scripts_path)
> > +
> > + for layer in layers:
> > + if machine in layer:
> > + return layer
> > +
> > + print "Unable to find the BSP layer for machine %s." % machine
> > + print "Please make sure it is listed in bblayers.conf"
> > + sys.exit(1)
>
> You would probably need to cache the result of the bitbake-layers as it
> is way to slow to use repeatedly like you need to here...
>
Right, makes sense.
Thanks,
Tom
> The rest looks good to me.
>
next prev parent reply other threads:[~2012-03-02 17:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-02 7:01 [PATCH 0/8] Yocto BSP tools tom.zanussi
2012-03-02 7:01 ` [PATCH 1/8] yocto-bsp: add BSP template files tom.zanussi
2012-03-02 16:35 ` Darren Hart
2012-03-02 17:19 ` Tom Zanussi
2012-03-02 7:01 ` [PATCH 2/8] yocto-bsp-tools: add bsp library tom.zanussi
2012-03-02 16:41 ` Darren Hart
2012-03-02 7:01 ` [PATCH 3/8] yocto-bsp: add templating engine tom.zanussi
2012-03-02 16:57 ` Darren Hart
2012-03-02 17:22 ` Tom Zanussi
2012-03-02 7:01 ` [PATCH 4/8] yocto-bsp: add kernel interface tom.zanussi
2012-03-02 17:11 ` Darren Hart
2012-03-02 17:34 ` Tom Zanussi [this message]
2012-03-02 7:01 ` [PATCH 5/8] yocto-bsp-tools: add help/usage tom.zanussi
2012-03-02 17:17 ` Darren Hart
2012-03-02 7:01 ` [PATCH 6/8] yocto-bsp: add some useful constants tom.zanussi
2012-03-02 17:18 ` Darren Hart
2012-03-02 7:01 ` [PATCH 7/8] yocto-bsp: new script tom.zanussi
2012-03-02 17:20 ` Darren Hart
2012-03-02 7:01 ` [PATCH 8/8] yocto-kernel: " tom.zanussi
2012-03-02 17:23 ` Darren Hart
2012-03-02 17:27 ` Tom Zanussi
2012-03-02 16:24 ` [PATCH 0/8] Yocto BSP tools Darren Hart
2012-03-02 17:02 ` Tom Zanussi
2012-03-02 17:15 ` Darren Hart
-- strict thread matches above, loose matches on Subject: below --
2012-03-17 5:30 [PATCH 1/8] yocto-bsp: add BSP template files tom.zanussi
2012-03-17 5:30 ` [PATCH 0/8] Yocto BSP tools, version 2 tom.zanussi
2012-03-17 5:30 ` [PATCH 4/8] yocto-bsp: add kernel interface tom.zanussi
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=1330709679.2319.86.camel@elmorro \
--to=tom.zanussi@intel.com \
--cc=dvhart@linux.intel.com \
--cc=yocto@yoctoproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.