Skip to contentSkip to conversation

create_image() fails with cannot concatenate 'str' and 'NoneType'error

DISCUSSION Walt 2 participants 5 messages Jan 24, 2015 – Jan 27, 2015 3 messages not in the archive

lore
Share & tools
lore

Walt

author
#0 lore raw

I have search the web and found a few references to this problem but I have not yet found a solution.

This is the latest commit.
--------
commit 745cebd635002618d7edd0a109ff07dd2953621a

Author: Richard Purdie <[email protected]>
Date:   Fri Jan 23 14:38:12 2015 +0000

bitbake: siggen: Ensure taskdata default functions exist in base class

The get/set_taskdata functions are now part of the API of the class, ensure they exist in the base class definition so the noop handler works.

[YOCTO #7233]

(Bitbake rev: 9b5b1bd7d77e3f5886f6c557d3b750de1f6d6025)

And here is the error
=====================
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 355, function: create_image

     0351:        execute_pre_post_process(self.d, post_process_cmds)
     0352:
     0353:
     0354:def create_image(d):
 *** 0355:    Image(d).create()
     0356:
     0357:if __name__ == "__main__":
     0358:    """
     0359:    Image creation can be called independent from bitbake 
environment.
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py', 
lineno: 333, function: create
     0329:        execute_pre_post_process(self.d, pre_process_cmds)
     0330:
     0331:        self._remove_old_symlinks()
     0332:

*** 0333: image_cmd_groups = self._get_imagecmds()
0334:
0335: for image_cmds in image_cmd_groups:
0336: # create the images in parallel
0337: nproc = multiprocessing.cpu_count()
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 303, function: _get_imagecmds

     0299:                print "************************"
     0300:                print localdata.getVar("IMAGE_CMD", True)
     0301:                print "************************"
     0302:                print "************************"
 *** 0303:                cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
     0304:                cmds.append(localdata.expand("\tcd 

${DEPLOY_DIR_IMAGE}"))
0305:
0306: if type in cimages:
0307: for ctype in cimages[type]:
Exception: TypeError: cannot concatenate 'str' and 'NoneType' objects

ERROR: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/walt/workspace/wwrelay- rootfs/yocto/build/tmp/work/cubietruck-poky-linux-gnueabi/wigwag-prod- lsb/1.0-r0/temp/log.do_rootfs.13308
ERROR: Task 6 (/home/walt/workspace/wwrelay- rootfs/yocto/build/recipes/images/wigwag-prod-lsb.bb, do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3977 tasks of which 3976 didn't need to be rerun and 1 failed.

#1 lore raw

Hi Walt,

Quoted 61 lines · On Saturday 24 January 2015 17:30:08 Walt wrote:

I have search the web and found a few references to this problem but I have not yet found a solution.

This is the latest commit.
--------
commit 745cebd635002618d7edd0a109ff07dd2953621a

Author: Richard Purdie <[email protected]>
Date:   Fri Jan 23 14:38:12 2015 +0000

bitbake: siggen: Ensure taskdata default functions exist in base class

The get/set_taskdata functions are now part of the API of the class, ensure they exist in the base class definition so the noop handler works.

[YOCTO #7233]

(Bitbake rev: 9b5b1bd7d77e3f5886f6c557d3b750de1f6d6025)

And here is the error
=====================
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 355, function: create_image

     0351:        execute_pre_post_process(self.d, post_process_cmds)
     0352:
     0353:
     0354:def create_image(d):
 *** 0355:    Image(d).create()
     0356:
     0357:if __name__ == "__main__":
     0358:    """
     0359:    Image creation can be called independent from bitbake
environment.
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 333, function: create
     0329:        execute_pre_post_process(self.d, pre_process_cmds)
     0330:
     0331:        self._remove_old_symlinks()
     0332:

*** 0333: image_cmd_groups = self._get_imagecmds()
0334:
0335: for image_cmds in image_cmd_groups:
0336: # create the images in parallel
0337: nproc = multiprocessing.cpu_count()
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 303, function: _get_imagecmds

     0299:                print "************************"
     0300:                print localdata.getVar("IMAGE_CMD", True)
     0301:                print "************************"
     0302:                print "************************"
 *** 0303:                cmds.append("\t" + localdata.getVar("IMAGE_CMD",

True)) 0304: cmds.append(localdata.expand("\tcd
${DEPLOY_DIR_IMAGE}"))
0305:
0306: if type in cimages:
0307: for ctype in cimages[type]:
Exception: TypeError: cannot concatenate 'str' and 'NoneType' objects

Quoted 9 lines

ERROR: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/walt/workspace/wwrelay- rootfs/yocto/build/tmp/work/cubietruck-poky-linux-gnueabi/wigwag-prod- lsb/1.0-r0/temp/log.do_rootfs.13308
ERROR: Task 6 (/home/walt/workspace/wwrelay- rootfs/yocto/build/recipes/images/wigwag-prod-lsb.bb, do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3977 tasks of which 3976 didn't need to be rerun and 1 failed.

What have you got in your value of IMAGE_FSTYPES? It looks to me like there is an invalid value in there. If you aren't sure what it's set to, this command should tell you:

bitbake -e | grep ^IMAGE_FSTYPES=

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 112 lines · On Monday 26 January 2015 13:23:28 Walter Giroir wrote:
Quoted 84 lines · Paul Eggleton
Quoted 73 lines · On Saturday 24 January 2015 17:30:08 Walt wrote:

I have search the web and found a few references to this problem but I have
not yet found a solution.

This is the latest commit.
--------
commit 745cebd635002618d7edd0a109ff07dd2953621a

Author: Richard Purdie <[email protected]>
Date:   Fri Jan 23 14:38:12 2015 +0000

bitbake: siggen: Ensure taskdata default functions exist in base class

The get/set_taskdata functions are now part of the API of the class, ensure they exist in the base class definition so the noop handler works.

   [YOCTO #7233]
   
   (Bitbake rev: 9b5b1bd7d77e3f5886f6c557d3b750de1f6d6025)
   
   Signed-off-by: Richard Purdie <[email protected]>

And here is the error
=====================
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 355, function: create_image

    0351:        execute_pre_post_process(self.d, post_process_cmds)
    0352:
    0353:

    0354:def create_image(d):

*** 0355: Image(d).create()

    0356:
    0357:if __name__ == "__main__":
    0358:    """
    0359:    Image creation can be called independent from bitbake

environment.
File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 333, function: create

    0329:        execute_pre_post_process(self.d, pre_process_cmds)
    0330:
    0331:        self._remove_old_symlinks()

    0332:

*** 0333: image_cmd_groups = self._get_imagecmds()

0334:
0335: for image_cmds in image_cmd_groups:
0336: # create the images in parallel
0337: nproc = multiprocessing.cpu_count()

File: '/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py',
lineno: 303, function: _get_imagecmds

    0299:                print "************************"
    0300:                print localdata.getVar("IMAGE_CMD", True)
    0301:                print "************************"
    0302:                print "************************"

*** 0303: cmds.append("\t" + localdata.getVar("IMAGE_CMD",
True)) 0304: cmds.append(localdata.expand("\tcd
${DEPLOY_DIR_IMAGE}"))

0305:
0306: if type in cimages:

0307: for ctype in cimages[type]:
Exception: TypeError: cannot concatenate 'str' and 'NoneType' objects

Quoted 9 lines

ERROR: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/walt/workspace/wwrelay- rootfs/yocto/build/tmp/work/cubietruck-poky-linux-gnueabi/wigwag-prod- lsb/1.0-r0/temp/log.do_rootfs.13308
ERROR: Task 6 (/home/walt/workspace/wwrelay- rootfs/yocto/build/recipes/images/wigwag-prod-lsb.bb, do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3977 tasks of which 3976 didn't need to be rerun and 1 failed.

Quoted 5 lines

What have you got in your value of IMAGE_FSTYPES? It looks to me like there is an invalid value in there. If you aren't sure what it's set to, this command>
should tell you:
bitbake -e | grep ^IMAGE_FSTYPES=

I have IMAGE_FSTYPES defined in build/conf/local.conf…

Quoted 1 line

grep IMAGE_FSTYPES build/conf/local.conf

IMAGE_FSTYPES = "ext3 tar.gz sunxi-wigwag-sdimg"

When pulling the IMAGE_FSTYPES from the environment with ‘bitbake -e’ I get an extended list

Quoted 1 line

bitbake -e | grep ^IMAGE_FSTYPES

IMAGE_FSTYPES="ext3 tar.gz sunxi-wigwag-sdimg ext3 tar.gz sunxi-sdimg"

Not sure why there are duplicates here unless the definitions in the machines configuration is also added to this list.

It all works with the exception of sunxi-wigwag-relay which is defined in the our own meta-wigwag layer in our layer, meta-wigwag/classes/sdcard_image-sunxi-wigwag.bbclass

Quoted 8 lines

For some reason, I do not believe this bbclass is even being parsed although this layer is defined in the bblayers file.

I intentionally corrupted the bbclass file, reran bitbake and did not receive any errors.

With a few debug statements in image.py, it’s quite clear that sunxi-wigwag-sdimg does not have and IMAGE_CMD

Right. Clearly we should have better error checking here (and I'll look into adding that.) Regarding the class, I can only assume that that class is not being inherited anywhere - it needs to be explicitly inherited, it's not going to be picked up automatically unless the layer does it or you do it in your configuration. Does the documentation for the layer in question not specify how the class is to be used? At least one way would be:

IMAGE_CLASSES += "sdcard_image-sunxi-wigwag"

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 155 lines · On Tuesday 27 January 2015 07:55:56 Walter Giroir wrote:

I am relatively new to the Yocto environment so I’m probably not defining something correctly here.

The IMAGE_CLASSES appears to be configured properly.

bitbake -e | grep ^IMAGE_CLASSES
IMAGE_CLASSES=" sdcard_image-sunxi-wigwag"

I added a few “debug” statements in image.py around line 300

        for fstype_group in fstype_groups:
            image_cmds = []
            for type in fstype_group:
                cmds = []
                subimages = []

                localdata = bb.data.createCopy(self.d)
                localdata.setVar('OVERRIDES', '%s:%s' % (type,
old_overrides)) bb.data.update_data(localdata)
                localdata.setVar('type', type)
                print "************************"
                print "************************"
                print fstype_group
                print type
                print localdata.getVar("IMAGE_CMD", True)
                print "************************"
                print "************************"
                cmds.append("\t" + localdata.getVar("IMAGE_CMD", True))
                cmds.append(localdata.expand("\tcd ${DEPLOY_DIR_IMAGE}"))

And the end of the log.do_rootfs.pid shows the output of the print statements File:
'/home/walt/workspace/wwrelay-rootfs/yocto/meta/lib/oe/image.py', lineno:
305, function: _get_imagecmds 0301: print type

     0302:                print localdata.getVar("IMAGE_CMD", True)
     0303:                print "************************"
     0304:                print "************************"
 *** 0305:                cmds.append("\t" + localdata.getVar("IMAGE_CMD",

True)) 0306: cmds.append(localdata.expand("\tcd
${DEPLOY_DIR_IMAGE}")) 0307:
0308: if type in cimages:
0309: for ctype in cimages[type]:
Exception: TypeError: cannot concatenate 'str' and 'NoneType' objects

DEBUG: Python function do_rootfs finished
ERROR: Function failed: do_rootfs
************************
************************
['tar', 'ext3', 'sunxi-sdimg']
tar
tar -cvf /home/walt/workspace/wwrelay-rootfs/yocto/build/tmp/deploy/images/wigwagrel ay/wigwag-prod-lsb-wigwagrelay-20150127133345.rootfs.tar -C /home/walt/workspace/wwrelay-rootfs/yocto/build/tmp/work/wigwagrelay-poky-l inux-gnueabi/wigwag-prod-lsb/1.0-r0/rootfs . ************************
************************
************************
************************
['tar', 'ext3', 'sunxi-sdimg']
ext3
oe_mkext234fs ext3 -i 4096
************************
************************
************************
************************
['tar', 'ext3', 'sunxi-sdimg']
sunxi-sdimg
None
************************
************************

It looks like it’s not looking at the second group

NOTE: The image creation groups are: [['tar', 'ext3', 'sunxi-sdimg'], ['sunxi-wigwag-sdimg']]

Here are my BBLAYERS

Quoted 1 line

bitbake -e | grep ^BBLAYERS=

BBLAYERS="/home/walt/workspace/wwrelay-rootfs/yocto/meta /home/walt/workspace/wwrelay-rootfs/yocto/meta-yocto /home/walt/workspace/wwrelay-rootfs/yocto/meta-yocto-bsp /home/walt/workspace/wwrelay-rootfs/meta-sunxi /home/walt/workspace/wwrelay-rootfs/meta-wigwag-relay /home/walt/workspace/wwrelay-rootfs/yocto/meta-hob"

Which does contain our layer:
/home/walt/workspace/wwrelay-rootfs/meta-wigwag-relay

The conf file for this layer contains:

Quoted 1 line

cat /home/walt/workspace/wwrelay-rootfs/meta-wigwag-relay/conf/layer.conf

# We have a conf and classes directory, append to BBPATH BBPATH .= ":${LAYERDIR}"

# We have a recipes directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes*/*/*.bb ${LAYERDIR}/recipes*/*/*.bbappend"

BBFILE_COLLECTIONS += "wigwagrelay"
BBFILE_PATTERN_wigwagrelay := "^${LAYERDIR}/"
BBFILE_PRIORITY_wigwagrelay = "10"

The machine conf;

Quoted 3 lines

cat /home/walt/workspace/wwrelay-rootfs/meta-wigwag-relay/conf/machine/wigwag relay.conf

#@TYPE: Machine
#@NAME: WigWag Relay
#@DESCRIPTION: Machine configuration for the WigWag Relay, based on allwinner a10 CPU

# Only has DVI connector for external screen
GUI_MACHINE_CLASS = "bigscreen"

require conf/machine/include/tune-cortexa7.inc
require conf/machine/include/sunxi-wigwag.inc
require conf/machine/include/sunxi-mali.inc

UBOOT_MACHINE = "wigwag_controller_config"
UBOOT_ENTRYPOINT = "0x40008000"
UBOOT_LOADADDRESS = "0x40008000"

#MACH=sun4i
#KERNEL_CONFIG=sun4i_defconfig

SERIAL_CONSOLE = "115200 ttyS0"

MACHINE_FEATURES = "kernel26 apm usbgadget usbhost vfat alsa wifi"

And the contents of sunxi-wigwag.inc add the IMAGE_CLASSES:

cat
/home/walt/workspace/wwrelay-rootfs/meta-wigwag-relay/conf/machine/include/ sunxi-wigwag.inc PREFERRED_PROVIDER_virtual/xserver = "xserver-xorg"

XSERVER = "xserver-xorg \
           xf86-video-fbturbo \
           xf86-input-evdev \
           xf86-input-mouse \
           xf86-input-keyboard"

PREFERRED_PROVIDER_virtual/kernel = "linux"
PREFERRED_VERSION_linux-libc-headers = "3.4.61"

Quoted 6 lines

KERNEL_IMAGETYPE = "uImage"

IMAGE_CLASSES += "sdcard_image-sunxi-wigwag"
IMAGE_FSTYPES += "ext3 tar.gz sunxi-wigwag-sdimg"

MACHINE_EXTRA_RRECOMMENDS = "kernel-modules"

OK, so from what I can see, no IMAGE_CMD is defined for sunxi-sdimg which apparently is in IMAGE_FSTYPES, that's what's actually triggering the error. This error prevents the code from continuing on to the second group.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 2 lines · On Tuesday 27 January 2015 09:43:06 Walter Giroir wrote:

The IMAGE_CMD is defined in the layer’s conf. I can corrupt this file and bitbake never complains so it appears it is never parsed or loaded.

How are you corrupting it? And I presume you mean sdcard_image-sunxi- wigwag.bbclass not the layer's conf.

You can determine for certain whether the layer conf, the machine conf and the bbclass are being parsed by looking at the list of files at the top of the output of this command:

bitbake -e <image> | less

(It's important that you specify the image in the command, because otherwise you won't see anything that's brought in via IMAGE_CLASSES.)

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre