<div dir="ltr"><div><div>Hi,<br><br></div>I need do more work on this patch, and will send the V1 soon, please ignore this for now.<br><br></div>//Ming Liu<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-12-30 0:05 GMT+01:00 Ming Liu <span dir="ltr">&lt;<a href="mailto:liu.ming50@gmail.com" target="_blank">liu.ming50@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ming Liu &lt;<a href="mailto:peter.x.liu@external.atlascopco.com">peter.x.liu@external.atlascopco.com</a>&gt;<br>
<br>
So far, there is not a workable way to package the initramfs bundled kernel<br>
image, the only place is tmp/deploy from where we could get it, but if a<br>
user want to add it into a certain image, there is no guarantee that he<br>
will achieve it because a explicit dependency is missing between package<br>
and bundle_initramfs, and this was designed to avoid introducing circular<br>
dependencies when using kernel modules in the initramfs <a href="http://image.bb" rel="noreferrer" target="_blank">image.bb</a> that is<br>
caused by kernel.bbclass trying to build the initramfs before the kernel<br>
packaging.<br>
<br>
To fix this problem, the idea is to split the initramfs bundled kernel<br>
packaging to a new recipe, make the do_install depend on kernel&#39;s deploy<br>
task, then with the following config:<br>
<br>
IMAGE_INSTALL_append = &quot;kernel-initramfs&quot;<br>
<br>
The initramfs bundled kernel could be added to the image without<br>
introducing any circular dependencies.<br>
<br>
Signed-off-by: Ming Liu &lt;<a href="mailto:peter.x.liu@external.atlascopco.com">peter.x.liu@external.atlascopco.com</a>&gt;<br>
---<br>
 meta/recipes-kernel/linux/<a href="http://kernel-initramfs.bb" rel="noreferrer" target="_blank">kernel-initramfs.bb</a> | 50 +++++++++++++++++++++++++++<br>
 1 file changed, 50 insertions(+)<br>
 create mode 100644 meta/recipes-kernel/linux/<a href="http://kernel-initramfs.bb" rel="noreferrer" target="_blank">kernel-initramfs.bb</a><br>
<br>
diff --git a/meta/recipes-kernel/linux/<a href="http://kernel-initramfs.bb" rel="noreferrer" target="_blank">kernel-initramfs.bb</a> b/meta/recipes-kernel/linux/<a href="http://kernel-initramfs.bb" rel="noreferrer" target="_blank">kernel-initramfs.bb</a><br>
new file mode 100644<br>
index 0000000..481b142<br>
--- /dev/null<br>
+++ b/meta/recipes-kernel/linux/<a href="http://kernel-initramfs.bb" rel="noreferrer" target="_blank">kernel-initramfs.bb</a><br>
@@ -0,0 +1,50 @@<br>
+SUMMARY = &quot;Initramfs bundled kernel image&quot;<br>
+DESCRIPTION = &quot;When built, it packages a initramfs bundled kernel image of the \<br>
+preferred virtual/kernel provider.&quot;<br>
+<br>
+SECTION = &quot;kernel&quot;<br>
+<br>
+LICENSE = &quot;GPLv2&quot;<br>
+LIC_FILES_CHKSUM = &quot;file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6&quot;<br>
+<br>
+inherit linux-kernel-base<br>
+<br>
+# Whilst not a module, this ensures we don&#39;t get multilib extended (which would make no sense)<br>
+inherit module-base<br>
+<br>
+S = &quot;${STAGING_KERNEL_DIR}&quot;<br>
+B = &quot;${WORKDIR}/build&quot;<br>
+<br>
+KERNEL_VERSION = &quot;${@get_kernelversion_headers(&#39;${S}&#39;)}&quot;<br>
+<br>
+PACKAGES = &quot;kernel-initramfs&quot;<br>
+FILES_${PN} = &quot;/boot/${KERNEL_IMAGETYPE}*&quot;<br>
+<br>
+PACKAGE_ARCH = &quot;${MACHINE_ARCH}&quot;<br>
+<br>
+# Skip processing of this recipe if INITRAMFS_IMAGE or INITRAMFS_IMAGE_BUNDLE<br>
+# is not set correctly, to avoid generate a single empty package which makes<br>
+# no sense.<br>
+python __anonymous () {<br>
+    if not d.getVar(&#39;INITRAMFS_IMAGE&#39;, True) or d.getVar(&#39;INITRAMFS_IMAGE_BUNDLE&#39;, True) != &#39;1&#39;:<br>
+        raise bb.parse.SkipPackage(&quot;Set INITRAMFS_IMAGE and INITRAMFS_IMAGE_BUNDLE to enable it&quot;)<br>
+}<br>
+<br>
+# Need the output of deploy.<br>
+do_install[depends] += &quot;virtual/kernel:do_deploy&quot;<br>
+<br>
+# We only need the packaging tasks - disable the rest<br>
+do_fetch[noexec] = &quot;1&quot;<br>
+do_unpack[noexec] = &quot;1&quot;<br>
+do_patch[noexec] = &quot;1&quot;<br>
+do_configure[noexec] = &quot;1&quot;<br>
+do_compile[noexec] = &quot;1&quot;<br>
+do_populate_sysroot[noexec] = &quot;1&quot;<br>
+<br>
+do_install() {<br>
+       if [ ! -z &quot;${INITRAMFS_IMAGE}&quot; -a x&quot;${INITRAMFS_IMAGE_BUNDLE}&quot; = x1 ]; then<br>
+               echo &quot;Copying initramfs bundled kernel image from ${DEPLOY_DIR_IMAGE}...&quot;<br>
+               install -d ${D}/boot<br>
+               install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin ${D}/boot<br>
+       fi<br>
+}<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
</font></span></blockquote></div><br></div>