]> code.ossystems Code Review - openembedded-core.git/commitdiff
bootimg: remove previous FATIMG before creating a new one
authorRicardo Neri <ricardo.neri-calderon@linux.intel.com>
Wed, 15 Jul 2015 23:56:59 +0000 (16:56 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 22 Jul 2015 22:25:01 +0000 (23:25 +0100)
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 <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/bootimg.bbclass

index dbbf046d3a3168c54d81726ecd50244d3ce0e6de..ebc927edc7ec588c076768cb33dfb5bcee011669 100644 (file)
@@ -227,6 +227,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}