[OE-core] [PATCH] kernel.bbclass: Tolerate empty INITRAMFS_IMAGE when INITRAMFS_TASK is set

Phil Blundell pb at pbcl.net
Fri Nov 15 13:05:08 UTC 2013


The idiomatic way to reinstate the old-style initramfs handling appears to be to
set:

INITRAMFS_TASK = "${INITRAMFS_IMAGE}:do_rootfs"

in some appropriate place.  However, this causes INITRAMFS_TASK to end up non-empty
even if INITRAMFS_IMAGE is blank, which has two undesirable consequences:

1. The anonymous python in kernel.bbclass attempts to make the empty
string a dependency for do_configure; bitbake doesn't diagnose this
directly but it leads to subsequent build failures with slightly obscure
messages like:

Missing or unbuildable dependency chain was: [..., 'kernel-modules', '']

2. The shell code in kernel_do_compile() will set CONFIG_INITRAMFS_SOURCE to
${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio which clearly will have no useful
result if ${INITRAMFS_IMAGE} is empty.

Fix both of these by making the relevant code check for non-empty values in both
${INITRAMFS_TASK} and ${INITRAMFS_IMAGE} before attempting to use these variables.

Signed-off-by: Phil Blundell <philb at gnu.org>
---
 meta/classes/kernel.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 383043e..ef86c71 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -27,7 +27,7 @@ python __anonymous () {
     #       this INITRAMFS_TASK has circular dependency problems
     #       if the initramfs requires kernel modules
     image_task = d.getVar('INITRAMFS_TASK', True)
-    if image_task:
+    if image_task and d.getVar('INITRAMFS_IMAGE', True):
         d.appendVarFlag('do_configure', 'depends', ' ${INITRAMFS_TASK}')
 }
 
@@ -163,7 +163,7 @@ 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
+	if [ "$use_alternate_initrd" = "" ] && [ "${INITRAMFS_TASK}" != "" ] && [ "${INITRAMFS_IMAGE}" != "" ]; then
 		# The old style way of copying an prebuilt image and building it
 		# is turned on via INTIRAMFS_TASK != ""
 		copy_initramfs
-- 
1.8.4.rc3






More information about the Openembedded-core mailing list