All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy
@ 2011-12-16  6:14 Darren Hart
  2011-12-16  6:14 ` [PATCH 1/2] bootimg: Use mcopy to construct the hddimg Darren Hart
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Darren Hart @ 2011-12-16  6:14 UTC (permalink / raw)
  To: openembedded-core; +Cc: Darren Hart

The dosfstools -d feature has been shown to be buggy, and even with Nitin's
fixes applied to get directory hierarchies working, it still generates
images that fail dosfsck and don't work with FAT32.

This series presents an alternative means of populating our live images
using mcopy from mtools.

Applies on top of my earlier pull request:
[PATCH 0/4] Fix grub efi menu, kernel messages, and live image dosfsck

The following changes since commit 91e14125b3e90601742f705d2556f5f05e20b944:

  bootimg: Use dosfsck to clean up the generated live image (2011-12-15 22:02:11 -0800)

are available in the git repository at:
  git://git.yoctoproject.org/user-contrib/dvhart/oe-core dvhart/mtools
  http://git.yoctoproject.org/cgit.cgi/user-contrib/dvhart/oe-core/log/?h=dvhart/mtools

Darren Hart (2):
  bootimg: Use mcopy to construct the hddimg
  dosfstools: Remove initial directory contents feature

 meta/classes/bootimg.bbclass                       |   18 +-
 .../dosfstools/fix_populated_dosfs_creation.patch  |  489 ---------------
 .../dosfstools/dosfstools/mkdosfs-dir.patch        |  639 --------------------
 .../dosfstools/dosfstools/nofat32_autoselect.patch |   27 -
 .../recipes-devtools/dosfstools/dosfstools_2.11.bb |    7 +-
 5 files changed, 15 insertions(+), 1165 deletions(-)
 delete mode 100644 meta/recipes-devtools/dosfstools/dosfstools/fix_populated_dosfs_creation.patch
 delete mode 100644 meta/recipes-devtools/dosfstools/dosfstools/mkdosfs-dir.patch
 delete mode 100644 meta/recipes-devtools/dosfstools/dosfstools/nofat32_autoselect.patch

-- 
1.7.6.4




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] bootimg: Use mcopy to construct the hddimg
  2011-12-16  6:14 [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy Darren Hart
@ 2011-12-16  6:14 ` Darren Hart
  2011-12-16 16:18   ` Richard Purdie
  2011-12-16  6:14 ` [PATCH 2/2] dosfstools: Remove initial directory contents feature Darren Hart
  2011-12-16  6:36 ` [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy Darren Hart
  2 siblings, 1 reply; 10+ messages in thread
From: Darren Hart @ 2011-12-16  6:14 UTC (permalink / raw)
  To: openembedded-core; +Cc: Darren Hart

The initial directory support (-d) added to mkdosfs has proven to be incomplete
and non-compliant with FAT. Rather than continue to maintain this feature and
work around the various issues, we can use mcopy to construct the image.

bootimg.bbclass already depends on mtools-native (although it may not have
needed to previously). No new dependencies are introduced. The image created
passes dosfsck cleanly. Remove the call to dosfsck.

mcopy reported an error with the image we were creating:
Total number of sectors (107574) not a multiple of sectors per track (32)!

Add some logic to ensure the total sector count is an integral number of sectors
per track, including forcing the logical sector size to 512 in the mkdosfs
command.

The du -bks arguments are contradictory, -b is equivalent to "--apparent-size
--block-size=1" and -k is --block-size=1K. If reordered, -kbs will report the
disk usage in bytes insteadk of 1k blocks. Eliminate the ambiguity by using:
du --apparent-size -ks

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Nitin A. Kamble <nitin.a.kamble@intel.com>
---
 meta/classes/bootimg.bbclass |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index 8ec07a0..b50202f 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -103,13 +103,21 @@ build_hddimg() {
 			grubefi_hddimg_populate
 		fi
 
-		# Determine the block count for the final image
-		BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
+		# Determine the 1024 byte block count for the final image.
+		BLOCKS=`du --apparent-size -ks ${HDDDIR} | cut -f 1`
 		SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
 
-		mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
-		        -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
-		dosfsck -a -l ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg || true
+		# Ensure total sectors is an integral number of sectors per
+		# track or mcopy will complain. Sectors are 512 bytes, and and
+		# we generate images with 32 sectors per track. This calculation
+		# is done in blocks, which are twice the size of sectors, thus
+		# the 16 instead of 32.
+		SIZE=$(expr $SIZE + $(expr 16 - $(expr $SIZE % 16)))
+
+		IMG=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
+		mkdosfs -n ${BOOTIMG_VOLUME_ID} -S 512 -C ${IMG} ${SIZE}
+		# Copy HDDDIR recursively into the image file directly
+		mcopy -i ${IMG} -s ${HDDDIR}/* ::/
 
 		if [ "${PCBIOS}" = "1" ]; then
 			syslinux_hddimg_install
-- 
1.7.6.4




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] dosfstools: Remove initial directory contents feature
  2011-12-16  6:14 [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy Darren Hart
  2011-12-16  6:14 ` [PATCH 1/2] bootimg: Use mcopy to construct the hddimg Darren Hart
@ 2011-12-16  6:14 ` Darren Hart
  2011-12-16  7:35   ` Koen Kooi
  2011-12-16  6:36 ` [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy Darren Hart
  2 siblings, 1 reply; 10+ messages in thread
From: Darren Hart @ 2011-12-16  6:14 UTC (permalink / raw)
  To: openembedded-core; +Cc: Darren Hart

By using mtools, we don't need to continue to maintain and workaround
the issues generated by the -d feature included in the OE version of
mkdosfstools. This reduces the number of out-of-tree patches we have to
carry by 3 and eliminates a rather buggy chunk of code.

Drop the initial patch adding -d as well as those applied to improve it
and those applied to work around its deficiencies.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Nitin A. Kamble <nitin.a.kamble@intel.com>
---
 .../dosfstools/fix_populated_dosfs_creation.patch  |  489 ---------------
 .../dosfstools/dosfstools/mkdosfs-dir.patch        |  639 --------------------
 .../dosfstools/dosfstools/nofat32_autoselect.patch |   27 -
 .../recipes-devtools/dosfstools/dosfstools_2.11.bb |    7 +-
 4 files changed, 2 insertions(+), 1160 deletions(-)
 delete mode 100644 meta/recipes-devtools/dosfstools/dosfstools/fix_populated_dosfs_creation.patch
 delete mode 100644 meta/recipes-devtools/dosfstools/dosfstools/mkdosfs-dir.patch
 delete mode 100644 meta/recipes-devtools/dosfstools/dosfstools/nofat32_autoselect.patch

diff --git a/meta/recipes-devtools/dosfstools/dosfstools/fix_populated_dosfs_creation.patch b/meta/recipes-devtools/dosfstools/dosfstools/fix_populated_dosfs_creation.patch
deleted file mode 100644
index 510f12e..0000000
--- a/meta/recipes-devtools/dosfstools/dosfstools/fix_populated_dosfs_creation.patch
+++ /dev/null
@@ -1,489 +0,0 @@
-UpstreamStatus: Inappropriate
-
-This patch fixes populated dosfs image creation with directory 
-structures. Earlier it was causing segfault; and only image 
-population with no subdirectories was working.
-
-Issues fixed:
-1. (dir->count == dir->entries) check was only needed for root 
-   directory entries. And this check is wrong for non-root 
-   directories.
-2. For each dir entry 2 dir->table entries were needed, one for 
-   the file/dir and 2nd for long file name support. Earlier long
-   name support was added for filenames but the 2nd entry 
-   allocation, initialization & counting was missed.
-3. The memory clearing was missed at the code path after dir->table 
-   memroy allocation.
-4. Add entries for . & .. directories in all non-root directories.
-5. The . directory points to the correct entry in fat now.
-6. All directoriy entries' size was not zero as required for dosfsck,
-   Now all directory entries' size is zero.
-
-Enhancements:
-1. Added support for long names for directory names. This is same
-   as the existing long name support for filenames.
-2. Added error messages for previously silent memory allocation and 
-   other errors.
-3. -d options does not work correctly with fat32, so now throwing 
-   an error for that.
-4. Use predefined structures from kernel's msdos_fs.h file, rather 
-   than defining again here. And accordingly change the names & use
-   of structure variables.
-
-Outstanding Issues:
-1. The .. directory entry do not point to the parent of current
-   directory. This issue can be fixed by running dosfsck -a after
-   image creation.
-2. For files the filesize is correct, but the clusters size is more 
-   than it needs to be, this also can be fixed by running dosfsck -a
-   after image creation.
-
-Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> 
-2011/12/13
-
-
-Index: dosfstools-2.11/mkdosfs/mkdosfs.c
-===================================================================
---- dosfstools-2.11.orig/mkdosfs/mkdosfs.c
-+++ dosfstools-2.11/mkdosfs/mkdosfs.c
-@@ -21,7 +21,17 @@
-    June 2004 - Jordan Crouse (info.linux@amd.com)
-    Added -d <directory> support to populate the image
-    Copyright (C) 2004, Advanced Micro Devices, All Rights Reserved
--   
-+
-+   2011-12-13: Nitin A Kamble <nitin.a.kamble@intel.com>
-+   Enhanced the -d <directory> support for population of image while
-+   creation. Earlier subdirectores support was broken, only files in
-+   the rootdir were supported. Now directory hirarchy is supported.
-+   Also added long filename support to directory names.
-+     The -d <directory> option (image population while creation)
-+   is broken with fat32.
-+   Copyright (C) 2011, Intel Corporation, All Rights Reserved
-+
-+
-    Fixes/additions May 1998 by Roman Hodek
-    <Roman.Hodek@informatik.uni-erlangen.de>:
-    - Atari format support
-@@ -86,23 +96,23 @@
- # undef __KERNEL__
- #endif
- 
--#if __BYTE_ORDER == __BIG_ENDIAN
--
-+#ifndef __ASM_STUB_BYTEORDER_H__
- #include <asm/byteorder.h>
--#ifdef __le16_to_cpu
--/* ++roman: 2.1 kernel headers define these function, they're probably more
-- * efficient then coding the swaps machine-independently. */
--#define CF_LE_W	__le16_to_cpu
--#define CF_LE_L	__le32_to_cpu
--#define CT_LE_W	__cpu_to_le16
--#define CT_LE_L	__cpu_to_le32
--#else
--#define CF_LE_W(v) ((((v) & 0xff) << 8) | (((v) >> 8) & 0xff))
--#define CF_LE_L(v) (((unsigned)(v)>>24) | (((unsigned)(v)>>8)&0xff00) | \
--               (((unsigned)(v)<<8)&0xff0000) | ((unsigned)(v)<<24))
-+#endif
-+
-+#include <linux/msdos_fs.h>
-+
-+#undef CF_LE_W
-+#undef CF_LE_L
-+#undef CT_LE_W
-+#undef CT_LE_L
-+
-+#if __BYTE_ORDER == __BIG_ENDIAN
-+#include <byteswap.h>
-+#define CF_LE_W(v) bswap_16(v)
-+#define CF_LE_L(v) bswap_32(v)
- #define CT_LE_W(v) CF_LE_W(v)
- #define CT_LE_L(v) CF_LE_L(v)
--#endif /* defined(__le16_to_cpu) */
-     
- #else
- 
-@@ -253,33 +263,6 @@ struct fat32_fsinfo {
-   __u32		reserved2[4];
- };
- 
--/* This stores up to 13 chars of the name */
--
--struct msdos_dir_slot {
--        __u8    id;             /* sequence number for slot */
--        __u8    name0_4[10];    /* first 5 characters in name */
--        __u8    attr;           /* attribute byte */
--        __u8    reserved;       /* always 0 */
--        __u8    alias_checksum; /* checksum for 8.3 alias */
--        __u8    name5_10[12];   /* 6 more characters in name */
--        __u16   start;          /* starting cluster number, 0 in long slots */
--        __u8    name11_12[4];   /* last 2 characters in name */
--};
--
--struct msdos_dir_entry
--  {
--    char	name[8], ext[3];	/* name and extension */
--    __u8        attr;			/* attribute bits */
--    __u8	lcase;			/* Case for base and extension */
--    __u8	ctime_ms;		/* Creation time, milliseconds */
--    __u16	ctime;			/* Creation time */
--    __u16	cdate;			/* Creation date */
--    __u16	adate;			/* Last access date */
--    __u16	starthi;		/* high 16 bits of first cl. (FAT32) */
--    __u16	time, date, start;	/* time, date and first cluster */
--    __u32	size;			/* file size (in bytes) */
--  } __attribute__ ((packed));
--
- /* The "boot code" we put into the filesystem... it writes a message and
-    tells the user to try again */
- 
-@@ -356,7 +339,6 @@ static struct msdos_dir_entry *root_dir;
- static int size_root_dir;	/* Size of the root directory in bytes */
- static int sectors_per_cluster = 0;	/* Number of sectors per disk cluster */
- static int root_dir_entries = 0;	/* Number of root directory entries */
--static int root_dir_num_entries = 0;
- static int last_cluster_written = 0;
- 
- static char *blank_sector;		/* Blank sector - all zeros */
-@@ -1315,7 +1297,7 @@ setup_tables (void)
-       de->date = CT_LE_W((unsigned short)(ctime->tm_mday +
- 					  ((ctime->tm_mon+1) << 5) +
- 					  ((ctime->tm_year-80) << 9)));
--      de->ctime_ms = 0;
-+      de->ctime_cs = 0;
-       de->ctime = de->time;
-       de->cdate = de->date;
-       de->adate = de->date;
-@@ -1451,16 +1433,23 @@ write_tables (void)
- 
- /* Add a file to the specified directory entry, and also write it into the image */
- 
--static void copy_filename(char *filename, char *base, char *ext) {
-+static void copy_filename(char *filename, char *dos_name) {
-   
-   char *ch = filename;
-   int i, len;
- 
--  memset(base, 0x20, 8);
--  memset(ext, 0x20, 3);
-+  if (!strcmp(filename, ".")) {
-+    strncpy(dos_name, MSDOS_DOT, MSDOS_NAME);
-+    return;
-+  }
-+  if (!strcmp(filename, "..")) {
-+    strncpy(dos_name, MSDOS_DOTDOT, MSDOS_NAME);
-+    return;
-+  }
-+  memset(dos_name, 0x20, MSDOS_NAME);
-   
-   for(len = 0 ; *ch && *ch != '.'; ch++) {
--    base[len++] = toupper(*ch);
-+    dos_name[len++] = toupper(*ch);
-     if (len == 8) break;
-   }
-   
-@@ -1468,7 +1457,7 @@ static void copy_filename(char *filename
-   if (*ch) ch++;
-   
-   for(len = 0 ; *ch; ch++) {
--    ext[len++] = toupper(*ch);
-+    dos_name[8 + len++] = toupper(*ch);
-     if (len == 3) break;
-   }
- }
-@@ -1551,7 +1540,7 @@ static int add_file(char *filename, stru
-   int start;
-   int usedsec, totalsec;
- 
--  char name83[8], ext83[3];
-+  char dos_name[MSDOS_NAME+1];
- 
-   struct msdos_dir_slot *slot;
-   int i;
-@@ -1562,23 +1551,22 @@ static int add_file(char *filename, stru
-   if (dir->root) {
-     if (dir->count == dir->entries) {
-       printf("Error - too many directory entries\n");
-+      return;
-     }
-   }
-   else {
--    if (dir->count == dir->entries) {
--      if (!dir->table) 
--	dir->table = 
--	  (struct msdos_dir_entry *) malloc(sizeof(struct msdos_dir_entry));
--      else {
--	dir->table = 
--	  (struct msdos_dir_entry *) realloc(dir->table, (dir->entries + 1) * 
--					     sizeof(struct msdos_dir_entry));
--
--	memset(&dir->table[dir->entries], 0, sizeof(struct msdos_dir_entry));
--      }
--
--      dir->entries++;
--    }
-+    /* 2 entries, one extra for long filename */
-+    if (!dir->table)
-+      dir->table =
-+        (struct msdos_dir_entry *) malloc(2 * sizeof(struct msdos_dir_entry));
-+    else
-+      dir->table =
-+        (struct msdos_dir_entry *) realloc(dir->table, 2 * (dir->entries + 1) *
-+      				     sizeof(struct msdos_dir_entry));
-+    if (!dir->table)
-+      printf("Error - realloc failed\n");
-+    memset(&dir->table[dir->entries], 0, 2 * sizeof(struct msdos_dir_entry));
-+    dir->entries += 2;
-   }
- 
-   infile = open(filename, O_RDONLY, 0);
-@@ -1611,13 +1599,13 @@ static int add_file(char *filename, stru
-     return -1;
-   }
- 
--  printf("ADD %s\n", filename);
-+  printf("ADD FILE %s\n", filename);
- 
-   /* Grab the basename of the file */
-   base = basename(filename);
-   
--  /* Extract out the 8.3 name */
--  copy_filename(base, name83, ext83);
-+  /* convert for dos fat structure  */
-+  copy_filename(base, dos_name);
- 
-   /* Make an extended name slot */
- 
-@@ -1629,12 +1617,9 @@ static int add_file(char *filename, stru
-   
-   slot->alias_checksum = 0;
-   
--  for(i = 0; i < 8; i++) 
--    slot->alias_checksum = (((slot->alias_checksum&1)<<7)|((slot->alias_checksum&0xfe)>>1)) + name83[i];
-+  for(i = 0; i < MSDOS_NAME; i++)
-+    slot->alias_checksum = (((slot->alias_checksum&1)<<7)|((slot->alias_checksum&0xfe)>>1)) + dos_name[i];
-   
--  for(i = 0; i < 3; i++) 
--    slot->alias_checksum = (((slot->alias_checksum&1)<<7)|((slot->alias_checksum&0xfe)>>1)) + ext83[i];
--
-   p = base;
- 
-   copy_name(slot->name0_4, 10, &p);
-@@ -1645,8 +1630,7 @@ static int add_file(char *filename, stru
-   /* Get the entry from the root filesytem */
-   entry = &dir->table[dir->count++];
- 
--  strncpy(entry->name, name83, 8);
--  strncpy(entry->ext, ext83, 3);
-+  strncpy(entry->name, dos_name, MSDOS_NAME);
- 
- 
-   /* If the user has it read only, then add read only to the incoming
-@@ -1665,7 +1649,7 @@ static int add_file(char *filename, stru
- 				      ((ctime->tm_mon+1) << 5) +
- 				      ((ctime->tm_year-80) << 9)));
- 
--  entry->ctime_ms = 0;
-+  entry->ctime_cs = 0;
-   entry->ctime = entry->time;
-   entry->cdate = entry->date;
-   entry->adate = entry->date;
-@@ -1711,6 +1695,7 @@ static int add_file(char *filename, stru
- 
-  exit_add:
-   if (infile) close(infile);
-+  return 0;
- }
- 
- /* Add a new directory to the specified directory entry, and in turn populate 
-@@ -1727,10 +1712,18 @@ static void add_directory(char *filename
-   struct dirent *dentry = 0;
-   int remain;
-   char *data;
-+  char *base;
-+  char dos_name[MSDOS_NAME+1];
-+  struct msdos_dir_slot *slot;
-+  int i;
-+  char *p;
- 
-   /* If the directory doesn't exist */
--  if (!rddir) return;
--  
-+  if (!rddir) {
-+    printf("Error - dir does not exist: %s\n", filename);
-+    return;
-+  }
-+
-   if (dir->root) {
-     if (dir->count == dir->entries) {
-       printf("Error - too many directory entries\n");
-@@ -1738,28 +1731,58 @@ static void add_directory(char *filename
-     }
-   }
-   else {
--    if (dir->count == dir->entries) {
--      if (!dir->table) 
--	dir->table = (struct msdos_dir_entry *) malloc(sizeof(struct msdos_dir_entry));
--      else {
--	dir->table = (struct msdos_dir_entry *) realloc(dir->table, (dir->entries + 1) * 
--							sizeof(struct msdos_dir_entry));
--
--	/* Zero it out to avoid issues */
--	memset(&dir->table[dir->entries], 0, sizeof(struct msdos_dir_entry));
--      }
--	dir->entries++;
-+    /* 2 entries, one extra for long name of the directory */
-+    if (!dir->table)
-+      dir->table = (struct msdos_dir_entry *) malloc(2 * sizeof(struct msdos_dir_entry));
-+    else
-+      dir->table = (struct msdos_dir_entry *) realloc(dir->table, 2 * (dir->entries + 1) *
-+                                                             sizeof(struct msdos_dir_entry));
-+    if (!dir->table) {
-+      printf("Error - memory allocation failed\n");
-+      goto exit_add_dir;
-     }
-+    /* Zero it out to avoid issues */
-+    memset(&dir->table[dir->entries], 0, 2 * sizeof(struct msdos_dir_entry));
-+    dir->entries += 2;
-   }
- 
-+  printf("ADD DIR %s\n", filename);
-   /* Now, create a new directory entry for the new directory */
-   newdir = (struct dir_entry *) calloc(1, sizeof(struct dir_entry));
--  if (!newdir) goto exit_add_dir;
-+  if (!newdir) {
-+    printf("Error - calloc failed\n");
-+    goto exit_add_dir;
-+  }
-+
-+  /* Grab the basename of the file */
-+  base = basename(filename);
-+
-+  /* convert for dos structure  */
-+  copy_filename(base, dos_name);
-+
-+  /* Make an extended name slot */
-+  slot = (struct msdos_dir_slot *) &dir->table[dir->count++];
-+  slot->id = 'A';
-+  slot->attr = 0x0F;
-+  slot->reserved = 0;
-+  slot->start = 0;
-+
-+  slot->alias_checksum = 0;
- 
-+  for (i = 0; i < MSDOS_NAME; i++)
-+    slot->alias_checksum = (((slot->alias_checksum&1)<<7)|((slot->alias_checksum&0xfe)>>1)) + dos_name[i];
-+
-+  p = base;
-+
-+  copy_name(slot->name0_4, 10, &p);
-+  copy_name(slot->name5_10, 12, &p);
-+  copy_name(slot->name11_12, 4, &p);
-+
-+  /* Get the entry from the root filesytem */
-   entry = &dir->table[dir->count++];
- 
--  strncpy(entry->name, basename(filename), sizeof(entry->name));
--  
-+  strncpy(entry->name, dos_name, MSDOS_NAME);
-+
-   entry->attr = ATTR_DIR;
-   ctime = localtime(&create_time);
- 
-@@ -1770,25 +1793,32 @@ static void add_directory(char *filename
- 				      ((ctime->tm_mon+1) << 5) +
- 				      ((ctime->tm_year-80) << 9)));
- 
--  entry->ctime_ms = 0;
-+  entry->ctime_cs = 0;
-   entry->ctime = entry->time;
-   entry->cdate = entry->date;
-   entry->adate = entry->date;
- 
-   /* Now, read the directory */
- 
--  while((dentry = readdir(rddir))) {
-+
-+  while((base[0] != '.') && (dentry = readdir(rddir))) {
-     struct stat st;
-     char *buffer;
--    
--    if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, ".."))
--      continue;
- 
--    /* DOS wouldn't like a typical unix . (dot) file, so we skip those too */
--    if (dentry->d_name[0] == '.') continue;
-+    if (dentry->d_name[0] == '.') {
-+        /* dos also has . & .. directory entries */
-+      if (! ((!strcmp(dentry->d_name, ".")) || (!strcmp(dentry->d_name, "..")))) {
-+        /* ignore other .* files */
-+        printf("Error - File/Dir name is not dos compatible, ignored: %s\n", dentry->d_name);
-+        continue;
-+      }
-+    }
- 
-     buffer = malloc(strlen(filename) + strlen(dentry->d_name) + 3);
--    if (!buffer) continue;
-+    if (!buffer) {
-+        printf("Error - malloc failed\n");
-+        goto exit_add_dir;
-+    }
-     
-     sprintf(buffer, "%s/%s", filename, dentry->d_name);
-     if (!stat(buffer, &st)) {
-@@ -1806,11 +1836,23 @@ static void add_directory(char *filename
-   /* Now that the entire directory has been written, go ahead and write the directory
-      entry as well */
- 
-+  entry->size = 0; /* a directory has zero size */
-+
-+  if (base[0] == '.')  { /* . & .. point to parent's cluster */
-+    goto exit_add_dir;
-+  }
-+
-   entry->start = CT_LE_W(last_cluster_written);
-   entry->starthi = CT_LE_W((last_cluster_written & 0xFFFF0000) >> 16); 
--  entry->size = newdir->count * sizeof(struct msdos_dir_entry);
-+
-+/* . dir start points to parent */
-+  newdir->table[1].start = entry->start;
-+/* .. dir points to parent of parent*/
-+/* .. dir start is not set yet, would need more changes to the code,
-+ * but dosfsck can fix these .. entry start pointers correctly */
-+
-+  remain = newdir->count * sizeof(struct msdos_dir_entry);
-   
--  remain = entry->size;
-   data = (char *) newdir->table;
- 
-   while(remain) {
-@@ -1858,6 +1900,7 @@ static void add_root_directory(char *dir
- 
-   if (!newdir) {
-     closedir(dir);
-+    printf("Error - calloc failed!\n");
-     return;
-   }
- 
-@@ -1877,7 +1920,10 @@ static void add_root_directory(char *dir
-     if (entry->d_name[0] == '.') continue;
-  
-     buffer = malloc(strlen(dirname) + strlen(entry->d_name) + 3);
--    if (!buffer) continue;
-+    if (!buffer) {
-+        printf("Error - malloc failed!\n");
-+        continue;
-+    }
- 
-     sprintf(buffer, "%s/%s", dirname, entry->d_name);
-     if (!stat(buffer, &st)) {
-@@ -2245,6 +2291,9 @@ main (int argc, char **argv)
-   if (check && listfile)	/* Auto and specified bad block handling are mutually */
-     die ("-c and -l are incompatible");		/* exclusive of each other! */
- 
-+  if (dirname && (size_fat == 32))
-+    die ("-d is incompatible with FAT32");
-+
-   if (!create) {
-     check_mount (device_name);	/* Is the device already mounted? */
-     dev = open (device_name, O_RDWR);	/* Is it a suitable device to build the FS on? */
diff --git a/meta/recipes-devtools/dosfstools/dosfstools/mkdosfs-dir.patch b/meta/recipes-devtools/dosfstools/dosfstools/mkdosfs-dir.patch
deleted file mode 100644
index 3ba4711..0000000
--- a/meta/recipes-devtools/dosfstools/dosfstools/mkdosfs-dir.patch
+++ /dev/null
@@ -1,639 +0,0 @@
-Add -d <directory> support to populate the image.
-
-Upstream-Status: Inappropriate [licensing]
-We're tracking an old release of dosfstools due to licensing issues.
-
-Signed-off-by: Scott Garman <scott.a.garman@intel.com>
-
-Index: dosfstools-2.11/mkdosfs/mkdosfs.c
-===================================================================
---- dosfstools-2.11.orig/mkdosfs/mkdosfs.c	2011-12-06 12:27:55.000000000 +0000
-+++ dosfstools-2.11/mkdosfs/mkdosfs.c	2011-12-06 12:37:13.445950703 +0000
-@@ -18,6 +18,10 @@
-    as a rule), and not the block.  For example the boot block does not
-    occupy a full cluster.
- 
-+   June 2004 - Jordan Crouse (info.linux@amd.com)
-+   Added -d <directory> support to populate the image
-+   Copyright (C) 2004, Advanced Micro Devices, All Rights Reserved
-+   
-    Fixes/additions May 1998 by Roman Hodek
-    <Roman.Hodek@informatik.uni-erlangen.de>:
-    - Atari format support
-@@ -71,6 +75,8 @@
- #include <unistd.h>
- #include <time.h>
- #include <errno.h>
-+#include <libgen.h>
-+#include <dirent.h>
- 
- #include <linux/version.h>
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
-@@ -110,6 +116,8 @@
-  * sufficient (or even better :) for 64 bit offsets in the meantime */
- #define llseek lseek
- 
-+#define ROUND_UP(value, divisor) (value + (divisor - (value % divisor))) / divisor
-+
- /* Constant definitions */
- 
- #define TRUE 1			/* Boolean constants */
-@@ -149,7 +157,6 @@
- #define ATTR_VOLUME  8		/* volume label */
- #define ATTR_DIR     16		/* directory */
- #define ATTR_ARCH    32		/* archived */
--
- #define ATTR_NONE    0		/* no attribute bits */
- #define ATTR_UNUSED  (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN)
- 	/* attribute bits that are copied "as is" */
-@@ -245,6 +252,19 @@
-   __u32		reserved2[4];
- };
- 
-+/* This stores up to 13 chars of the name */
-+
-+struct msdos_dir_slot {
-+        __u8    id;             /* sequence number for slot */
-+        __u8    name0_4[10];    /* first 5 characters in name */
-+        __u8    attr;           /* attribute byte */
-+        __u8    reserved;       /* always 0 */
-+        __u8    alias_checksum; /* checksum for 8.3 alias */
-+        __u8    name5_10[12];   /* 6 more characters in name */
-+        __u16   start;          /* starting cluster number, 0 in long slots */
-+        __u8    name11_12[4];   /* last 2 characters in name */
-+};
-+
- struct msdos_dir_entry
-   {
-     char	name[8], ext[3];	/* name and extension */
-@@ -293,6 +313,15 @@
- 
- #define MESSAGE_OFFSET 29	/* Offset of message in above code */
- 
-+/* Special structure to keep track of directories as we add them for the -d option */
-+
-+struct dir_entry {
-+  int root;                       /* Specifies if this is the root dir or not */
-+  int count;                      /* Number of items in the table */
-+  int entries;                    /* Number of entries in the table */
-+  struct msdos_dir_entry *table;  /* Pointer to the entry table */
-+};
-+
- /* Global variables - the root of all evil :-) - see these and weep! */
- 
- static char *template_boot_code;	/* Variable to store a full template boot sector in */
-@@ -326,6 +355,9 @@
- static int size_root_dir;	/* Size of the root directory in bytes */
- static int sectors_per_cluster = 0;	/* Number of sectors per disk cluster */
- static int root_dir_entries = 0;	/* Number of root directory entries */
-+static int root_dir_num_entries = 0;
-+static int last_cluster_written = 0;
-+
- static char *blank_sector;		/* Blank sector - all zeros */
- static int hidden_sectors = 0;		/* Number of hidden sectors */
- 
-@@ -399,7 +431,6 @@
-   }
- }
- 
--
- /* Mark a specified sector as having a particular value in it's FAT entry */
- 
- static void
-@@ -1266,6 +1297,9 @@
-       die ("unable to allocate space for root directory in memory");
-     }
- 
-+
-+  last_cluster_written = 2;
-+  
-   memset(root_dir, 0, size_root_dir);
-   if ( memcmp(volume_name, "           ", 11) )
-     {
-@@ -1314,11 +1348,11 @@
-   }
-   
-   if (!(blank_sector = malloc( sector_size )))
--      die( "Out of memory" );
-+    die( "Out of memory" );
-+  
-   memset(blank_sector, 0, sector_size);
- }
--
--
-+  
- /* Write the new filesystem's data tables to wherever they're going to end up! */
- 
- #define error(str)				\
-@@ -1340,7 +1374,7 @@
-   do {							\
-     int __size = (size);				\
-     if (write (dev, buf, __size) != __size)		\
--	error ("failed whilst writing " errstr);	\
-+       error ("failed whilst writing " errstr);	\
-   } while(0)
- 
- 
-@@ -1412,6 +1446,452 @@
-   free (fat);  /* Free up the fat table space reserved during setup_tables */
- }
- 
-+/* Add a file to the specified directory entry, and also write it into the image */
-+
-+static void copy_filename(char *filename, char *base, char *ext) {
-+  
-+  char *ch = filename;
-+  int i, len;
-+
-+  memset(base, 0x20, 8);
-+  memset(ext, 0x20, 3);
-+  
-+  for(len = 0 ; *ch && *ch != '.'; ch++) {
-+    base[len++] = toupper(*ch);
-+    if (len == 8) break;
-+  }
-+  
-+  for ( ; *ch && *ch != '.'; ch++);
-+  if (*ch) ch++;
-+  
-+  for(len = 0 ; *ch; ch++) {
-+    ext[len++] = toupper(*ch);
-+    if (len == 3) break;
-+  }
-+}
-+
-+/* Check for an .attrib.<filename> file, and read the attributes therein */
-+
-+/* We are going to be pretty pedantic about this.  The file needs 3
-+   bytes at the beginning, the attributes are listed in this order:
-+   
-+   (H)idden|(S)ystem|(A)rchived
-+   
-+   A capital HSA means to enable it, anything else will disable it
-+   (I recommend a '-') The unix user attributes will still be used 
-+   for write access.
-+
-+   For example, to enable system file access for ldlinux.sys, write 
-+   the following to .attrib.ldlinux.sys: -S-
-+*/
-+
-+unsigned char check_attrib_file(char *dir, char *filename) {
-+
-+  char attrib[4] = { '-', '-', '-' };
-+  unsigned char *buffer = 0;
-+  int ret = ATTR_NONE;
-+  int fd = -1;
-+
-+  buffer = (char *) calloc(1, strlen(dir) + strlen(filename) + 10);
-+  if (!buffer) return ATTR_NONE;
-+
-+  sprintf(buffer, "%s/.attrib.%s", dir, filename);
-+
-+  if (access(buffer, R_OK)) 
-+    goto exit_attrib;
-+
-+  if ((fd = open(buffer, O_RDONLY, 0)) < 0)
-+    goto exit_attrib;
-+
-+  if (read(fd, attrib, 3) < 0)
-+    goto exit_attrib;
-+  
-+  if (attrib[0] == 'H') ret |= ATTR_HIDDEN;
-+  if (attrib[1] == 'S') ret |= ATTR_SYS;
-+  if (attrib[2] == 'A') ret |= ATTR_ARCH;
-+
-+  printf("%s: Setting atrribute %x\n", filename, ret);
-+
-+ exit_attrib:
-+  if (fd >= 0) close(fd);
-+  if (buffer) free(buffer);
-+
-+  return ret;
-+}
-+
-+static void copy_name(char *buffer, int size, char **pointer) {
-+  int i;
-+
-+  for(i = 0; i < size; i += 2) {
-+    if (*pointer) {
-+      buffer[i] = **pointer;
-+      buffer[i + 1] = 0x00;
-+      *pointer = **pointer ? *pointer + 1 : 0;
-+    }
-+    else {
-+      buffer[i] = 0xFF;
-+      buffer[i + 1] = 0xFF;
-+    }
-+  }  
-+}
-+
-+static int add_file(char *filename, struct dir_entry *dir, unsigned char attr) 
-+{
-+  struct stat stat;
-+  struct msdos_dir_entry *entry;
-+  int infile = 0;
-+  int sectors, clusters;
-+  struct tm *ctime;
-+  int c, s;
-+  int ptr;
-+  char *buffer, *base;
-+  int start;
-+  int usedsec, totalsec;
-+
-+  char name83[8], ext83[3];
-+
-+  struct msdos_dir_slot *slot;
-+  int i;
-+  char *p;
-+
-+  /* The root directory is static, everything else grows as needed */
-+
-+  if (dir->root) {
-+    if (dir->count == dir->entries) {
-+      printf("Error - too many directory entries\n");
-+    }
-+  }
-+  else {
-+    if (dir->count == dir->entries) {
-+      if (!dir->table) 
-+	dir->table = 
-+	  (struct msdos_dir_entry *) malloc(sizeof(struct msdos_dir_entry));
-+      else {
-+	dir->table = 
-+	  (struct msdos_dir_entry *) realloc(dir->table, (dir->entries + 1) * 
-+					     sizeof(struct msdos_dir_entry));
-+
-+	memset(&dir->table[dir->entries], 0, sizeof(struct msdos_dir_entry));
-+      }
-+
-+      dir->entries++;
-+    }
-+  }
-+
-+  infile = open(filename, O_RDONLY, 0);
-+  if (!infile) return;
-+  
-+  if (fstat(infile, &stat))
-+    goto exit_add;
-+ 
-+  if (S_ISCHR(stat.st_mode) ||S_ISBLK(stat.st_mode) ||
-+      S_ISFIFO(stat.st_mode) || S_ISLNK(stat.st_mode)) {
-+    printf("Error - cannot create a special file in a FATFS\n");
-+    goto exit_add;
-+  }
-+
-+  /* FIXME: This isn't very pretty */
-+
-+  usedsec = start_data_sector + (size_root_dir / sector_size) +
-+    (last_cluster_written * bs.cluster_size);
-+
-+  totalsec = blocks * BLOCK_SIZE / sector_size;
-+  
-+  /* Figure out how many sectors / clustors the file requires */
-+
-+  sectors = ROUND_UP(stat.st_size, sector_size);
-+  clusters = ROUND_UP(sectors, (int) bs.cluster_size);
-+
-+  if (usedsec + sectors > totalsec) {
-+    printf("Error - %s is too big (%d vs %d)\n", filename, sectors, totalsec - usedsec);
-+    close(infile);
-+    return -1;
-+  }
-+
-+  printf("ADD %s\n", filename);
-+
-+  /* Grab the basename of the file */
-+  base = basename(filename);
-+  
-+  /* Extract out the 8.3 name */
-+  copy_filename(base, name83, ext83);
-+
-+  /* Make an extended name slot */
-+
-+  slot = (struct msdos_dir_slot *) &dir->table[dir->count++];
-+  slot->id = 'A';  
-+  slot->attr = 0x0F;
-+  slot->reserved = 0;
-+  slot->start = 0;
-+  
-+  slot->alias_checksum = 0;
-+  
-+  for(i = 0; i < 8; i++) 
-+    slot->alias_checksum = (((slot->alias_checksum&1)<<7)|((slot->alias_checksum&0xfe)>>1)) + name83[i];
-+  
-+  for(i = 0; i < 3; i++) 
-+    slot->alias_checksum = (((slot->alias_checksum&1)<<7)|((slot->alias_checksum&0xfe)>>1)) + ext83[i];
-+
-+  p = base;
-+
-+  copy_name(slot->name0_4, 10, &p);
-+  copy_name(slot->name5_10, 12, &p);
-+  copy_name(slot->name11_12, 4, &p);
-+
-+
-+  /* Get the entry from the root filesytem */
-+  entry = &dir->table[dir->count++];
-+
-+  strncpy(entry->name, name83, 8);
-+  strncpy(entry->ext, ext83, 3);
-+
-+
-+  /* If the user has it read only, then add read only to the incoming
-+     attribute settings */
-+
-+  if (!(stat.st_mode & S_IWUSR)) attr |= ATTR_RO;
-+  entry->attr = attr;
-+
-+  /* Set the access time on the file */
-+  ctime = localtime(&create_time);
-+
-+  entry->time = CT_LE_W((unsigned short)((ctime->tm_sec >> 1) +
-+					  (ctime->tm_min << 5) + (ctime->tm_hour << 11)));
-+
-+  entry->date = CT_LE_W((unsigned short)(ctime->tm_mday +
-+				      ((ctime->tm_mon+1) << 5) +
-+				      ((ctime->tm_year-80) << 9)));
-+
-+  entry->ctime_ms = 0;
-+  entry->ctime = entry->time;
-+  entry->cdate = entry->date;
-+  entry->adate = entry->date;
-+  entry->size = stat.st_size;
-+
-+  start = last_cluster_written;
-+
-+  entry->start = CT_LE_W(start);  /* start sector */
-+  entry->starthi = CT_LE_W((start & 0xFFFF0000) >> 16); /* High start sector (for FAT32) */
-+
-+  /* We mark all of the clusters we use in the FAT */
-+  
-+  for(c = 0; c < clusters; c++ ) {
-+    int free;
-+    int next = c == (clusters - 1) ? FAT_EOF : start + c + 1;
-+    mark_FAT_cluster(start + c, next);  
-+    last_cluster_written++;
-+  }
-+  
-+  /* This confused me too - cluster 2 starts after the
-+     root directory data - search me as to why */
-+
-+  ptr = (start_data_sector * sector_size) + size_root_dir;
-+  ptr += (start - 2) * bs.cluster_size * sector_size;
-+    
-+  buffer = (char *) malloc(sector_size);
-+
-+  if (!buffer) {
-+    printf("Error - couldn't allocate memory\n");
-+    goto exit_add;
-+  }
-+
-+  /* Write the file into the file block */
-+
-+  seekto(ptr, "datafile");
-+
-+  while(1) {
-+    int size = read(infile, buffer, sector_size);    
-+    if (size <= 0) break;
-+    
-+    writebuf(buffer, size, "data");    
-+  }
-+
-+ exit_add:
-+  if (infile) close(infile);
-+}
-+
-+/* Add a new directory to the specified directory entry, and in turn populate 
-+   it with its own files */
-+
-+/* FIXME:  This should check to make sure there is enough size to add itself */
-+
-+static void add_directory(char *filename, struct dir_entry *dir) {
-+
-+  struct dir_entry *newdir = 0;
-+  struct msdos_dir_entry *entry;
-+  struct tm *ctime;
-+  DIR *rddir = opendir(filename);
-+  struct dirent *dentry = 0;
-+  int remain;
-+  char *data;
-+
-+  /* If the directory doesn't exist */
-+  if (!rddir) return;
-+  
-+  if (dir->root) {
-+    if (dir->count == dir->entries) {
-+      printf("Error - too many directory entries\n");
-+      goto exit_add_dir;
-+    }
-+  }
-+  else {
-+    if (dir->count == dir->entries) {
-+      if (!dir->table) 
-+	dir->table = (struct msdos_dir_entry *) malloc(sizeof(struct msdos_dir_entry));
-+      else {
-+	dir->table = (struct msdos_dir_entry *) realloc(dir->table, (dir->entries + 1) * 
-+							sizeof(struct msdos_dir_entry));
-+
-+	/* Zero it out to avoid issues */
-+	memset(&dir->table[dir->entries], 0, sizeof(struct msdos_dir_entry));
-+      }
-+	dir->entries++;
-+    }
-+  }
-+
-+  /* Now, create a new directory entry for the new directory */
-+  newdir = (struct dir_entry *) calloc(1, sizeof(struct dir_entry));
-+  if (!newdir) goto exit_add_dir;
-+
-+  entry = &dir->table[dir->count++];
-+
-+  strncpy(entry->name, basename(filename), sizeof(entry->name));
-+  
-+  entry->attr = ATTR_DIR;
-+  ctime = localtime(&create_time);
-+
-+  entry->time = CT_LE_W((unsigned short)((ctime->tm_sec >> 1) +
-+					  (ctime->tm_min << 5) + (ctime->tm_hour << 11)));
-+
-+  entry->date = CT_LE_W((unsigned short)(ctime->tm_mday +
-+				      ((ctime->tm_mon+1) << 5) +
-+				      ((ctime->tm_year-80) << 9)));
-+
-+  entry->ctime_ms = 0;
-+  entry->ctime = entry->time;
-+  entry->cdate = entry->date;
-+  entry->adate = entry->date;
-+
-+  /* Now, read the directory */
-+
-+  while((dentry = readdir(rddir))) {
-+    struct stat st;
-+    char *buffer;
-+    
-+    if (!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, ".."))
-+      continue;
-+
-+    /* DOS wouldn't like a typical unix . (dot) file, so we skip those too */
-+    if (dentry->d_name[0] == '.') continue;
-+
-+    buffer = malloc(strlen(filename) + strlen(dentry->d_name) + 3);
-+    if (!buffer) continue;
-+    
-+    sprintf(buffer, "%s/%s", filename, dentry->d_name);
-+    if (!stat(buffer, &st)) {
-+      if (S_ISDIR(st.st_mode)) 
-+	add_directory(buffer, newdir);
-+      else if (S_ISREG(st.st_mode)) {
-+	unsigned char attrib = check_attrib_file(filename, dentry->d_name);
-+	add_file(buffer, newdir, attrib);
-+      }
-+    }
-+ 
-+    free(buffer);
-+  }
-+  
-+  /* Now that the entire directory has been written, go ahead and write the directory
-+     entry as well */
-+
-+  entry->start = CT_LE_W(last_cluster_written);
-+  entry->starthi = CT_LE_W((last_cluster_written & 0xFFFF0000) >> 16); 
-+  entry->size = newdir->count * sizeof(struct msdos_dir_entry);
-+  
-+  remain = entry->size;
-+  data = (char *) newdir->table;
-+
-+  while(remain) {
-+    int size = 
-+      remain > bs.cluster_size * sector_size ? bs.cluster_size * sector_size : remain;
-+
-+    int pos = (start_data_sector * sector_size) + size_root_dir;
-+    pos += (last_cluster_written - 2) * bs.cluster_size * sector_size;
-+    
-+    seekto(pos, "add_dir");
-+    writebuf(data, size, "add_dir");
-+    
-+    remain -= size;
-+    data += size;
-+
-+    mark_FAT_cluster(last_cluster_written, remain ? last_cluster_written + 1 : FAT_EOF);      
-+    last_cluster_written++;
-+  }
-+  
-+ exit_add_dir:
-+  if (rddir) closedir(rddir);
-+  if (newdir->table) free(newdir->table);
-+  if (newdir) free(newdir);
-+}  
-+  
-+/* Given a directory, add all the files and directories to the root directory of the
-+   image.  
-+*/
-+
-+static void add_root_directory(char *dirname) 
-+{
-+  DIR *dir = opendir(dirname);
-+  struct dirent *entry = 0;
-+  struct dir_entry *newdir = 0;
-+
-+  if (!dir) {
-+    printf("Error - directory %s does not exist\n", dirname);
-+    return;
-+  }
-+ 
-+  /* Create the root directory structure - this is a bit different then
-+     above, because the table already exists, we just refer to it. */
-+
-+  newdir = (struct dir_entry *) calloc(1,sizeof(struct dir_entry));
-+
-+  if (!newdir) {
-+    closedir(dir);
-+    return;
-+  }
-+
-+  newdir->entries = root_dir_entries;
-+  newdir->root = 1;
-+  newdir->count = 0;
-+  newdir->table = root_dir;
-+
-+  while((entry = readdir(dir))) {
-+    struct stat st;
-+    char *buffer;
-+    
-+    if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
-+      continue;
-+    
-+    /* DOS wouldn't like a typical unix . (dot) file, so we skip those too */
-+    if (entry->d_name[0] == '.') continue;
-+ 
-+    buffer = malloc(strlen(dirname) + strlen(entry->d_name) + 3);
-+    if (!buffer) continue;
-+
-+    sprintf(buffer, "%s/%s", dirname, entry->d_name);
-+    if (!stat(buffer, &st)) {
-+      if (S_ISDIR(st.st_mode)) 
-+	add_directory(buffer, newdir);
-+      else if (S_ISREG(st.st_mode)) {
-+	unsigned char attrib = check_attrib_file(dirname, entry->d_name);
-+	add_file(buffer, newdir, attrib);
-+      }
-+    }
-+
-+    free(buffer);
-+  }
-+
-+  closedir(dir);
-+  if (newdir) free(newdir);
-+}
- 
- /* Report the command usage and return a failure error code */
- 
-@@ -1423,7 +1903,7 @@
-        [-m boot-msg-file] [-n volume-name] [-i volume-id] [-B bootcode]\n\
-        [-s sectors-per-cluster] [-S logical-sector-size] [-f number-of-FATs]\n\
-        [-h hidden-sectors] [-F fat-size] [-r root-dir-entries] [-R reserved-sectors]\n\
--       /dev/name [blocks]\n");
-+       [-d directory] /dev/name [blocks]\n");
- }
- 
- /*
-@@ -1463,6 +1943,8 @@
-   int c;
-   char *tmp;
-   char *listfile = NULL;
-+  char *dirname = NULL;
-+
-   FILE *msgfile;
-   struct stat statbuf;
-   int i = 0, pos, ch;
-@@ -1483,7 +1965,7 @@
-   printf ("%s " VERSION " (" VERSION_DATE ")\n",
- 	   program_name);
- 
--  while ((c = getopt (argc, argv, "AbcCf:F:Ii:l:m:n:r:R:s:S:v:B:")) != EOF)
-+  while ((c = getopt (argc, argv, "AbcCd:f:F:Ii:l:m:n:r:R:s:S:v:B:")) != EOF)
-     /* Scan the command line for options */
-     switch (c)
-       {
-@@ -1508,6 +1990,10 @@
- 	create = TRUE;
- 	break;
- 
-+  case 'd':
-+	dirname = optarg;
-+	break;
-+
-       case 'f':		/* f : Choose number of FATs */
- 	nr_fats = (int) strtol (optarg, &tmp, 0);
- 	if (*tmp || nr_fats < 1 || nr_fats > 4)
-@@ -1811,8 +2297,10 @@
-   else if (listfile)
-     get_list_blocks (listfile);
- 
--  write_tables ();		/* Write the file system tables away! */
- 
-+  if (dirname) add_root_directory(dirname);
-+
-+  write_tables ();		/* Write the file system tables away! */  
-   exit (0);			/* Terminate with no errors! */
- }
- 
diff --git a/meta/recipes-devtools/dosfstools/dosfstools/nofat32_autoselect.patch b/meta/recipes-devtools/dosfstools/dosfstools/nofat32_autoselect.patch
deleted file mode 100644
index 21ebc10..0000000
--- a/meta/recipes-devtools/dosfstools/dosfstools/nofat32_autoselect.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-FAT32 appears to be broken when used with the -d option to populate the msdos
-image. This disables the FAT32 autoselection code which means we don't get
-broken images with the -d option. It can still be enabled on the commandline
-at the users own risk. This changes us back to the 2.10 version's behaviour
-which was known to work well even with large images.
-
-Upstream Status: Inapprioriate [depends on other patches we apply]
-
-RP 2011/12/13
-
-Index: dosfstools-2.11/mkdosfs/mkdosfs.c
-===================================================================
---- dosfstools-2.11.orig/mkdosfs/mkdosfs.c	2011-12-13 13:54:37.538509391 +0000
-+++ dosfstools-2.11/mkdosfs/mkdosfs.c	2011-12-13 13:55:10.258508631 +0000
-@@ -808,10 +808,12 @@
-       bs.media = (char) 0xf8; /* Set up the media descriptor for a hard drive */
-       bs.dir_entries[0] = (char) 0;	/* Default to 512 entries */
-       bs.dir_entries[1] = (char) 2;
-+/*
-       if (!size_fat && blocks*SECTORS_PER_BLOCK > 1064960) {
- 	  if (verbose) printf("Auto-selecting FAT32 for large filesystem\n");
- 	  size_fat = 32;
-       }
-+*/
-       if (size_fat == 32) {
- 	  /* For FAT32, try to do the same as M$'s format command:
- 	   * fs size < 256M: 0.5k clusters
diff --git a/meta/recipes-devtools/dosfstools/dosfstools_2.11.bb b/meta/recipes-devtools/dosfstools/dosfstools_2.11.bb
index ec75ac9..b9e8719 100644
--- a/meta/recipes-devtools/dosfstools/dosfstools_2.11.bb
+++ b/meta/recipes-devtools/dosfstools/dosfstools_2.11.bb
@@ -7,17 +7,14 @@ DESCRIPTION = "DOS FAT Filesystem Utilities"
 SECTION = "base"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://mkdosfs/COPYING;md5=cbe67f08d6883bff587f615f0cc81aa8"
-PR = "r4"
+PR = "r5"
 
 SRC_URI = "ftp://ftp.uni-erlangen.de/pub/Linux/LOCAL/dosfstools/dosfstools-${PV}.src.tar.gz \
            file://mkdosfs-bootcode.patch \
-           file://mkdosfs-dir.patch \
            file://alignment_hack.patch \
            file://msdos_fat12_undefined.patch \
            file://dosfstools-msdos_fs-types.patch \
-           file://include-linux-types.patch \
-           file://nofat32_autoselect.patch \
-           file://fix_populated_dosfs_creation.patch "
+           file://include-linux-types.patch"
 
 SRC_URI[md5sum] = "407d405ade410f7597d364ab5dc8c9f6"
 SRC_URI[sha256sum] = "0eac6d12388b3d9ed78684529c1b0d9346fa2abbe406c4d4a3eb5a023c98a484"
-- 
1.7.6.4




^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy
  2011-12-16  6:14 [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy Darren Hart
  2011-12-16  6:14 ` [PATCH 1/2] bootimg: Use mcopy to construct the hddimg Darren Hart
  2011-12-16  6:14 ` [PATCH 2/2] dosfstools: Remove initial directory contents feature Darren Hart
@ 2011-12-16  6:36 ` Darren Hart
  2 siblings, 0 replies; 10+ messages in thread
From: Darren Hart @ 2011-12-16  6:36 UTC (permalink / raw)
  To: Darren Hart; +Cc: openembedded-core



On 12/15/2011 10:14 PM, Darren Hart wrote:
> The dosfstools -d feature has been shown to be buggy, and even with Nitin's
> fixes applied to get directory hierarchies working, it still generates
> images that fail dosfsck and don't work with FAT32.
> 
> This series presents an alternative means of populating our live images
> using mcopy from mtools.
> 
> Applies on top of my earlier pull request:
> [PATCH 0/4] Fix grub efi menu, kernel messages, and live image dosfsck

I should add that I've built this with the fri2 BSP from the meta-intel
layer and tested EFI booting on 3 different platforms and legacy
SYSLINUX booting on 2 platforms - all using the same core-image-minimal
hddimg.

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] dosfstools: Remove initial directory contents feature
  2011-12-16  6:14 ` [PATCH 2/2] dosfstools: Remove initial directory contents feature Darren Hart
@ 2011-12-16  7:35   ` Koen Kooi
  2011-12-16 10:52     ` Richard Purdie
  2011-12-16 15:40     ` Darren Hart
  0 siblings, 2 replies; 10+ messages in thread
From: Koen Kooi @ 2011-12-16  7:35 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Darren Hart

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]


Op 16 dec. 2011, om 07:14 heeft Darren Hart het volgende geschreven:

> By using mtools, we don't need to continue to maintain and workaround
> the issues generated by the -d feature included in the OE version of
> mkdosfstools. This reduces the number of out-of-tree patches we have to
> carry by 3 and eliminates a rather buggy chunk of code.
> 
> Drop the initial patch adding -d as well as those applied to improve it
> and those applied to work around its deficiencies.

The meta-ti BSP layer is depending on the -b behaviour right now :(




[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 169 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] dosfstools: Remove initial directory contents feature
  2011-12-16  7:35   ` Koen Kooi
@ 2011-12-16 10:52     ` Richard Purdie
  2011-12-16 11:29       ` Koen Kooi
  2011-12-16 15:40     ` Darren Hart
  1 sibling, 1 reply; 10+ messages in thread
From: Richard Purdie @ 2011-12-16 10:52 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Darren Hart

On Fri, 2011-12-16 at 08:35 +0100, Koen Kooi wrote:
> Op 16 dec. 2011, om 07:14 heeft Darren Hart het volgende geschreven:
> 
> > By using mtools, we don't need to continue to maintain and workaround
> > the issues generated by the -d feature included in the OE version of
> > mkdosfstools. This reduces the number of out-of-tree patches we have to
> > carry by 3 and eliminates a rather buggy chunk of code.
> > 
> > Drop the initial patch adding -d as well as those applied to improve it
> > and those applied to work around its deficiencies.
> 
> The meta-ti BSP layer is depending on the -b behaviour right now :(

-b behaviour is unchanged though? ;-)

Serious, can you convert to mcopy like Darren does in the patch for the
live image code? There are some seriously nasty bugs in that -d option
and since there is an easy replacement, I'm going to agree we should
drop the dosfstools patches. I'm not going to take it immediately to
give people a chance to make alternative arrangements but I do think its
going to be the best move going forwards.

Cheers,

Richard






^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] dosfstools: Remove initial directory contents feature
  2011-12-16 10:52     ` Richard Purdie
@ 2011-12-16 11:29       ` Koen Kooi
  0 siblings, 0 replies; 10+ messages in thread
From: Koen Kooi @ 2011-12-16 11:29 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Darren Hart

[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]


Op 16 dec. 2011, om 11:52 heeft Richard Purdie het volgende geschreven:

> On Fri, 2011-12-16 at 08:35 +0100, Koen Kooi wrote:
>> Op 16 dec. 2011, om 07:14 heeft Darren Hart het volgende geschreven:
>> 
>>> By using mtools, we don't need to continue to maintain and workaround
>>> the issues generated by the -d feature included in the OE version of
>>> mkdosfstools. This reduces the number of out-of-tree patches we have to
>>> carry by 3 and eliminates a rather buggy chunk of code.
>>> 
>>> Drop the initial patch adding -d as well as those applied to improve it
>>> and those applied to work around its deficiencies.
>> 
>> The meta-ti BSP layer is depending on the -b behaviour right now :(
> 
> -b behaviour is unchanged though? ;-)

-ENOCOFFEEYET

> Serious, can you convert to mcopy like Darren does in the patch for the
> live image code?

That's the plan!

> There are some seriously nasty bugs in that -d option
> and since there is an easy replacement, I'm going to agree we should
> drop the dosfstools patches. I'm not going to take it immediately to
> give people a chance to make alternative arrangements but I do think its
> going to be the best move going forwards.

I agree completely, I was just pointing that that it is currently being used, so immediate removal would break at least one external layer.

regards,

Koen

[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 169 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] dosfstools: Remove initial directory contents feature
  2011-12-16  7:35   ` Koen Kooi
  2011-12-16 10:52     ` Richard Purdie
@ 2011-12-16 15:40     ` Darren Hart
  2011-12-16 15:47       ` Darren Hart
  1 sibling, 1 reply; 10+ messages in thread
From: Darren Hart @ 2011-12-16 15:40 UTC (permalink / raw)
  To: Koen Kooi; +Cc: Patches and discussions about the oe-core layer

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 12/15/2011 11:35 PM, Koen Kooi wrote:
> 
> Op 16 dec. 2011, om 07:14 heeft Darren Hart het volgende
> geschreven:
> 
>> By using mtools, we don't need to continue to maintain and
>> workaround the issues generated by the -d feature included in the
>> OE version of mkdosfstools. This reduces the number of
>> out-of-tree patches we have to carry by 3 and eliminates a rather
>> buggy chunk of code.
>> 
>> Drop the initial patch adding -d as well as those applied to
>> improve it and those applied to work around its deficiencies.
> 
> The meta-ti BSP layer is depending on the -b behaviour right now
> :(

- -B or -d? I'm removing only -d. If -d, could you use mcopy instead?  See
Patch 1/2 for an example of a recursive population of the image using
mcopy.  Alternatively, you could bbappend dosfstools in meta-ti to
include these patches. Obviously we don't want to remove it from oe-core
until you do one or the other, but ultimately, I think it's better that
we remove it rather than continue to carry the out-of-tree patches
forward.

Of course, we could try to convince someone to dig in and properly fix
the feature and push to get it upstream - but for licensing reasons,
we'd still be stuck carrying the patches. Since mcopy works properly
as it is, I feel it's the preferable option.

Is anyone else making use of the -d feature?

- -- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO62ZFAAoJEKbMaAwKp364kwEIAKcZsX3C9NdzQN10tr0QaAjp
or+ua304+FVlxqsxupUmIA19zm9luAx2xjinmb2Bzuidf2SqBtF/yFXSlMqFGden
YsuiSR83kZPulTxA7oc1VqZ2tD9mfPh3x08mPhNC81ldbpthIjDwOhKg5jyKZS29
FwUOxVzPlG460yoH73K3MiRs0IN+v8cAZTTofPFX3YcibH+hMG73r8KFsG3wHZqp
GsAWRHjQfEcFgYpKMydbv18t3VFNsWNZQFIndV7GPrn0ORHQhT+ctLK9/uin7hh+
g2SJ+BBuAE3fMqSxsW+scn6dYAmx//OBHbMU3PhB7V54aBBVtLJVUfNGoNQwxkw=
=DSZO
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] dosfstools: Remove initial directory contents feature
  2011-12-16 15:40     ` Darren Hart
@ 2011-12-16 15:47       ` Darren Hart
  0 siblings, 0 replies; 10+ messages in thread
From: Darren Hart @ 2011-12-16 15:47 UTC (permalink / raw)
  To: Koen Kooi; +Cc: Patches and discussions about the oe-core layer

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



On 12/16/2011 07:40 AM, Darren Hart wrote:
> 
> 
> On 12/15/2011 11:35 PM, Koen Kooi wrote:
> 
>> Op 16 dec. 2011, om 07:14 heeft Darren Hart het volgende 
>> geschreven:
> 
>>> By using mtools, we don't need to continue to maintain and 
>>> workaround the issues generated by the -d feature included in
>>> the OE version of mkdosfstools. This reduces the number of 
>>> out-of-tree patches we have to carry by 3 and eliminates a
>>> rather buggy chunk of code.
>>> 
>>> Drop the initial patch adding -d as well as those applied to 
>>> improve it and those applied to work around its deficiencies.
> 
>> The meta-ti BSP layer is depending on the -b behaviour right now 
>> :(
> 
> -B or -d? I'm removing only -d. If -d, could you use mcopy instead?
> See Patch 1/2 for an example of a recursive population of the image
> using mcopy.  Alternatively, you could bbappend dosfstools in
> meta-ti to include these patches. Obviously we don't want to remove
> it from oe-core until you do one or the other, but ultimately, I
> think it's better that we remove it rather than continue to carry
> the out-of-tree patches forward.
> 
> Of course, we could try to convince someone to dig in and properly
> fix the feature and push to get it upstream - but for licensing
> reasons, we'd still be stuck carrying the patches. Since mcopy
> works properly as it is, I feel it's the preferable option.
> 
> Is anyone else making use of the -d feature?
> 

Erm. sorry, I see you and RP already hashed this out. -ENOPEPSIYET...

- -- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO62gWAAoJEKbMaAwKp364a24IAKZbLmfLVr2+xKXoMa76jn93
gCvN9EF+UAbihTnl4BBzupmUVakimGeqyqEMQsc3svjy+IHhuUiNX7jy0eF8ICTj
eF4sbYI7y3/XpPMh60tD7l+rnyWhfOAl4UVRl5RVlGwGlxBz01Z9v8qBx7tJeDMm
p7UuEQAm3OejI8sEGlXZ/BwlkLI/ed1vRxTBMIJXrUNRY1TPaBNDK/33KLoWsboq
ygxDSt2XDuvmrfftGRPTJQP+dVGpBWQWrnJndCnnwz/5JYvX9DRpfGrgufuJ8e+o
uDAn7iLhtEoNtNMF+QTG8g+asMljxUA90aq0itcr3tzKkZPEk1DEAJVkcLdJGSs=
=4001
-----END PGP SIGNATURE-----



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] bootimg: Use mcopy to construct the hddimg
  2011-12-16  6:14 ` [PATCH 1/2] bootimg: Use mcopy to construct the hddimg Darren Hart
@ 2011-12-16 16:18   ` Richard Purdie
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Purdie @ 2011-12-16 16:18 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Darren Hart

On Thu, 2011-12-15 at 22:14 -0800, Darren Hart wrote:
> The initial directory support (-d) added to mkdosfs has proven to be incomplete
> and non-compliant with FAT. Rather than continue to maintain this feature and
> work around the various issues, we can use mcopy to construct the image.
> 
> bootimg.bbclass already depends on mtools-native (although it may not have
> needed to previously). No new dependencies are introduced. The image created
> passes dosfsck cleanly. Remove the call to dosfsck.
> 
> mcopy reported an error with the image we were creating:
> Total number of sectors (107574) not a multiple of sectors per track (32)!
> 
> Add some logic to ensure the total sector count is an integral number of sectors
> per track, including forcing the logical sector size to 512 in the mkdosfs
> command.
> 
> The du -bks arguments are contradictory, -b is equivalent to "--apparent-size
> --block-size=1" and -k is --block-size=1K. If reordered, -kbs will report the
> disk usage in bytes insteadk of 1k blocks. Eliminate the ambiguity by using:
> du --apparent-size -ks
> 
> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> CC: Nitin A. Kamble <nitin.a.kamble@intel.com>
> ---
>  meta/classes/bootimg.bbclass |   18 +++++++++++++-----
>  1 files changed, 13 insertions(+), 5 deletions(-)

Merged into master, thanks.

I'm going to hold off 2/2 to give other users a chance to migrate to
mcopy.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-12-16 16:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-16  6:14 [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy Darren Hart
2011-12-16  6:14 ` [PATCH 1/2] bootimg: Use mcopy to construct the hddimg Darren Hart
2011-12-16 16:18   ` Richard Purdie
2011-12-16  6:14 ` [PATCH 2/2] dosfstools: Remove initial directory contents feature Darren Hart
2011-12-16  7:35   ` Koen Kooi
2011-12-16 10:52     ` Richard Purdie
2011-12-16 11:29       ` Koen Kooi
2011-12-16 15:40     ` Darren Hart
2011-12-16 15:47       ` Darren Hart
2011-12-16  6:36 ` [PATCH 0/2] Drop dosfstools -d feature in favor of mtools mcopy Darren Hart

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.