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
Offset
Size
Type
Field
Notes
0x40
12
bytes
–
0x40
12
bytes
Module State
Locate
Offset
Size
Type
Field
Notes
0x0
4
u32 LE
Agic
0x10
16
bytes
–
Other fields read
Read in
Offset
Size
Type
Field
Notes
Locate
0x0
4
u32 LE
–
Probe
0x4
4
u32 LE
Volume Length
Constants
Cramfs File System
Name
Value
Type
Notes
Page
4096
int
Signatures and magic strings referenced
Text
Where checked
Compressed ROMFS
Locate
Structures and constants were extracted from the implementation. Prose sections are a summary from public sources; verify details before relying on them.