Format:cramfs
| Magic | 45 3D CD 28 (LE) or 28 CD 3D 45 (BE); string "Compressed ROMFS" at offset 16 |
|---|---|
| Extensions | .cramfs |
| Endianness | either |
| License | GPL-2.0 (Linux) |
| On this wiki | Facts · Code · Notes · Topics |
Tiny read-only zlib-compressed filesystem of older embedded Linux: 76-byte superblock with magic 0x28cd3d45 and the signature string 'Compressed ROMFS', 4 KiB pages compressed individually.
Superblock (struct cramfs_super)
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | magic 0x28cd3d45 |
| 4 | 4 | size |
| 8 | 4 | flags |
| 12 | 4 | future |
| 16 | 16 | signature "Compressed ROMFS" |
| 32 | 16 | fsid (crc u32, edition u32, blocks u32, files u32) |
| 48 | 16 | name |
| 64 | 12 | root inode |
Flags: 0x01 fsid version 2, 0x02 sorted dirs, 0x100 holes, 0x200 wrong signature (reserved), 0x400 shifted root offset, 0x800 extended block pointers. Endianness is the target's: the magic as bytes is 45 3D CD 28 on little-endian, 28 CD 3D 45 on big-endian images. The crc in fsid covers the whole image with the crc field zeroed. Files are split in 4 KiB pages, each compressed with zlib (Format:DEFLATE) and located through per-file block pointer tables; inodes are 12 bytes (mode/uid, size/gid, namelen/offset bitfields).
Analyst notes
The superblock may start after a 512-byte boot block at offset 512. Extract with cramfsck -x (endianness must match the host, otherwise use a tool that swaps) or binwalk's built-in extractor. Mostly superseded by Format:SquashFS.
Source: Linux include/uapi/linux/cramfs_fs.h.