| Summary: | Document how to use initramfs features | ||
|---|---|---|---|
| Product: | [Documentation] BSP Guide | Reporter: | Paul Eggleton <bluelightning> |
| Component: | bsp-docs | Assignee: | California Sullivan <california.l.sullivan> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Medium | CC: | andrea.adami, dvhart, its.muhammadosama, jason.wessel, randy.macleod, sgw, srifenbark |
| Version: | 1.8 | ||
| Target Milestone: | 2.3 M2 | ||
| Hardware: | All | ||
| OS: | Multiple | ||
| Whiteboard: | 25 Jan 2017: RESOLVED | ||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | Done (doc changes complete) | |
|
Description
Paul Eggleton
2014-12-22 14:46:26 UTC
documentation only, so putting this in M4. Hi, Will work on this when I get raw information. Scott BTW - Some updating has been done to the INITRAMFS_IMAGE (http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#var-INITRAMFS_IMAGE) and the INITRAMFS_FSTYPES (http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#var-INITRAMFS_FSTYPES) variables. You should consider these in the solution as well. Thanks, Scott Oh.. also, the description for INITRAMFS_IMAGE_BUNDLE has been enhanced as well - http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#var-INITRAMFS_IMAGE_BUNDLE. Scott Changing to NEEDINFO as I need some raw steps for procedures. Scott I can add my 2 cents adding some little documentation about the old-way of embedding an initramfs in the kernel. Links to kernels 3.8 are now outdated. https://github.com/kexecboot/kexecboot/wiki/oe-yocto It appears there is only an hint in kernel.bbclass about this: # NOTE: setting INITRAMFS_TASK is for backward compatibility # The preferred method is to set INITRAMFS_IMAGE, because # this INITRAMFS_TASK has circular dependency problems # if the initramfs requires kernel modules If you think, you could expand a bit in the documentation. Thanks for the extra bit Andrea... I still need information to move forward on this issue. Scott I have been playing with initramfs stuff for other work recently, and I have more to add that might be of use...
To build an initramfs, and bundle it into the kernel, use the following variables:
INITRAMFS_IMAGE_BUNDLE = "1"
INITRAMFS_IMAGE = "<name of image recipe>"
With the INITRAMFS_IMAGE_BUNDLE flag set, the initramfs created by the recipe defined by INITRAMFS_IMAGE is unpacked into the ${B}/usr/ directory. That is then passed to the kernel's make via the CONFIG_INTRAMFS_SOURCE option, allowing it to be built in to the kernel in the normal way.
The recipe that INITRAMFS_IMAGE points to must produce a .cpio.gz, .cpio.tar, .cpio.lz4, .cpio.lzma, or .cpio.xz file (I also saw a patch adding support for plain uncompressed .cpio files recently, but not sure if that's in core yet). This can be done by setting the IMAGE_FSTYPES variable to one or more of the above.
Adding things to the initramfs image (in its recipe) should be done via PACKAGE_INSTALL = rather than IMAGE_INSTALL. PACKAGE_INSTALL gives more direct control of what is added to the image, as image.bbclass and/or core-image.bbclass set defaults that you do not necessarily want.
I think I have a decent general understanding of it now, so if you have any specific questions please do ask.
Hi, I looked at the example in the link in Comment 6. It uses INITRAMFS_TASK, which is noted as having some circular issues. So, I am not sure what to incorporate in the new section from that example. I did put that "NOTE" you mentioned in the comment as a note in the new section on how to build an initramfs. Changes have been made: * The main new "how-to" section to create initramfs images - http://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#building-an-initramfs-image * Change to the kernel.bbclass description to include a cross-reference to the new "how-to" section in the dev-manual - http://www.yoctoproject.org/docs/2.3/ref-manual/ref-manual.html#ref-classes-kernel Pretty much all the variables cross-referenced in the new "how-to" section now link back to the new section for explanation on how to build an initramfs. Let me know if there are any changes or corrections needed. thanks, Scott I think that note is enough. Thanks. I'd add two observations: !) "To build an initramfs image and bundle it into the kernel, set the following variables: " It is not clear that you must set INITRAMFS_IMAGE_BUNDLE = "1" in local.conf while INITRAMFS_IMAGE = "image_recipe_name" cab ne set in machine.conf or in the image. 2) "you produce one of these .cpio.* files by setting the IMAGE_FSTYPES variable" I think that the right var to use is INITRAMFS_FSTYPES This one can be set in machine.conf or even in the image. Cheers Andrea Andrea, Thanks for the feedback. See http://www.yoctoproject.org/docs/2.3/dev-manual/dev-manual.html#building-an-initramfs-image for the changes and let me know if there is anything else I need to fix. Scott Looks good to me as well. Cal, I set the doc flag to "done" since you set the issue to RESOLVED. Also, updated the Whiteboard. Thanks, Scott |