<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>15525</bug_id>
          
          <creation_ts>2024-06-21 08:48:02 +0000</creation_ts>
          <short_desc>Sometimes wrong kernel selected on QEmu when bundling an InitRamFS</short_desc>
          <delta_ts>2025-06-05 15:27:00 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>core</component>
          <version>5.0</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="pasweistorz">Pascal.Weisser.ext</reporter>
          <assigned_to name="pasweistorz">Pascal.Weisser.ext</assigned_to>
          <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>Pascal.Weisser.ext</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99241</commentid>
    <comment_count>0</comment_count>
    <who name="pasweistorz">Pascal.Weisser.ext</who>
    <bug_when>2024-06-21 08:48:02 +0000</bug_when>
    <thetext>Hi,

we&apos;re having an issue when using QEmu and an InitRamFS bundled into the kernel. We&apos;re using the following additional lines in local.conf:

INITRAMFS_IMAGE_BUNDLE = &quot;1&quot;
INITRAMFS_IMAGE = &quot;core-image-minimal-initramfs&quot;

When we build the core-image-full-cmdline image the first time everything works as expected. But when we make a change in a script of the initramfs-framework which is packaged into the InitRamFS afterwards and build again the wrong kernel is selected (the kernel without the InitRamFS).

I think the reason is the following:

When building the first time the file core-image-full-cmdline-qemux86-64.rootfs.qemuboot.conf is poining to contains a line like this:

qb_default_kernel = bzImage-initramfs--6.6.23+git0+f7f00b22ef_2d01bc1d4e-r0-qemux86-64-20240614132425.bin

The reason is that the realpath instead of the symlink is written to the qemuboot.conf file [1].

When a change is made to a script of the initramfs-framework the core-image-minimal-initramfs is built again and bundled into the kernel. That creates a new kernel and the previous kernel referenced in the qemuboot.conf file of the core-image-full-cmdline image won&apos;t exist anymore. The qemuboot.conf file isn&apos;t adapted to that change.

When starting QEmu the qemuboot.conf file is evaluated. Since the kernel referenced by qb_default_kernel doesn&apos;t exist QEmu falls back to a kernel whose name is starting with bzImage. In our case a kernel that doesn&apos;t contain the InitRamFS is selected.

As the realpath of the kernel symlink is used as value for qb_default_kernel instead of the value of QB_DEFAULT_KERNEL itself a solution might be to make the do_write_qemuboot_conf task dependent on all variables that go into the value for qb_default_kernel which is written to qemuboot.conf. That way, the qemuboot.conf would be recreated when the realpath of the file QB_DEFAULT_KERNEL points to changes.

This issue might be related to https://bugzilla.yoctoproject.org/show_bug.cgi?id=14520.

[1]: https://git.yoctoproject.org/poky/tree/meta/classes-recipe/qemuboot.bbclass#n176</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99277</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-06-27 14:38:59 +0000</bug_when>
    <thetext>You are on the right track with adding the missing dependencies variables.
Can you continue with that and send a patch to the email list or ask for help there if you get stuck?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99312</commentid>
    <comment_count>2</comment_count>
    <who name="pasweistorz">Pascal.Weisser.ext</who>
    <bug_when>2024-07-03 10:59:24 +0000</bug_when>
    <thetext>I&apos;ve submitted a patch today to the openembedded-core@lists.openembedded.org mailing list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100088</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-10-31 15:09:23 +0000</bug_when>
    <thetext>Bulk move of 5.1 bugs to 5.2. -- YP bug review (Randy)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102165</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-06-05 15:27:00 +0000</bug_when>
    <thetext>❯ git show 2e9e8f6fb3
commit 2e9e8f6fb3415f9aac6b5f96e8e7c8d9ced5beb5
Author: Weisser, Pascal.ext &lt;Pascal.Weisser.ext@karlstorz.com&gt;
Date:   Wed Jul 3 06:56:03 2024

    qemuboot: Trigger write_qemuboot_conf task on changes of kernel image realpath
    
    The qemuboot.conf file contains the realpath of the kernel image
    referenced by QB_DEFAULT_KERNEL. So, it must be recreated in case the
    realpath of the referenced kernel image changes.
    
    The variables KERNEL_IMAGE_NAME and KERNEL_IMAGE_BIN_EXT determine the
    realpath of the kernel image relative to DEPLOY_DIR_IMAGE. Adding both of
    them to the vardeps of the write_qemuboot_conf task triggers the
    write_qemuboot_conf task in case the realpath of the kernel image
    referenced by QB_DEFAULT_KERNEL changes.
    
    Fixes: [YOCTO 15525]
    
    (From OE-Core rev: f8b3975a9ce36ea7af5fd76243a823da2842415b)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>