Index: soft/giet_vm/giet_fat32/fat32.c
===================================================================
--- soft/giet_vm/giet_fat32/fat32.c	(revision 295)
+++ soft/giet_vm/giet_fat32/fat32.c	(revision 300)
@@ -6,5 +6,5 @@
 //////////////////////////////////////////////////////////////////////////////////
 // The fat32.h and fat32.c files define a library of access functions
-// to a FAT32 partition on a block device. It is intended to be used
+// to a FAT32 disk on a block device. It is intended to be used
 // by the GIET_VM nano-kernel for both the boot code and the kernel code.
 // This code uses functions defined in the utils.c and drivers.c files.
@@ -175,5 +175,5 @@
 ///////////////////////////////////////////////////////////////////////////////// 
 // This function search the FAT (using the FAT cache), and returns 
-// the next cluster index from the curent cluster index in the FAT.
+// the next cluster index from the current cluster index in the FAT.
 // remark: a sector of FAT contains 128 cluster indexes.
 /////////////////////////////////////////////////////////////////////////////////
@@ -182,5 +182,5 @@
 {
     // compute lba of the sector containing the cluster index
-    unsigned int lba = fat.partition_lba + 32 + (cluster / 128);
+    unsigned int lba = fat.fat_lba + (cluster / 128);
 
     if ( lba == fat.cache_lba )      // hit in cache
@@ -666,5 +666,5 @@
                                        unsigned int value  )
 {
-    unsigned int lba = fat.partition_lba + 32 + (cluster / 128);
+    unsigned int lba = fat.fat_lba + (cluster / 128);
 
 #if GIET_DEBUG_FAT
@@ -818,5 +818,5 @@
 
 #if GIET_DEBUG_FAT
-_printf("\n[FAT DEBUG] enter _scan_directory() searching dir/file %s", filename );
+_printf("\n[FAT DEBUG] enter _scan_directory() searching dir/file %s", file_name );
 #endif
 
@@ -1030,52 +1030,20 @@
         x, y, lpid );
 #endif
-
-    // load Master Boot Record (sector 0) into fat cache
-    if ( _ioc_read( 0,                // channel
-                    mode,             // mode for IOC driver
-                    0,                // sector index 
-                    fat.fat_cache,    // buffer address
-                    1 ) )             // one sector
-    { 
-        _printf("\n[FAT ERROR] in _fat_init() cannot load Boot Sector\n"); 
-        return -1;
-    }
-    fat.cache_lba = 0;
     
-#if GIET_DEBUG_FAT
-display_fat_cache();
-#endif
-
-    // checking Boot sector integrity
-    if( MBR_SIGNATURE_VALUE != read_entry( MBR_SIGNATURE_POSITION, fat.fat_cache, 1))
-    {
-        _printf("\n[FAT ERROR] Boot sector not recognized or corrupt \n"); 
-        return -1;  
-    }
-
-#if GIET_DEBUG_FAT
-_printf("\n[FAT DEBUG] Boot Sector Loaded\n");
-#endif
-
-    // initialise fat descriptor from Boot sector
-    fat.partition_lba     = read_entry( FIRST_PARTITION_BEGIN_LBA, fat.fat_cache, 1 );
-    fat.partition_sectors = read_entry( FIRST_PARTITION_SIZE,      fat.fat_cache, 1 );
-
-    // load Partition Boot Record (first partition sector) into fat cache
+    // load Boot Record (VBR) into fat cache
     if ( _ioc_read( 0,                   // channel
                     mode,                // mode for IOC driver
-                    fat.partition_lba,   // sector index
+                    0,                   // sector index
                     fat.fat_cache,       // buffer address
                     1 ) )                // one sector
     {
-        _printf("\n[FAT ERROR] in _fat_init() cannot load block %x\n", fat.partition_lba );
+        _printf("\n[FAT ERROR] in _fat_init() cannot load VBR\n");
         return -1;
     }
-    fat.cache_lba = fat.partition_lba;
-
-#if GIET_DEBUG_FAT
-_printf("\n[FAT DEBUG] Partition First Sector Loaded\n");
-#endif
-
+    fat.cache_lba = 0;
+
+#if GIET_DEBUG_FAT
+_printf("\n[FAT DEBUG] Boot Sector Loaded\n");
+#endif
 
     // checking various FAT32 assuptions from boot sector
@@ -1085,9 +1053,4 @@
         return -1;  
     }
-    if( read_entry( BPB_RSVDSECCNT, fat.fat_cache, 1 ) != 32 ) 
-    {
-        _printf("\n[FAT ERROR] The RSVD region in FAT32 must be 32 sectors\n");
-        return -1;  
-    }
     if( read_entry( BPB_NUMFATS, fat.fat_cache, 1 ) != 1 )
     {
@@ -1105,12 +1068,14 @@
         return -1;  
     }
-    fat.fs_info_lba         = read_entry( BPB_FAT32_FSINFO, fat.fat_cache, 1 ) + fat.partition_lba;
-
-    // initialise fat descriptor from partition first sector
+    // FS Info always in sector 1
+    fat.fs_info_lba         = read_entry( BPB_FAT32_FSINFO, fat.fat_cache, 1 );
+
+    // initialise fat descriptor from VBR
     fat.sectors_per_cluster = read_entry( BPB_SECPERCLUS, fat.fat_cache, 1 );
     fat.sector_size         = read_entry( BPB_BYTSPERSEC, fat.fat_cache, 1 );
     fat.cluster_size        = fat.sectors_per_cluster * 512;
     fat.fat_sectors         = read_entry( BPB_FAT32_FATSZ32, fat.fat_cache, 1 );
-    fat.data_lba            = 32 + fat.fat_sectors + fat.partition_lba;
+    fat.fat_lba             = read_entry( BPB_RSVDSECCNT, fat.fat_cache, 1 );
+    fat.data_lba            = fat.fat_lba + fat.fat_sectors;
     fat.initialised         = FAT_INITIALISED;
 
@@ -1153,6 +1118,5 @@
     _printf("\nSector Size  (bytes)           %x", fat.sector_size );
     _printf("\nSectors per cluster            %x", fat.sectors_per_cluster );
-    _printf("\nPartition size (sectors)       %x", fat.partition_sectors );
-    _printf("\nPartition first lba            %x", fat.partition_lba ); 
+    _printf("\nFAT region first lba           %x", fat.fat_lba );
     _printf("\nData region first lba          %x", fat.data_lba );
     _printf("\nNumber of sectors for one FAT  %x", fat.fat_sectors );
