Bug 12909 - kernel.bbclass silently ignores non-existing initramfs when INITRAMFS_IMAGE_BUNDLE=1
Summary: kernel.bbclass silently ignores non-existing initramfs when INITRAMFS_IMAGE_B...
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 2.5.2
Hardware: All Multiple
: Medium+ normal
Target Milestone: 2.7 M3
Assignee: Richard Purdie
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2018-08-31 20:31 UTC by Leon Woestenberg
Modified: 2019-03-11 04:44 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Proposed fix for kernel.bbclass not asserting that bundled initramfs image exists (1.12 KB, patch)
2018-08-31 20:31 UTC, Leon Woestenberg
no flags Details | Diff
Updated fix with more clear user message, telling what might be wrong. (696 bytes, patch)
2018-09-01 21:20 UTC, Leon Woestenberg
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leon Woestenberg 2018-08-31 20:31:42 UTC
Created attachment 4364 [details]
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'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 ("die") because the user explicitly set both INITRAMFS_IMAGE="some-name" and INITRAMFS_IMAGE_BUNDLE = "1"

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 "-${MACHINE}" 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.)
Comment 1 Leon Woestenberg 2018-08-31 21:25:36 UTC
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.
Comment 2 Leon Woestenberg 2018-09-01 20:02:40 UTC
(In reply to comment #1)
> 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.
> 
Foget this remark, as this actually already happens. 

It's the check whether a new initramfs image was copied that is missing and that is important to have.
Comment 3 Leon Woestenberg 2018-09-01 21:20:26 UTC
Created attachment 4365 [details]
Updated fix with more clear user message, telling what might be wrong.
Comment 4 Ross Burton 2018-09-03 11:36:02 UTC
Please send the patch to openembedded-core@lists.openembedded.org as we don't accept patches via bugzilla.
Comment 5 Ross Burton 2018-11-08 16:13:09 UTC
Leon, can you post this to the list please?
Comment 8 Armin Kuster 2019-03-11 04:44:30 UTC
do we need for sumo?