Difference between revisions of "NAND"

From iQueBrew
Jump to navigation Jump to search
(TODO: BBFS entry / footer / spare data formats)
 
(→‎FAT: I personally think this looks better (others might agree))
Line 21: Line 21:
  
 
Possible FAT entries:
 
Possible FAT entries:
{| border=1
+
 
 +
{| class="wikitable" style="width:30%"
 
|-
 
|-
 
! Value
 
! Value

Revision as of 07:17, 24 March 2018

The iQue uses a 64MiB NAND flash, which consists of 4096 logical blocks of 16384 bytes each (made up of 32 512-byte pages)

Each page also has 16 bytes of spare data, which is used for bad-block markers, error-correction codes and block-pointers for the SA area.

Unfortunately the I@H USB commands for reading/writing NAND can only access the last page-spare of each block, though hardware NAND writers can access all of them.

Block Map

  • 0x0 - 0x40 - SKSA area, marked in the BBFS FAT as reserved
  • 0x40 - 0xFF0 - data area, used for files in the BBFS
  • 0xFF0 - 0x1000 - BBFS area, each block holds a copy of the BBFS along with a 'sequence number', highest sequence number is the latest BBFS.

BBFS

BBFS is the filesystem used on the iQue NAND, a very simple file-system used to store games and config data. The Wii NAND's SFFS is actually very similar to BBFS, though with many more features.

The BBFS is made up of three parts: a FAT (file-allocation table), an entry table and a footer:

FAT

The FAT is located at 0x0 in the BBFS block, made up of 0x1000 16-bit signed integers (one for each block in the NAND). This is used to specify if a block may be reserved, bad or available, or it might point to another block in the 'chain' (ie. file 0 points to block 0, block 0 points to block 2, block 2 points to block 15...), or signify the end of the chain.

Files make use of the FAT by simply pointing to a block in the FAT as its start block. Extracting the file is then just a matter of following the chain of pointers in the FAT, reading in each block until you reach an end-of-chain marker.

Possible FAT entries:

Value Description
0 Free/unused block
-1 End-of-chain marker
-2 Bad block
-3 Reserved block (used for SKSA area)