bitbake: cooker: Overwrite IMAGE_BASENAME to default in custom image
This solves a problem of custom images which inherit a base image with IMAGE_BASENAME overwritten in their recipe by a different value than its default one: ${PN}. The value of IMAGE_BASE causes a crash when hob will try to create symbolic links to the resulting images from the deploy directory, because it will look for names similar to <original_recipe_name>-edited-timestamp-machine.rootfs.* which might be different from the actual resulting image. The solution is to simply overwrite IMAGE_BASENAME in the custom recipe to the default value in the case IMAGE_BASENAME is found in the base recipe. Some recipes which were affected by this problem are those from meta-fsl-demos (e.g.: fsl-image-test). [YOCTO #6017] (Bitbake rev: e42ee93519000f827be49659b6b5fb7717b3d592) Signed-off-by: Marius Avram <marius.avram@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
07231022e2
commit
56c776de3b
|
@ -1228,6 +1228,7 @@ class BBCooker:
|
||||||
'''
|
'''
|
||||||
Create a new image with a "require"/"inherit" base_image statement
|
Create a new image with a "require"/"inherit" base_image statement
|
||||||
'''
|
'''
|
||||||
|
import re
|
||||||
if timestamp:
|
if timestamp:
|
||||||
image_name = os.path.splitext(image)[0]
|
image_name = os.path.splitext(image)[0]
|
||||||
timestr = time.strftime("-%Y%m%d-%H%M%S")
|
timestr = time.strftime("-%Y%m%d-%H%M%S")
|
||||||
|
@ -1238,9 +1239,14 @@ class BBCooker:
|
||||||
else:
|
else:
|
||||||
dest = image
|
dest = image
|
||||||
|
|
||||||
|
basename = False
|
||||||
if base_image:
|
if base_image:
|
||||||
with open(base_image, 'r') as f:
|
with open(base_image, 'r') as f:
|
||||||
require_line = f.readline()
|
require_line = f.readline()
|
||||||
|
p = re.compile("IMAGE_BASENAME *=")
|
||||||
|
for line in f:
|
||||||
|
if p.search(line):
|
||||||
|
basename = True
|
||||||
|
|
||||||
with open(dest, "w") as imagefile:
|
with open(dest, "w") as imagefile:
|
||||||
if base_image is None:
|
if base_image is None:
|
||||||
|
@ -1259,6 +1265,11 @@ class BBCooker:
|
||||||
description_var = "DESCRIPTION = \"" + description + "\"\n"
|
description_var = "DESCRIPTION = \"" + description + "\"\n"
|
||||||
imagefile.write(description_var)
|
imagefile.write(description_var)
|
||||||
|
|
||||||
|
if basename:
|
||||||
|
# If this is overwritten in a inherited image, reset it to default
|
||||||
|
image_basename = "IMAGE_BASENAME = \"${PN}\"\n"
|
||||||
|
imagefile.write(image_basename)
|
||||||
|
|
||||||
self.state = state.initial
|
self.state = state.initial
|
||||||
if timestamp:
|
if timestamp:
|
||||||
return timestr
|
return timestr
|
||||||
|
|
Loading…
Reference in New Issue