[oe-commits] Ricardo Neri : bootimg: remove previous FATIMG before creating a new one

git at git.openembedded.org git at git.openembedded.org
Wed Jul 22 07:24:58 UTC 2015

Module: openembedded-core.git
Branch: master-next
Commit: 493f9d6f1b4a7f204d17eb94254b624c7efe1296
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=493f9d6f1b4a7f204d17eb94254b624c7efe1296

Author: Ricardo Neri <ricardo.neri-calderon at linux.intel.com>
Date:   Wed Jul 15 16:56:59 2015 -0700

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

Signed-off-by: Ricardo Neri <ricardo.neri-calderon at linux.intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>


 meta/classes/bootimg.bbclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index dbbf046..ebc927e 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -227,6 +227,12 @@ build_fat_img() {
 		FATSIZE="-F 32"
+	# 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} \

More information about the Openembedded-commits mailing list