<?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>12909</bug_id>
          
          <creation_ts>2018-08-31 20:31:42 +0000</creation_ts>
          <short_desc>kernel.bbclass silently ignores non-existing initramfs when INITRAMFS_IMAGE_BUNDLE=1</short_desc>
          <delta_ts>2019-03-11 04:44:30 +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>2.5.2</version>
          <rep_platform>All</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>2.7 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Leon Woestenberg">leon</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>akuster</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ross.burton</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>81475</commentid>
    <comment_count>0</comment_count>
      <attachid>4364</attachid>
    <who name="Leon Woestenberg">leon</who>
    <bug_when>2018-08-31 20:31:42 +0000</bug_when>
    <thetext>Created attachment 4364
Proposed fix for kernel.bbclass not asserting that bundled initramfs image exists

The code in kernel.bbclass does a few things wrong:

1)  
If ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE_NAME}.cpio does not exist, nor any of the compressed variants, nothing is copied to kernel build&apos;s ./usr directory.

The code does not fail, but silently proceeds without a bundled initramfs.

(Or, an older initramfs that was copied in ./usr earlier.)

The expected outcome is that the build stops (&quot;die&quot;) because the user explicitly set both INITRAMFS_IMAGE=&quot;some-name&quot; and INITRAMFS_IMAGE_BUNDLE = &quot;1&quot;

Typical use-case is when the user has set INITRAMFS_IMAGE but not  has set  INITRAMFS_IMAGE_NAME. (The kernel class will create INITRAMFS_IMAGE_NAME from INITRAMFS_IMAGE appending &quot;-${MACHINE}&quot; by default, which might not be what the user did.)

2) If an initramfs is found, contrary to the comments, it does not stop at the first uncompressed/compressed cpio image found. Instead it keeps processing all.
(This is a much less critical bug.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81476</commentid>
    <comment_count>1</comment_count>
    <who name="Leon Woestenberg">leon</who>
    <bug_when>2018-08-31 21:25:36 +0000</bug_when>
    <thetext>I have given this more thoughts and tests. I think we should also delete the existing ./usr/${INITRAMFS_IMAGE_NAME}.cpio in the build, before we are copying the to-be-bundled initramfs image.

This way, we can be certain that the final check [ -f ./usr/${INITRAMFS_IMAGE_NAME}.cpio ] checks for a *copied* initramfs, rather then possibly a left-over. (This can happen when the user is explicitly running separate tasks.) We want to bundle task to be stand-alone-correct.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81479</commentid>
    <comment_count>2</comment_count>
    <who name="Leon Woestenberg">leon</who>
    <bug_when>2018-09-01 20:02:40 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I have given this more thoughts and tests. I think we should also delete the
&gt; existing ./usr/${INITRAMFS_IMAGE_NAME}.cpio in the build, before we are
&gt; copying the to-be-bundled initramfs image.
&gt; 
Foget this remark, as this actually already happens. 

It&apos;s the check whether a new initramfs image was copied that is missing and that is important to have.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81480</commentid>
    <comment_count>3</comment_count>
      <attachid>4365</attachid>
    <who name="Leon Woestenberg">leon</who>
    <bug_when>2018-09-01 21:20:26 +0000</bug_when>
    <thetext>Created attachment 4365
Updated fix with more clear user message, telling what might be wrong.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81488</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2018-09-03 11:36:02 +0000</bug_when>
    <thetext>Please send the patch to openembedded-core@lists.openembedded.org as we don&apos;t accept patches via bugzilla.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82075</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2018-11-08 16:13:09 +0000</bug_when>
    <thetext>Leon, can you post this to the list please?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83119</commentid>
    <comment_count>6</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-02-25 23:04:14 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=a5b7c86f23110cad2aa1d4ee378058ca1eb5f1c1</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83237</commentid>
    <comment_count>7</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-03-11 04:44:03 +0000</bug_when>
    <thetext>back ported to stable/thud-next

http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=stable/thud-next&amp;id=ec52ff0ddc11bbfe226da528dfdc8bb75615530f</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83238</commentid>
    <comment_count>8</comment_count>
    <who name="Armin Kuster">akuster</who>
    <bug_when>2019-03-11 04:44:30 +0000</bug_when>
    <thetext>do we need for sumo?</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4364</attachid>
            <date>2018-08-31 20:31:42 +0000</date>
            <delta_ts>2018-09-01 21:20:26 +0000</delta_ts>
            <desc>Proposed fix for kernel.bbclass not asserting that bundled initramfs image exists</desc>
            <filename>kernel-bbclass-assert-bundled-initramfs-exists.patch</filename>
            <type>text/plain</type>
            <size>1147</size>
            <attacher name="Leon Woestenberg">leon</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL21ldGEvY2xhc3Nlcy9rZXJuZWwuYmJjbGFzcyBiL21ldGEvY2xhc3Nlcy9r
ZXJuZWwuYmJjbGFzcwppbmRleCA3OGQ2YzMwLi5jNDc1MjQ0IDEwMDY0NAotLS0gYS9tZXRhL2Ns
YXNzZXMva2VybmVsLmJiY2xhc3MKKysrIGIvbWV0YS9jbGFzc2VzL2tlcm5lbC5iYmNsYXNzCkBA
IC0xOTAsNyArMTkwLDkgQEAgY29weV9pbml0cmFtZnMoKSB7CiAJIyBGaW5kIGFuZCB1c2UgdGhl
IGZpcnN0IGluaXRyYW1mcyBpbWFnZSBhcmNoaXZlIHR5cGUgd2UgZmluZAogCXJtIC1mICR7Qn0v
dXNyLyR7SU5JVFJBTUZTX0lNQUdFX05BTUV9LmNwaW8KIAlmb3IgaW1nIGluIGNwaW8gY3Bpby5n
eiBjcGlvLmx6NCBjcGlvLmx6byBjcGlvLmx6bWEgY3Bpby54ejsgZG8KKwkJZWNobyAiU2VlaW5n
IGlmICR7REVQTE9ZX0RJUl9JTUFHRX0vJHtJTklUUkFNRlNfSU1BR0VfTkFNRX0uJGltZyBleGlz
dHMuLi4iCiAJCWlmIFsgLWUgIiR7REVQTE9ZX0RJUl9JTUFHRX0vJHtJTklUUkFNRlNfSU1BR0Vf
TkFNRX0uJGltZyIgXTsgdGhlbgorCQkJZWNobyAiQ29weWluZyAke0RFUExPWV9ESVJfSU1BR0V9
LyR7SU5JVFJBTUZTX0lNQUdFX05BTUV9LiRpbWcgaW50byAuL3VzciAuLi4iCiAJCQljcCAke0RF
UExPWV9ESVJfSU1BR0V9LyR7SU5JVFJBTUZTX0lNQUdFX05BTUV9LiRpbWcgJHtCfS91c3IvLgog
CQkJY2FzZSAkaW1nIGluCiAJCQkqZ3opCkBAIC0yMTksOSArMjIxLDExIEBAIGNvcHlfaW5pdHJh
bWZzKCkgewogCQkJCWJyZWFrCiAJCQkJOzsKIAkJCWVzYWMKKwkJCWJyZWFrCiAJCWZpCiAJZG9u
ZQotCWVjaG8gIkZpbmlzaGVkIGNvcHkgb2YgaW5pdHJhbWZzIGludG8gLi91c3IiCisJIyBWZXJp
ZnkgdGhhdCB0aGUgYWJvdmUgbG9vcCBmb3VuZCBhIGluaXRyYW1mcywgZmFpbCBvdGhlcndpc2UK
KwlbIC1mICR7Qn0vdXNyLyR7SU5JVFJBTUZTX0lNQUdFX05BTUV9LmNwaW8gXSAmJiBlY2hvICJG
aW5pc2hlZCBjb3B5IG9mIGluaXRyYW1mcyBpbnRvIC4vdXNyIiB8fCBkaWUgIkZhaWxlZCB0byBj
b3B5ICR7SU5JVFJBTUZTX0lNQUdFX05BTUV9LmNwaW8gaW50byAuL3VzciIKIH0KIAogSU5JVFJB
TUZTX0JBU0VfTkFNRSA/PSAiaW5pdHJhbWZzLSR7UFZ9LSR7UFJ9LSR7TUFDSElORX0tJHtEQVRF
VElNRX0iCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>4365</attachid>
            <date>2018-09-01 21:20:26 +0000</date>
            <delta_ts>2018-09-01 21:20:26 +0000</delta_ts>
            <desc>Updated fix with more clear user message, telling what might be wrong.</desc>
            <filename>kernel-bbclass-assert-bundled-initramfs-exists.patch</filename>
            <type>text/plain</type>
            <size>696</size>
            <attacher name="Leon Woestenberg">leon</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL21ldGEvY2xhc3Nlcy9rZXJuZWwuYmJjbGFzcyBiL21ldGEvY2xhc3Nlcy9r
ZXJuZWwuYmJjbGFzcwppbmRleCA3OGQ2YzMwLi5iMzQxNzMzIDEwMDY0NAotLS0gYS9tZXRhL2Ns
YXNzZXMva2VybmVsLmJiY2xhc3MKKysrIGIvbWV0YS9jbGFzc2VzL2tlcm5lbC5iYmNsYXNzCkBA
IC0yMTksOSArMjE5LDExIEBAIGNvcHlfaW5pdHJhbWZzKCkgewogCQkJCWJyZWFrCiAJCQkJOzsK
IAkJCWVzYWMKKwkJCWJyZWFrCiAJCWZpCiAJZG9uZQotCWVjaG8gIkZpbmlzaGVkIGNvcHkgb2Yg
aW5pdHJhbWZzIGludG8gLi91c3IiCisJIyBWZXJpZnkgdGhhdCB0aGUgYWJvdmUgbG9vcCBmb3Vu
ZCBhIGluaXRyYW1mcywgZmFpbCBvdGhlcndpc2UKKwlbIC1mICR7Qn0vdXNyLyR7SU5JVFJBTUZT
X0lNQUdFX05BTUV9LmNwaW8gXSAmJiBlY2hvICJGaW5pc2hlZCBjb3B5IG9mIGluaXRyYW1mcyBp
bnRvIC4vdXNyIiB8fCBkaWUgIkNvdWxkIG5vdCBmaW5kIGFueSAke0RFUExPWV9ESVJfSU1BR0V9
LyR7SU5JVFJBTUZTX0lNQUdFX05BTUV9LmNwaW97Lmd6fC5sejR8Lmx6b3wubHptYXwueHopIGZv
ciBidW5kbGluZzsgSU5JVFJBTUZTX0lNQUdFX05BTUUgbWlnaHQgYmUgd3JvbmcuIgogfQogCiBJ
TklUUkFNRlNfQkFTRV9OQU1FID89ICJpbml0cmFtZnMtJHtQVn0tJHtQUn0tJHtNQUNISU5FfS0k
e0RBVEVUSU1FfSIK
</data>

          </attachment>
      

    </bug>

</bugzilla>