how easy to extend "bitbake -e" to print *selected* subset of variables?
if there's already a simple way to do this, then i'll be slightly
embarrassed.
i would find it *massively* useful to have a variation of "bitbake
-e" print only the values of the variables that i'm interested in; this would be incredibly useful in a classroom if i wanted students to take a look at just those variables related to, say, the kernel.
rather than having to hack up something using grep, it would be nice
if a user could, say, define an extra variable or class and say something like:
$ bitbake -e core-image-minimal --area kernel (or similar)
where i could define that the "kernel area" represents the variables such as MACHINE, KMACHINE, KBRANCH, LINUX_KERNEL_TYPE and whatever variables i decide should belong to that "area." then when i'm discussing the kernel, i have a simple command that immediately allows the students to see how the kernel was configured.
i realize this can't be hard -- just add some filtering code to that
part of bitbake that prints everything. thoughts? is there a way to do this that i'm not seeing?
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 17 lines · Robert P. J. Day
i would find it *massively* useful to have a variation of "bitbake
-e" print only the values of the variables that i'm interested in; this would be incredibly useful in a classroom if i wanted students to take a look at just those variables related to, say, the kernel.rather than having to hack up something using grep, it would be nice
if a user could, say, define an extra variable or class and say something like:$ bitbake -e core-image-minimal --area kernel (or similar)where i could define that the "kernel area" represents the variables such as MACHINE, KMACHINE, KBRANCH,
LINUX_KERNEL_TYPEand whatever variables i decide should belong to that "area." then when i'm discussing the kernel, i have a simple command that immediately allows the students to see how the kernel was configured.
Quoted 4 lines
i realize this can't be hard -- just add some filtering code to that
part of bitbake that prints everything. thoughts? is there a way to do this that i'm not seeing?
I would personally like to see something like:
bitbake -E MACHINE,DISTRO,TMPDIR
Rather than having to define additional 'grouping' metadata.
For now, something like this might be convenient:
$ cat ~/bin/bitbake-env #!/bin/sh # # bitbake-env VARIABLE [VARIBLE...] # # Filter out particular variables from bitbake -e, including the commented out # unexpanded form, and both exported and unexported.
args_pattern () {
for arg; do
printf "$arg|"
done | sed 's,|$,,'
}bitbake -e | grep -E "^((export )?|(# )?)($(args_pattern "$@"))="
Signature · 1 line
Christopher Larson
Quoted 39 lines · Chris Larson
On Thu, Nov 22, 2012 at 12:00 PM, Robert P. J. Day <[email protected]> wrote:
i would find it *massively* useful to have a variation of "bitbake -e" print only the values of the variables that i'm interested in; this would be incredibly useful in a classroom if i wanted students to take a look at just those variables related to, say, the kernel.rather than having to hack up something using grep, it would be nice if a user could, say, define an extra variable or class and say something like:
$ bitbake -e core-image-minimal --area kernel (or similar)
where i could define that the "kernel area" represents the variables such as MACHINE, KMACHINE, KBRANCH,
LINUX_KERNEL_TYPEand whatever variables i decide should belong to that "area." then when i'm discussing the kernel, i have a simple command that immediately allows the students to see how the kernel was configured.i realize this can't be hard -- just add some filtering code to that part of bitbake that prints everything. thoughts? is there a way to do this that i'm not seeing?
I would personally like to see something like:
bitbake -E MACHINE,DISTRO,TMPDIR
Rather than having to define additional 'grouping' metadata.
For now, something like this might be convenient:
$ cat ~/bin/bitbake-env #!/bin/sh # # bitbake-env VARIABLE [VARIBLE...] # # Filter out particular variables from bitbake -e, including the commented out # unexpanded form, and both exported and unexported.
Quoted 7 lines
args_pattern() {
for arg; do
printf "$arg|"
done | sed 's,|$,,'
}bitbake -e | grep -E "^((export )?|(# )?)($(args_pattern "$@"))="
ok, i'll check that out when i'm a bit more with it. just to be
clear what i want again, from a *teaching* perspective, i want the ability to easily define lists of variables, and ask for those variables to be printed from the current environment in precisely that order, since there might be something i'm trying to explain which involves examining that set of variables in a particular order.
i can think of all sorts of "groups" that would be handy to examine
uncluttered by the rest of the environment:
* kernel selection variables
* build destination directory names
* current compiler optimization values
and so on.
i'll play with the above, it might be close to what i'm after.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 16 lines · Chris Larson
I would personally like to see something like:
bitbake -E MACHINE,DISTRO,TMPDIR
Rather than having to define additional 'grouping' metadata.
For now, something like this might be convenient:
$ cat ~/bin/bitbake-env #!/bin/sh # # bitbake-env VARIABLE [VARIBLE...] # # Filter out particular variables from bitbake -e, including the commented out # unexpanded form, and both exported and unexported.
Quoted 7 lines
args_pattern() {
for arg; do
printf "$arg|"
done | sed 's,|$,,'
}bitbake -e | grep -E "^((export )?|(# )?)($(args_pattern "$@"))="
ok, but there's still something i'm missing. from
linux-yocto_3.4.bb, i might want to see the final value of LINUX_VERSION, but that's not printed as part of the normal environment, so i'm assuming i'd need to export it first, right? because there's a lot of content i'd be interested in seeing that is currently not printed by "bitbake -e".
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 25 lines · Robert P. J. Day
Quoted 6 lines · Chris Larson
I would personally like to see something like:
bitbake -E MACHINE,DISTRO,TMPDIR
Rather than having to define additional 'grouping' metadata.
Quoted 8 lines
For now, something like this might be convenient:
$ cat ~/bin/bitbake-env #!/bin/sh # # bitbake-env VARIABLE [VARIBLE...] # # Filter out particular variables from bitbake -e, including thecommented out
Quoted 8 lines
# unexpanded form, and both exported and unexported.args_pattern () { for arg; do printf "$arg|" done | sed 's,|$,,' }
Quoted 8 lines
Quoted 1 line
bitbake -e | grep -E "^((export )?|(# )?)($(args_pattern "$@"))="
ok, but there's still something i'm missing. from
linux-yocto_3.4.bb, i might want to see the final value ofLINUX_VERSION, but that's not printed as part of the normal environment, so i'm assuming i'd need to export it first, right? because there's a lot of content i'd be interested in seeing that is currently not printed by "bitbake -e".
Yeah, that quick script just ran bitbake -e, not bitbake -e <provider>. You could modify it easily enough to support that, though.
You could also try out https://gist.github.com/4133101. It's just a quick prototype. Drop it next to bitbake in bitbake/bin/. It fixes a couple minor annoyances with bitbake -e and it sends all the bitbake log output from stdout to stderr, so you can redirect that independently of the emitted variables and values.
Usage examples:
bitbake-env DISTRO MACHINE do_configure
bitbake-env -r virtual/kernel FILE
eval $(bitbake-env TMPDIR | grep -v '^#')
Signature · 1 line
Christopher Larson
Quoted 9 lines · Chris Larson
Yeah, that quick script just ran bitbake -e, not bitbake -e <provider>. You could modify it easily enough to support that, though.
You could also try out https://gist.github.com/4133101. It's just a quick prototype. Drop it next to bitbake in bitbake/bin/. It fixes a couple minor annoyances with bitbake -e and it sends all the bitbake log output from stdout to stderr, so you can redirect that independently of the emitted variables and values.
Quoted 6 lines
Usage examples:
bitbake-env DISTRO MACHINE
do_configure
bitbake-env -r virtual/kernel FILE
eval $(bitbake-env TMPDIR | grep -v '^#')
Oh, I forgot to mention that it can handle filtering not just regular variables, but functions as well, since it's in python:
bitbake-env base_set_filespath
Signature · 1 line
Christopher Larson
Quoted 3 lines · Chris Larson
Yeah, that quick script just ran bitbake -e, not bitbake -e <provider>. You could modify it easily enough to support that, though.
hang on ... i actually did just that to search the output of:
$ bitbake -e linux-omap4
but i still don't see a number of variables i'm interested in, and i'm not sure how to do that.
Quoted 11 lines
You could also try out https://gist.github.com/4133101. It's just a quick prototype. Drop it next to bitbake in bitbake/bin/. It fixes a couple minor annoyances with bitbake -e and it sends all the bitbake log output from stdout to stderr, so you can redirect that independently of the emitted variables and values.
Usage examples:
bitbake-env DISTRO MACHINE
do_configure
bitbake-env -r virtual/kernel FILE
eval $(bitbake-env TMPDIR | grep -v '^#')
ok, i'll check that out, thanks.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 6 lines · Robert P. J. Day
Quoted 3 lines · Chris Larson
Yeah, that quick script just ran bitbake -e, not bitbake -e <provider>. You could modify it easily enough to support that, though.
Quoted 7 lines
hang on ... i actually did just that to search the output of:
$ bitbake -e linux-omap4but i still don't see a number of variables i'm interested in, and i'm not sure how to do that.
What variables are you not seeing? bitbake -e shows all variables but ones which are flagged 'unexport' (e.g. DISTRO, MACHINE).
Signature · 1 line
Christopher Larson
Quoted 9 lines · Chris Larson
On Thu, Nov 22, 2012 at 5:03 PM, Robert P. J. Day <[email protected]> wrote:
Quoted 3 lines · Chris Larson
Yeah, that quick script just ran bitbake -e, not bitbake -e <provider>. You could modify it easily enough to support that, though.
hang on ... i actually did just that to search the output of:
Quoted 7 lines
$ bitbake -e linux-omap4but i still don't see a number of variables i'm interested in, and i'm not sure how to do that.
What variables are you not seeing? bitbake -e shows all variables but ones which are flagged 'unexport' (e.g. DISTRO, MACHINE).
hmmmm ... i think i see my problem. working from memory, i remember
being able to examine kernel-related variables when using OE to build a qemuarm system, so i could examine, say, KMETA with:
$ bitbake -e virtual/kernel | grep KMETA
# KMETA=meta
KMETA="meta"
export KMETA=meta
export KMETA=meta
## KMETA branch validation
export KMETA=meta
# If KMETA is defined, the branch must exist, but a machine branch
# if KMETA isn't set globally by a recipe using this routine, we need to
kmeta = d.getVar( "KMETA", True ) or "meta"
$ recently, i used OE and the meta-ti layer to build for pandaboard
but here's what happens when i tried the same thing there:
$ bitbake -e virtual/kernel | grep KMETA $
as in, nothing. i guess i was just assuming i would see similar
information there, i obviously need to look at the meta-ti kernel recipes more closely. or should i still be able to see that variable? it seems like a fairly critical part of the kernel configuration phase.
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 11 lines · Chris Larson
On Thu, Nov 22, 2012 at 5:03 PM, Robert P. J. Day <[email protected]> wrote:
Quoted 3 lines · Chris Larson
Yeah, that quick script just ran bitbake -e, not bitbake -e <provider>. You could modify it easily enough to support that, though.
hang on ... i actually did just that to search the output of:
Quoted 7 lines
$ bitbake -e linux-omap4but i still don't see a number of variables i'm interested in, and i'm not sure how to do that.
What variables are you not seeing? bitbake -e shows all variables but ones which are flagged 'unexport' (e.g. DISTRO, MACHINE). --
*sigh* ... just ignore my stupidity. in my fatigue, i totally
forgot that configuring a pandaboard required adding meta-ti on top of straight OE, and there was no yocto-related content involved, but i was still remembering all of the variables i could see when i was using yocto.
in any event, i like the bitbake-env script, is it worth adding some
variant of that to bitbake itself?
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 9 lines · Robert P. J. Day
Quoted 2 lines
What variables are you not seeing? bitbake -e shows all variables but ones which are flagged 'unexport' (e.g. DISTRO, MACHINE). --
*sigh* ... just ignore my stupidity. in my fatigue, i totally
forgot that configuring a pandaboard required adding meta-ti on top of straight OE, and there was no yocto-related content involved, but i was still remembering all of the variables i could see when i was using yocto.
Heh, oops, that'd explain it :)
in any event, i like the bitbake-env script, is it worth adding some
Quoted 1 line
variant of that to bitbake itself?
I personally think that something like it would be useful in bitbake proper.
FYI, bitbake-env now supports optionally showing function dependencies:
$ bitbake-env -d TARGET_PREFIX
def csl_target_sys(d):
toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True) for triplet in d.getVar('CSL_TARGET_SYS', True).split():
gcc = os.path.join(toolchain_path, 'bin', triplet + '-gcc') if os.path.exists(gcc):
return triplet + '-'
return 'powerpc-mel-linux-gnuspe-'
# TARGET_PREFIX="${@csl_target_sys(d)}"
TARGET_PREFIX="powerpc-linux-gnu-"
$ bitbake-env -d do_compile
base_do_compile () {
if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then
oe_runmake || die "make failed"
else
bbnote "nothing to compile"
fi
}do_compile () {
base_do_compile
}
Signature · 5 lines
Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics
Quoted 5 lines · Chris Larson
On Fri, Nov 23, 2012 at 6:26 AM, Robert P. J. Day <[email protected]> wrote:
> What variables are you not seeing? bitbake -e shows all variables > but ones which are flagged 'unexport' (e.g. DISTRO, MACHINE). --
Quoted 7 lines
*sigh* ... just ignore my stupidity. in my fatigue, i totally forgot that configuring a pandaboard required adding meta-ti on top of straight OE, and there was no yocto-related content involved, but i was still remembering all of the variables i could see when i was using yocto.
Heh, oops, that'd explain it :)
yeah, that was one of those facepalm moments,
http://media.photobucket.com/image/recent/KoalaMeatPie/618px-JeanLucPicardFacepalm.jpg
Quoted 26 lines
I personally think that something like it would be useful in bitbake proper.
FYI, bitbake-env now supports optionally showing function dependencies:
$ bitbake-env -d TARGET_PREFIX def csl_target_sys(d): toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True)for triplet in
d.getVar('CSL_TARGET_SYS', True).split():
gcc =os.path.join(toolchain_path, 'bin', triplet + '-gcc')ifos.path.exists(gcc):
return triplet + '-'
return 'powerpc-mel-linux-gnuspe-'# TARGET_PREFIX="${@csl_target_sys(d)}"
TARGET_PREFIX="powerpc-linux-gnu-"$ bitbake-env -d do_compile base_do_compile () { if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then oe_runmake || die "make failed" else bbnote "nothing to compile" fi }
Quoted 3 lines
do_compile() {
base_do_compile
}
whoa, where *is* this? is it on tap to be added to bitbake/bin,
since i think that would be a delightful idea.
just to recap, my interest in this sort of thing is not so much for
debugging as for instruction -- when i last taught an intro class in OE/yocto, i made extensive use of the "bitbake-layers" utility when explaining and defining layers, and the class loved it, that they could see the results of adding a new layer.
so something similar for the environment would be just ducky. of
course, i really should learn python one of these days so i could do this sort of thing myself. soon ...
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 27 lines · Robert P. J. Day
Quoted 1 line
I personally think that something like it would be useful in bitbake
proper.
Quoted 25 lines
FYI, bitbake-env now supports optionally showing function dependencies:
$ bitbake-env -d TARGET_PREFIX def csl_target_sys(d): toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True)for triplet in
d.getVar('CSL_TARGET_SYS', True).split():
gcc =os.path.join(toolchain_path, 'bin', triplet + '-gcc')ifos.path.exists(gcc):
return triplet + '-'
return 'powerpc-mel-linux-gnuspe-'# TARGET_PREFIX="${@csl_target_sys(d)}"
TARGET_PREFIX="powerpc-linux-gnu-"$ bitbake-env -d do_compile base_do_compile () { if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then oe_runmake || die "make failed" else bbnote "nothing to compile" fi }
Quoted 7 lines
Quoted 3 lines
do_compile() {
base_do_compile
}whoa, where *is* this? is it on tap to be added to bitbake/bin,
since i think that would be a delightful idea.
The latest code at https://gist.github.com/4133101 has it. The new readme there describes the usage and behavioral differences relative to bitbake -e.
just to recap, my interest in this sort of thing is not so much for
Quoted 5 lines
debugging as for instruction -- when i last taught an intro class in OE/yocto, i made extensive use of the "bitbake-layers" utility when explaining and defining layers, and the class loved it, that they could see the results of adding a new layer.
Ah! Interesting. I hadn't considered the training aspects of that sort of utility, as I normally just use them in debugging. I'll have to keep that in mind in the future.
Signature · 1 line
Christopher Larson