Pkg.JFFS2 — API for parsing JFFS2 file system images

Overview

The Pkg.JFFS2 module contains the API for parsing JFFS2 (Journalling Flash File System v2) images.

JFFS2 is a log-structured file system designed for raw NOR and NAND flash memory, widely used in embedded Linux devices, routers, IoT hardware, and firmware images. It supports transparent data compression (zlib, rtime, LZO) and handles both little-endian and big-endian byte orders.

Enumerating JFFS2 Files

The following code example demonstrates how to enumerate files in a JFFS2 file system:

from Pro.Core import *
from Pkg.JFFS2 import *

def enumerateFiles(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    obj = JFFS2Object()
    if not obj.Load(c) or not obj.Initialize():
        return
    nre = CFSNonRecursiveEnum(obj)
    nre.AddPath(obj.FSRootDirectory())
    while True:
        f = nre.Next(None)
        if not f:
            break
        entry = obj.FSGetEntry(f, None)
        if not entry.IsNull():
            print(entry.Name(), entry.DataSize())

Module API

Pkg.JFFS2 module API.

Classes:

JFFS2Object()

This class represents a JFFS2 (Journalling Flash File System v2) image.

class JFFS2Object

Bases: Pro.Core.CFFObject

This class represents a JFFS2 (Journalling Flash File System v2) image.

JFFS2 is a log-structured file system designed for raw NOR and NAND flash memory, commonly found in embedded Linux devices, routers, and IoT firmware. The class provides file system support through the CFS interface inherited from CFFObject, with transparent decompression of zlib, rtime, and LZO compressed data.

Methods:

GetDirectoryCount()

Returns the number of directories in the file system.

GetFileCount()

Returns the number of regular files and symlinks in the file system.

GetNodeCount()

Returns the total number of parsed JFFS2 nodes in the image.

GetDirectoryCount()int

Returns the number of directories in the file system.

Returns

Returns the directory count.

Return type

int

GetFileCount()int

Returns the number of regular files and symlinks in the file system.

Returns

Returns the file count.

Return type

int

GetNodeCount()int

Returns the total number of parsed JFFS2 nodes in the image.

This includes inode nodes, directory entry nodes, cleanmarkers, and other node types.

Returns

Returns the node count.

Return type

int