diff mbox series

scripts/runqemu: raise an error when bitbake was not found

Message ID 20250820061959.22598-1-r.gruenert@pironex.com
State New
Headers show
Series scripts/runqemu: raise an error when bitbake was not found | expand

Commit Message

Richard Grünert Aug. 20, 2025, 6:19 a.m. UTC
I am new to Yocto/OpenEmbedded and compiled poky by following the Yocto
"Quick Build" guide. I later tried to call runqemu
from a terminal different to the one I ran the compilation in
and runqemu was not found.
Wondering why it was not found, I ran it directly as `./scripts/runqemu`,
which was a misconception I had because you are supposed to have
`oe-init-build-env` sourced. However, there was no error that told me
this when running runqemu like I did. So I thought it would be
good to add this error message to notify the user that bitbake
was not found. At least it would have helped me and saved me
some minutes of head scratching.

Signed-off-by: Richard Grünert <r.gruenert@pironex.com>
---
 scripts/runqemu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Aug. 20, 2025, 8:31 p.m. UTC | #1
On Wed, 2025-08-20 at 08:19 +0200, Richard Grünert via lists.openembedded.org wrote:
> I am new to Yocto/OpenEmbedded and compiled poky by following the Yocto
> "Quick Build" guide. I later tried to call runqemu
> from a terminal different to the one I ran the compilation in
> and runqemu was not found.
> Wondering why it was not found, I ran it directly as `./scripts/runqemu`,
> which was a misconception I had because you are supposed to have
> `oe-init-build-env` sourced. However, there was no error that told me
> this when running runqemu like I did. So I thought it would be
> good to add this error message to notify the user that bitbake
> was not found. At least it would have helped me and saved me
> some minutes of head scratching.
> 
> Signed-off-by: Richard Grünert <r.gruenert@pironex.com>
> ---
>  scripts/runqemu | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/runqemu b/scripts/runqemu
> index c24528eac8..6a36fdc011 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -1715,7 +1715,7 @@ to your build configuration.
>      def run_bitbake_env(self, mach=None, target=''):
>          bitbake = shutil.which('bitbake')
>          if not bitbake:
> -            return
> +            raise RunQemuError("bitbake could not be found in your PATH. Did you forget to source oe-init-build-env?")
>  
>          if not mach:
>              mach = self.get('MACHINE')
> 

Thanks for the patch!

I think there are cases where bitbake isn't needed and runqemu can be
run without it so this change will break those use cases. Bitbake isn't
needed when the path to the qemuboot file and kernel/rootfs is on the
commandline.

I'm wondering if we can detect that and/or put this error message onto
one of the later error paths to hint to the user the issue?

Cheers,

Richard
diff mbox series

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index c24528eac8..6a36fdc011 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1715,7 +1715,7 @@  to your build configuration.
     def run_bitbake_env(self, mach=None, target=''):
         bitbake = shutil.which('bitbake')
         if not bitbake:
-            return
+            raise RunQemuError("bitbake could not be found in your PATH. Did you forget to source oe-init-build-env?")
 
         if not mach:
             mach = self.get('MACHINE')