Patchwork [v2] kernel.bbclass: Allow INITRAMFS_TASK to trigger copy initramfs code

login
register
mail settings
Submitter Jason Wessel
Date Sept. 27, 2013, 9:32 p.m.
Message ID <1380317520-2111-1-git-send-email-jason.wessel@windriver.com>
Download mbox | patch
Permalink /patch/59093/
State Accepted
Commit 072c4e123f878d57fb7f767d3888b38461f91a27
Headers show

Comments

Jason Wessel - Sept. 27, 2013, 9:32 p.m.
Activating the INITRAMFS_TASK can cause circular dependencies, but
that is up to the end user to resolve in recipes.  The INITRAMFS_TASK
should also trigger immediate linking of the cpio task in the first
compile pass.  This was a subtle regression introduced by: 609d5a9ab
(kernel.bbclass, image.bbclass: Implement kernel INITRAMFS dependency
and bundling).

This patch restores the previous behavior and only affects the
INITRAMFS_TASK which is not set by any of the default build profiles
in oe-core.

Reviewed-by: Andrea Adami <andrea.adami@gmail.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 meta/classes/kernel.bbclass |    8 ++++++++
 1 file changed, 8 insertions(+)
Andrea Adami - Sept. 27, 2013, 9:42 p.m.
On Fri, Sep 27, 2013 at 11:32 PM, Jason Wessel
<jason.wessel@windriver.com> wrote:
> Activating the INITRAMFS_TASK can cause circular dependencies, but
> that is up to the end user to resolve in recipes.  The INITRAMFS_TASK
> should also trigger immediate linking of the cpio task in the first
> compile pass.  This was a subtle regression introduced by: 609d5a9ab
> (kernel.bbclass, image.bbclass: Implement kernel INITRAMFS dependency
> and bundling).
>
> This patch restores the previous behavior and only affects the
> INITRAMFS_TASK which is not set by any of the default build profiles
> in oe-core.
>
> Reviewed-by: Andrea Adami <andrea.adami@gmail.com>
> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
> ---
>  meta/classes/kernel.bbclass |    8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 8cf66ce..4acfb7e 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -83,6 +83,8 @@ KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(d.g
>
>  copy_initramfs() {
>         echo "Copying initramfs into ./usr ..."
> +       # In case the directory is not created yet from the first pass compile:
> +       mkdir -p ${B}/usr
>         # Find and use the first initramfs image archive type we find
>         rm -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
>         for img in cpio.gz cpio.lzo cpio.lzma cpio.xz; do
> @@ -156,6 +158,12 @@ kernel_do_compile() {
>         # different initramfs image.  The way to do that in the kernel
>         # is to specify:
>         # make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio
> +       if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then
> +               # The old style way of copying an prebuilt image and building it
> +               # is turned on via INTIRAMFS_TASK != ""
> +               copy_initramfs
> +               use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
> +       fi
>         oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
>         if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then
>                 gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}"
> --
> 1.7.9.5
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core

Thanks

Tested by: Andrea Adami <andrea.adami@gmail.com>
Acked by: Andrea Adami <andrea.adami@gmail.com>

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 8cf66ce..4acfb7e 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -83,6 +83,8 @@  KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(d.g
 
 copy_initramfs() {
 	echo "Copying initramfs into ./usr ..."
+	# In case the directory is not created yet from the first pass compile:
+	mkdir -p ${B}/usr
 	# Find and use the first initramfs image archive type we find
 	rm -f ${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
 	for img in cpio.gz cpio.lzo cpio.lzma cpio.xz; do
@@ -156,6 +158,12 @@  kernel_do_compile() {
 	# different initramfs image.  The way to do that in the kernel
 	# is to specify:
 	# make ...args... CONFIG_INITRAMFS_SOURCE=some_other_initramfs.cpio
+	if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] ; then
+		# The old style way of copying an prebuilt image and building it
+		# is turned on via INTIRAMFS_TASK != ""
+		copy_initramfs
+		use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
+	fi
 	oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
 	if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then
 		gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}"