Since version 3.0.0 of dosfstools, mkdosfs opens the to-be-filesystem
file with O_EXCL. Since the filesystem is also opened with O_CREAT,
the -C option of mkdosfs can only succeed if FATIMG does not exists.
Thus, delete any previous FATIMG file. The file can be safely deleted
as we are inside build_fat_img because we want to create an new
FATIMG.

Signed-off-by: Ricardo Neri <[email protected]>
---
 meta/classes/bootimg.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index 0a4546e..975973b 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -251,6 +251,12 @@ build_fat_img() {
                FATSIZE="-F 32"
        fi
 
+       # mkdosfs will fail if ${FATIMG} exists. Since we are creating an
+       # new image, it is safe to delete any previous image.
+       if [ -e ${FATIMG} ]; then
+               rm ${FATIMG}
+       fi
+
        if [ -z "${HDDIMG_ID}" ]; then
                mkdosfs ${FATSIZE} -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${FATIMG} \
                        ${BLOCKS}
-- 
1.9.1

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to