[oe-commits] Koen Kooi : x-load git: add patch for beagleboard to fix u-boot in fat32 partitions

git version control git at git.openembedded.org
Tue Nov 16 15:26:05 UTC 2010


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 503f015b083a56cd1af74d8675d0c58a519b9cdd
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=503f015b083a56cd1af74d8675d0c58a519b9cdd

Author: Koen Kooi <koen at openembedded.org>
Date:   Tue Nov 16 16:11:50 2010 +0100

x-load git: add patch for beagleboard to fix u-boot in fat32 partitions

---

 ...ading-FAT32-root-dirs-that-span-1-cluster.patch |   83 ++++++++++++++++++++
 recipes/x-load/x-load_git.bb                       |    5 +-
 2 files changed, 86 insertions(+), 2 deletions(-)

diff --git a/recipes/x-load/x-load-git/beagleboard/0001-Fix-reading-FAT32-root-dirs-that-span-1-cluster.patch b/recipes/x-load/x-load-git/beagleboard/0001-Fix-reading-FAT32-root-dirs-that-span-1-cluster.patch
new file mode 100644
index 0000000..02787c3
--- /dev/null
+++ b/recipes/x-load/x-load-git/beagleboard/0001-Fix-reading-FAT32-root-dirs-that-span-1-cluster.patch
@@ -0,0 +1,83 @@
+From e710d42095e5abb7f392ed1c3a0927b37a72a833 Mon Sep 17 00:00:00 2001
+From: Nick Gasson <nick at nickg.me.uk>
+Date: Sat, 13 Nov 2010 18:57:35 +0000
+Subject: [PATCH] Fix reading FAT32 root dirs that span >1 cluster
+
+Unlike FAT12/16, FAT32 does not guarantee that root directories will
+occupy consecutive clusters. To get each cluster after the first you
+must access the FAT as with any other directory. This patch implements
+this and bumps up the largest valid cluster number to support large
+e.g. 64MB partitions.
+---
+ fs/fat/fat.c |   20 +++++++++++++++-----
+ 1 files changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/fs/fat/fat.c b/fs/fat/fat.c
+index c6bdb13..44ecb4a 100644
+--- a/fs/fat/fat.c
++++ b/fs/fat/fat.c
+@@ -384,7 +384,7 @@ get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
+ 			newclust = get_fatent(mydata, endclust);
+ 			if((newclust -1)!=endclust)
+ 				goto getit;
+-			if (newclust <= 0x0001 || newclust >= 0xfff0) {
++			if (newclust <= 0x0001 || newclust >= 0xfffff0) {
+ 				FAT_DPRINT("curclust: 0x%x\n", newclust);
+ 				FAT_DPRINT("Invalid FAT entry\n");
+ 				return gotsize;
+@@ -419,7 +419,7 @@ getit:
+ 		filesize -= actsize;
+ 		buffer += actsize;
+ 		curclust = get_fatent(mydata, endclust);
+-		if (curclust <= 0x0001 || curclust >= 0xfff0) {
++		if (curclust <= 0x0001 || curclust >= 0xfffff0) {
+ 			FAT_DPRINT("curclust: 0x%x\n", curclust);
+ 			FAT_ERROR("Invalid FAT entry\n");
+ 			return gotsize;
+@@ -580,7 +580,7 @@ static dir_entry *get_dentfromdir (fsdata * mydata, int startsect,
+ 	    return retdent;
+ 	}
+ 	curclust = get_fatent (mydata, curclust);
+-	if (curclust <= 0x0001 || curclust >= 0xfff0) {
++	if (curclust <= 0x0001 || curclust >= 0xfffff0) {
+ 	    FAT_DPRINT ("curclust: 0x%x\n", curclust);
+ 	    FAT_ERROR ("Invalid FAT entry\n");
+ 	    return NULL;
+@@ -679,7 +679,7 @@ do_fat_read(const char *filename, void *buffer, unsigned long maxsize,
+     dir_entry *dentptr;
+     __u16 prevcksum = 0xffff;
+     char *subname = "";
+-    int rootdir_size, cursect;
++    int rootdir_size, cursect, curclus;
+     int idx, isdir = 0;
+     int files = 0, dirs = 0;
+     long ret = 0;
+@@ -697,6 +697,7 @@ do_fat_read(const char *filename, void *buffer, unsigned long maxsize,
+     mydata->fat_sect = bs.reserved;
+     cursect = mydata->rootdir_sect
+ 	    = mydata->fat_sect + mydata->fatlength * bs.fats;
++    curclus = bs.root_cluster;   // For FAT32 only
+     mydata->clust_size = bs.cluster_size;
+     if (mydata->fatsize == 32) {
+ 	rootdir_size = mydata->clust_size;
+@@ -818,7 +819,16 @@ do_fat_read(const char *filename, void *buffer, unsigned long maxsize,
+ 
+ 	    goto rootdir_done;  /* We got a match */
+ 	}
+-	cursect++;
++
++	if (mydata->fatsize != 32)
++	   cursect++;
++	else {
++	   // FAT32 does not guarantee contiguous root directory
++	   curclus = get_fatent (mydata, curclus);
++	   cursect = (curclus * mydata->clust_size) + mydata->data_begin;
++
++	   FAT_DPRINT ("root clus %d sector %d\n", curclus, cursect);
++	}
+     }
+   rootdir_done:
+ 
+-- 
+1.6.6.1
+
diff --git a/recipes/x-load/x-load_git.bb b/recipes/x-load/x-load_git.bb
index eb4a2de..9daaf6c 100644
--- a/recipes/x-load/x-load_git.bb
+++ b/recipes/x-load/x-load_git.bb
@@ -9,7 +9,7 @@ SRCREV_beagleboard = "1c9276af4d6a5b7014a7630a1abeddf3b3177563"
 
 PV = "1.42+${PR}+gitr${SRCREV}"
 PV_beagleboard = "1.44+${PR}+gitr${SRCREV}"
-PR ="r16"
+PR ="r17"
 PE = "1"
 
 SRC_URI = "git://gitorious.org/x-load-omap3/mainline.git;branch=master;protocol=git"
@@ -18,7 +18,8 @@ SRC_URI_append_beagleboard = " \
                               file://name.patch \
                               file://bb8547fcbc54ecc7a75f9ad45a31042a04d8a2ce.patch \
                               file://xm-mem.patch \
-                             "
+                              file://0001-Fix-reading-FAT32-root-dirs-that-span-1-cluster.patch \
+"
 
 SRC_URI_append_omap3-touchbook = " \
                               file://name.patch \





More information about the Openembedded-commits mailing list