All of lore.kernel.org
 help / color / mirror / Atom feed
* simplest recipe for running yocto qemu images?
@ 2012-03-02 11:57 Robert P. J. Day
  2012-03-02 12:06 ` Paul Eggleton
  0 siblings, 1 reply; 6+ messages in thread
From: Robert P. J. Day @ 2012-03-02 11:57 UTC (permalink / raw)
  To: Yocto discussion list


  i want to do a short writeup on the *simplest* recipe for how to run
the pre-built yocto qemu image you can get here:

http://downloads.yoctoproject.org/releases/yocto/yocto-1.1/machines/qemu/

and what should have been a simple procedure got a bit messy.  to be
clear, i want to document the absolute *least* you need to do to run a
yocto-built qemu image without having to build anything since,
technically, you shouldn't have to.  i'm aware of the writeup in the
quick start guide, but that seems like overkill based on what i'm
trying to do.  so here's what i just went through.

  first, starting with a fresh terminal window totally unconfigured
for yocto, download a matching kernel image and rootfs; in my case,
just for fun, i downloaded for arm:

* zImage-qemuarm.bin
* core-image-minimal-qemuarm.ext3

  now that i have that, the obvious next step is to use the convenient
"runqemu" wrapper in my yocto directory, so i'll extend my search
path:

  $ PATH=~/yocto/git/scripts:$PATH

and i'll turn on shell debugging in that "runqemu" script and test it
out:

$ runqemu qemuarm \
  zImage-2.6.37-qemuarm-1.0.bin \
  core-image-minimal-qemuarm.ext3
... snip ...
/home/rpjday/yocto/git/scripts/bitbake: line 106: -e: command not found
+ TMPDIR=
+ '[' -z '' ']'
+ echo 'Error: this script needs to be run from your build directory,'
Error: this script needs to be run from your build directory,
+ echo 'or you need to explicitly set TMPDIR in your environment'
or you need to explicitly set TMPDIR in your environment
+ exit 1
$

  ok, not sure why simply running a qemu image requires invoking
bitbake, but the error message looks pretty straightforward, so i'll
fix that and try again:

$ TMPDIR=/tmp runqemu qemuarm \
  zImage-2.6.37-qemuarm-1.0.bin \
  core-image-minimal-qemuarm.ext3
... snip ...

/home/rpjday/yocto/git/scripts/bitbake: line 106: -e: command not found
+ TMPDIR=
+ '[' -z '' ']'
+ echo 'Error: this script needs to be run from your build directory,'
Error: this script needs to be run from your build directory,
+ echo 'or you need to explicitly set TMPDIR in your environment'
or you need to explicitly set TMPDIR in your environment
+ exit 1
$

  well, that appeared to solve nothing despite the fact that i did
*exactly* what the earlier diagnostic suggested.  oh, wait, there's
this earlier in "runqemu":

# Don't use TMPDIR from the external environment, it may be a distro
# variable pointing to /tmp (e.g. within X on OpenSUSE)
# Instead, use OE_TMPDIR for passing this in externally.
TMPDIR="$OE_TMPDIR"

  grrrrrrrr.  ok, let's set OE_TMPDIR instead, whereupon we make
considerably more progress until:

... snip ...
++ tap='Error: Unable to find tunctl binary in
'\''/tmp/sysroots/x86_64-linux/usr/bin'\'''
++ '[' 1 -ne 0 ']'
++ sudo /home/rpjday/yocto/git/scripts/runqemu-ifup 1000
/tmp/sysroots/x86_64-linux
Error: Unable to find tunctl binary in
'/tmp/sysroots/x86_64-linux/usr/bin'
++ return
$

  which is actually fine since, obviously, i need to have an
appropriate sysroot directory in my PATH to pick up commands liek
"tunctl" and so on.  no problem -- i've installed the appropriate
ARM toolchain under /opt/poky so:

$ PATH=/opt/poky/1.1/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH
$ type tunctl
tunctl is /opt/poky/1.1/sysroots/x86_64-pokysdk-linux/usr/bin/tunctl
$

all right, away we go again:

$ OE_TMPDIR=/tmp runqemu \
  qemuarm zImage-2.6.37-qemuarm-1.0.bin \
  core-image-minimal-qemuarm.ext3
... snip ...
/home/rpjday/yocto/git/scripts/bitbake: line 106: -e: command not found
Error: this script needs to be run from your build directory,
or you need to explicitly set TMPDIR in your environment
$

  wait, i thought i took care of that.  oh ...

$ type runqemu
runqemu is hashed (/opt/poky/1.1/sysroots/x86_64-pokysdk-linux/usr/bin/runqemu)
$

so now i'm picking up "runqemu" from the toolchain's sysroot
directory, which does *not* have the OE_TMPDIR reference, only the
earlier TMPDIR one.  so let's completely remove my yocto install
scripts directory from my search path, and use *only* the sysroots
directory:

$ PATH=/opt/poky/1.1/sysroots/x86_64-pokysdk-linux/usr/bin:$PATH
$ TMPDIR=/tmp runqemu qemuarm \
  zImage-2.6.37-qemuarm-1.0.bin \
  core-image-minimal-qemuarm.ext3
... snip ...
Setting up tap interface under sudo
+++ sudo
/opt/poky/1.1/sysroots/x86_64-pokysdk-linux/usr/bin/runqemu-ifup 1000
/tmp/sysroots/x86_64-linux
++ tap='Error: Unable to find tunctl binary in
'\''/tmp/sysroots/x86_64-linux/usr/bin'\'''
++ '[' 1 -ne 0 ']'
++ sudo
/opt/poky/1.1/sysroots/x86_64-pokysdk-linux/usr/bin/runqemu-ifup 1000
/tmp/sysroots/x86_64-linux
Error: Unable to find tunctl binary in '/tmp/sysroots/x86_64-linux/usr/bin'
++ return
$

  ok, it *has* to be easier than this.  quite simply, if one wants to
do nothing more than *run* one of those qemu images, there should be
no need to do any building or bitbaking, should there?  am i missing
something hideously obvious?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================






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

* Re: simplest recipe for running yocto qemu images?
  2012-03-02 11:57 simplest recipe for running yocto qemu images? Robert P. J. Day
@ 2012-03-02 12:06 ` Paul Eggleton
  2012-03-02 12:16   ` Robert P. J. Day
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggleton @ 2012-03-02 12:06 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: yocto

On Friday 02 March 2012 06:57:57 Robert P. J. Day wrote:
>   ok, it *has* to be easier than this.  quite simply, if one wants to
> do nothing more than *run* one of those qemu images, there should be
> no need to do any building or bitbaking, should there?  am i missing
> something hideously obvious?

Only that we assume you *have* built the image in order to be able to use the 
runqemu script. If you haven't, well, you won't necessarily have some of the 
utilities the script looks for (e.g. tunctl). When the script looks for TMPDIR 
it is not looking for a temporary directory, it's looking for the TMPDIR that 
would have been set in your local.conf. 

The runqemu script just isn't designed to be used in the way that you're 
trying to use it.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: simplest recipe for running yocto qemu images?
  2012-03-02 12:06 ` Paul Eggleton
@ 2012-03-02 12:16   ` Robert P. J. Day
  2012-03-02 12:23     ` Paul Eggleton
  0 siblings, 1 reply; 6+ messages in thread
From: Robert P. J. Day @ 2012-03-02 12:16 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto

On Fri, 2 Mar 2012, Paul Eggleton wrote:

> On Friday 02 March 2012 06:57:57 Robert P. J. Day wrote:
> >   ok, it *has* to be easier than this.  quite simply, if one wants
> > to do nothing more than *run* one of those qemu images, there
> > should be no need to do any building or bitbaking, should there?
> > am i missing something hideously obvious?
>
> Only that we assume you *have* built the image in order to be able
> to use the runqemu script. If you haven't, well, you won't
> necessarily have some of the utilities the script looks for (e.g.
> tunctl). When the script looks for TMPDIR it is not looking for a
> temporary directory, it's looking for the TMPDIR that would have
> been set in your local.conf.
>
> The runqemu script just isn't designed to be used in the way that
> you're trying to use it.

  i gathered that.  but is it unreasonable to suggest that this is
something that *should* be easy to do?  if new users simply want to
see what a yocto-generated image looks like under qemu, shouldn't
there be a way to let them do that without going through an entire
build?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


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

* Re: simplest recipe for running yocto qemu images?
  2012-03-02 12:16   ` Robert P. J. Day
@ 2012-03-02 12:23     ` Paul Eggleton
  2012-03-02 12:32       ` Robert P. J. Day
  2012-03-02 12:41       ` simplest recipe for running yocto qemu images? [SOLVED] Robert P. J. Day
  0 siblings, 2 replies; 6+ messages in thread
From: Paul Eggleton @ 2012-03-02 12:23 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: yocto

On Friday 02 March 2012 07:16:08 Robert P. J. Day wrote:
>   i gathered that.  but is it unreasonable to suggest that this is
> something that *should* be easy to do?  if new users simply want to
> see what a yocto-generated image looks like under qemu, shouldn't
> there be a way to let them do that without going through an entire
> build?

I see what you're saying, but the problem with this is the qemu version we 
build is not the same as qemu that might be installed on the host machine. We 
apply quite a number of patches to qemu in order to support features we need 
(such as GL); if you allow beginners to easily use something else then it just 
makes support harder because certain things that normally work in the current 
setup will not work when the host tools are being used instead.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


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

* Re: simplest recipe for running yocto qemu images?
  2012-03-02 12:23     ` Paul Eggleton
@ 2012-03-02 12:32       ` Robert P. J. Day
  2012-03-02 12:41       ` simplest recipe for running yocto qemu images? [SOLVED] Robert P. J. Day
  1 sibling, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2012-03-02 12:32 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto

On Fri, 2 Mar 2012, Paul Eggleton wrote:

> On Friday 02 March 2012 07:16:08 Robert P. J. Day wrote:
> >   i gathered that.  but is it unreasonable to suggest that this is
> > something that *should* be easy to do?  if new users simply want to
> > see what a yocto-generated image looks like under qemu, shouldn't
> > there be a way to let them do that without going through an entire
> > build?
>
> I see what you're saying, but the problem with this is the qemu
> version we build is not the same as qemu that might be installed on
> the host machine. We apply quite a number of patches to qemu in
> order to support features we need (such as GL); if you allow
> beginners to easily use something else then it just makes support
> harder because certain things that normally work in the current
> setup will not work when the host tools are being used instead.

  i briefly saw your point until i noticed that the yocto toolchain i
installed comes with qemu-system-* executables, which would take
precedence over the normal host ones, so i'm still skeptical.

  i'm going to mess with this a bit longer since i can't believe it
should be hard to tweak this to get it to work.  no matter what
happens, i'm sure i'll come out of it smarter.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


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

* Re: simplest recipe for running yocto qemu images? [SOLVED]
  2012-03-02 12:23     ` Paul Eggleton
  2012-03-02 12:32       ` Robert P. J. Day
@ 2012-03-02 12:41       ` Robert P. J. Day
  1 sibling, 0 replies; 6+ messages in thread
From: Robert P. J. Day @ 2012-03-02 12:41 UTC (permalink / raw)
  To: Paul Eggleton; +Cc: yocto

On Fri, 2 Mar 2012, Paul Eggleton wrote:

> On Friday 02 March 2012 07:16:08 Robert P. J. Day wrote:
> >   i gathered that.  but is it unreasonable to suggest that this is
> > something that *should* be easy to do?  if new users simply want to
> > see what a yocto-generated image looks like under qemu, shouldn't
> > there be a way to let them do that without going through an entire
> > build?
>
> I see what you're saying, but the problem with this is the qemu
> version we build is not the same as qemu that might be installed on
> the host machine. We apply quite a number of patches to qemu in
> order to support features we need (such as GL); if you allow
> beginners to easily use something else then it just makes support
> harder because certain things that normally work in the current
> setup will not work when the host tools are being used instead.

  just for fun, i addressed the only thing that was stopping me, and
that was that runqemu was looking for a slightly different sysroots
directory name than the toolchain provided, so:

/opt/poky/1.1/sysroots$ sudo ln -s x86_64-pokysdk-linux/ x86_64-linux

and then ran:

$ TMPDIR=/opt/poky/1.1 runqemu qemuarm zImage-2.6.37-qemuarm-1.0.bin
core-image-minimal-qemuarm.ext3

and it worked.  yes, i'm sure i'm abusing all sorts of things but, in
the end, once i dug through it, it seemed fairly easy to get it to
work.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


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

end of thread, other threads:[~2012-03-02 12:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-02 11:57 simplest recipe for running yocto qemu images? Robert P. J. Day
2012-03-02 12:06 ` Paul Eggleton
2012-03-02 12:16   ` Robert P. J. Day
2012-03-02 12:23     ` Paul Eggleton
2012-03-02 12:32       ` Robert P. J. Day
2012-03-02 12:41       ` simplest recipe for running yocto qemu images? [SOLVED] Robert P. J. Day

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.