Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] kernel.bbclass: Tolerate empty INITRAMFS_IMAGE when INITRAMFS_TASK is set
@ 2013-11-15 13:05 Phil Blundell
  2013-11-15 13:26 ` Otavio Salvador
  0 siblings, 1 reply; 6+ messages in thread
From: Phil Blundell @ 2013-11-15 13:05 UTC (permalink / raw)
  To: openembedded-core

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@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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-11-22 22:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 13:05 [PATCH] kernel.bbclass: Tolerate empty INITRAMFS_IMAGE when INITRAMFS_TASK is set Phil Blundell
2013-11-15 13:26 ` Otavio Salvador
2013-11-16 18:09   ` Phil Blundell
2013-11-18 12:26     ` Richard Purdie
2013-11-18 23:26       ` Andrea Adami
2013-11-22 22:25         ` Andrea Adami

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox