cramfs (Compressed ROM File System)

cramfs is a simple compressed read-only file system by Linus Torvalds (2000), widely used in older router and set-top-box firmware. SquashFS replaced it, but it is still found in older firmware dumps.

Overview

cramfs stores each file in 4 KiB pages compressed with zlib, with a table of block pointers per file. Metadata is stored uncompressed in inodes packed at the start of the image. The superblock has a magic number and a CRC and records a volume name and edition.

History

  • Created by Linus Torvalds and merged in Linux 2.3.39 (2000).
  • Replaced by SquashFS for most uses.

Structures

Offsets are in bytes from the start of the structure named in each heading. Field names are descriptive and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.

Cramfs File System

OffsetSizeTypeFieldNotes
0x4012bytes–
0x4012bytesModule State

Locate

OffsetSizeTypeFieldNotes
0x04u32 LEAgic
0x1016bytes–

Other fields read

Read inOffsetSizeTypeFieldNotes
Locate0x04u32 LE–
Probe0x44u32 LEVolume Length

Constants

Cramfs File System

NameValueTypeNotes
Page4096int

Signatures and magic strings referenced

TextWhere checked
Compressed ROMFSLocate
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.