Skip to content
saga0324Public

About

Tool for Nand Data Management System

Resources

Stars

3 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

NDMS Tool

NdmsTool is an offline utility for extracting and rebuilding Nand Data Management System (NDMS) backup for ST-Ericsson EMP Platform FTL . It supports raw NAND data with a separate OOB dump, SD card NANDxx.DAT sets, concatenated S-AND.bin DAT streams, and S-AND backups in NOR-OOB mode.

Features

  • Extract committed logical objects from raw NAND data and OOB files.
  • Extract SD card NANDxx.DAT directories and concatenated DAT streams.
  • Extract S-AND backups in NOR-OOB mode using a separate object map.
  • Select which version to keep when a DAT logical object occurs more than once.
  • Recover uncommitted raw-NAND objects for inspection.
  • Write logical object ranges, unparsed data, and detected MBR partition images.
  • Pack a partition image into a new SD DAT set.
  • Patch an existing SD DAT set or concatenated DAT stream while preserving its original layout.
  • Patch existing S-AND objects in NOR-OOB mode using the original mapping.

Requirements

  • Python 3.10 or newer

Usage

Display the available commands:

python3 NdmsTool.py --help
python3 NdmsTool.py unpack --help
python3 NdmsTool.py pack --help

Unpack Raw NAND Data

Extract a raw NAND data file and its matching OOB file:

python3 NdmsTool.py unpack raw NAND.bin NAND.oob extracted

Write every logical object to a separate file:

python3 NdmsTool.py unpack raw NAND.bin NAND.oob extracted --split

Include uncommitted objects for recovery analysis:

python3 NdmsTool.py unpack raw NAND.bin NAND.oob recovered --undelete

Use --ignore to continue when a committed logical object ID occurs more than once.

Unpack DAT Backups

Extract a directory containing contiguous NAND00.DAT, nand01.dat, and later files:

python3 NdmsTool.py unpack sdstream NAND_DAT extracted

Extract a concatenated S-AND.bin DAT stream:

python3 NdmsTool.py unpack udbstream S-AND.bin extracted

The default --dat-version prefer-ffff selects the version whose first page has the committed 0000FFFF state. Other policies are first, last, and prefer-zero:

python3 NdmsTool.py unpack udbstream S-AND.bin extracted \
  --dat-version last

Use --ignore to retain complete objects while ignoring truncated object versions. Use --split to write every logical object separately.

Unpack in NOR-OOB Mode

NOR-OOB mode reads object metadata from a separate NOR-OOB file (NOR.bin) instead of DAT metadata appended to each S-AND page. Supply both files:

python3 NdmsTool.py unpack udbstream S-AND.bin extracted --noroob NOR.bin

Extraction Output

The extraction directory can contain:

  • NNNN_NNNN.bin: one object or a contiguous logical-object range.
  • leftover.bin: data that was not assigned to a valid logical object.
  • leftover_map.json: source offsets and reasons for leftover data in raw NAND and NOR-OOB modes.
  • noroob_object_map.json: object IDs and source offsets in NOR-OOB mode.
  • partition_NNNNN_type_XX.img: an MBR-declared partition reconstructed from logical objects.

Sparse gaps inside a reconstructed range or partition image are filled with zero bytes.

Packing Workflows

The input image size must be a multiple of the logical object size. The default object size is 0x1000 bytes. --first-id specifies the logical object ID that corresponds to offset zero of the image and accepts decimal or 0x-prefixed values.

Create a New SD DAT Set

Create a new NANDxx.DAT directory from a partition image:

python3 NdmsTool.py pack sdstream partition.img rebuilt_dat \
  --first-id 0x1200

Specify a different logical object size when required:

python3 NdmsTool.py pack sdstream partition.img rebuilt_dat \
  --first-id 0x1200 --object-size 0x2000

Patch an Existing SD DAT Set

Use an original DAT directory as the layout template and write the result to a different directory:

python3 NdmsTool.py pack sdstream partition.img patched_dat \
  --first-id 0x1200 --template original_dat

Existing matching objects are replaced. Missing nonzero objects are inserted only when the template has enough contiguous erased DAT records. Missing all-zero objects are left sparse.

Patch a Concatenated DAT Stream

Packing udbstream always requires an original concatenated stream as a template:

python3 NdmsTool.py pack udbstream partition.img patched-S-AND.bin \
  --first-id 0x1200 --template original-S-AND.bin

The output path must differ from the template path. NdmsTool verifies the patched or synthesized output after writing it.

Patch in NOR-OOB Mode

Use the original S-AND and matching NOR-OOB file as the template pair:

python3 NdmsTool.py pack udbstream partition.img patched-S-AND.bin \
  --first-id 0x1200 --template original-S-AND.bin --noroob original-NOR.bin

The output is a full S-AND copy with changed objects replaced at their existing physical offsets. Reuse the original NOR-OOB file with the output: its records and object locations remain unchanged. This does not create a new NOR-OOB file. The image must contain whole logical objects, normally 0x1000 bytes each.

Missing all-zero objects remain sparse. A missing nonzero object or a change in object size is rejected before the output is written. Adding files or growing existing files can require new objects and is therefore not always supported. Allocating objects, relocating data, and updating NOR-OOB table generation or garbage-collection fields are not implemented.

Verification checks every replacement and every unchanged byte against the template. Offline packing and round-trip checks do not establish device restore compatibility or validate application-level checksums.

About

Tool for Nand Data Management System

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages