bootimg: remove previous FATIMG before creating a new one

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.

(From OE-Core rev: a0d4511d358d427e5271420a74c26cc862c5ed74)

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>
This commit is contained in:
Ricardo Neri 2015-07-15 16:56:59 -07:00 committed by Richard Purdie
parent 50b5186331
commit fbea156fff
1 changed files with 6 additions and 0 deletions

View 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}