All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bootimg: remove previous FATIMG before creating a new one
@ 2015-07-15 23:56 Ricardo Neri
  0 siblings, 0 replies; only message in thread
From: Ricardo Neri @ 2015-07-15 23:56 UTC (permalink / raw)
  To: openembedded-core

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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-15 23:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-15 23:56 [PATCH] bootimg: remove previous FATIMG before creating a new one Ricardo Neri

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.