From a0d4511d358d427e5271420a74c26cc862c5ed74 Mon Sep 17 00:00:00 2001 From: Ricardo Neri Date: Wed, 15 Jul 2015 16:56:59 -0700 Subject: 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. Signed-off-by: Ricardo Neri Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/classes/bootimg.bbclass | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'meta/classes') diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index dbbf046d3a..ebc927edc7 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass @@ -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} -- cgit v1.2.3