<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"><<a href="mailto:liu.ming50@gmail.com" target="_blank">liu.ming50@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ming Liu <<a href="mailto:peter.x.liu@external.atlascopco.com">peter.x.liu@external.atlascopco.com</a>><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's deploy<br>
task, then with the following config:<br>
<br>
IMAGE_INSTALL_append = "kernel-initramfs"<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 <<a href="mailto:peter.x.liu@external.atlascopco.com">peter.x.liu@external.atlascopco.com</a>><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 = "Initramfs bundled kernel image"<br>
+DESCRIPTION = "When built, it packages a initramfs bundled kernel image of the \<br>
+preferred virtual/kernel provider."<br>
+<br>
+SECTION = "kernel"<br>
+<br>
+LICENSE = "GPLv2"<br>
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"<br>
+<br>
+inherit linux-kernel-base<br>
+<br>
+# Whilst not a module, this ensures we don't get multilib extended (which would make no sense)<br>
+inherit module-base<br>
+<br>
+S = "${STAGING_KERNEL_DIR}"<br>
+B = "${WORKDIR}/build"<br>
+<br>
+KERNEL_VERSION = "${@get_kernelversion_headers('${S}')}"<br>
+<br>
+PACKAGES = "kernel-initramfs"<br>
+FILES_${PN} = "/boot/${KERNEL_IMAGETYPE}*"<br>
+<br>
+PACKAGE_ARCH = "${MACHINE_ARCH}"<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('INITRAMFS_IMAGE', True) or d.getVar('INITRAMFS_IMAGE_BUNDLE', True) != '1':<br>
+ raise bb.parse.SkipPackage("Set INITRAMFS_IMAGE and INITRAMFS_IMAGE_BUNDLE to enable it")<br>
+}<br>
+<br>
+# Need the output of deploy.<br>
+do_install[depends] += "virtual/kernel:do_deploy"<br>
+<br>
+# We only need the packaging tasks - disable the rest<br>
+do_fetch[noexec] = "1"<br>
+do_unpack[noexec] = "1"<br>
+do_patch[noexec] = "1"<br>
+do_configure[noexec] = "1"<br>
+do_compile[noexec] = "1"<br>
+do_populate_sysroot[noexec] = "1"<br>
+<br>
+do_install() {<br>
+ if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then<br>
+ echo "Copying initramfs bundled kernel image from ${DEPLOY_DIR_IMAGE}..."<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>