The current image link-creation code will unconditionaly create a link
from .<type> pointing to the .rootfs.<type> output.
This is not compatible with the UBIFS images produced which have
.<type>.img extension since they are not considered to be valid rootfs
images when they are not included in a UBI container.
Check for existence of the link target .rootfs.<type> before creating the
link and fallback to a check for the .<type>.img target after that.
Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
Acked-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Tom Rini <tom_rini@mentor.com>
cmd = "\t#Code for image type " + type + "\n"
cmd += "\t${IMAGE_CMD_" + type + "}\n"
cmd += "\tcd ${DEPLOY_DIR_IMAGE}/\n"
- cmd += "\tln -fs ${IMAGE_NAME}.rootfs." + type + " ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}." + type + "\n\n"
+ cmd += "\tif [ -f ${IMAGE_NAME}.rootfs." + type + " ]; then\n"
+ cmd += "\tln -fs ${IMAGE_NAME}.rootfs." + type + " ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}." + type + "\n"
+ cmd += "\telif [ -f ${IMAGE_NAME}." + type + ".img ]; then\n"
+ cmd += "\tln -fs ${IMAGE_NAME}." + type + ".img ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}." + type + "\n"
+ cmd += "\tfi\n\n"
cmds += bb.data.expand(cmd, localdata)
return cmds