@@ -4,33 +4,39 @@ initramfs buffer format
44
55Al Viro, H. Peter Anvin
66
7- Last revision: 2002-01-13
8-
9- Starting with kernel 2.5.x, the old "initial ramdisk" protocol is
10- getting {replaced/complemented} with the new "initial ramfs"
11- (initramfs) protocol. The initramfs contents is passed using the same
12- memory buffer protocol used by the initrd protocol, but the contents
7+ With kernel 2.5.x, the old "initial ramdisk" protocol was complemented
8+ with an "initial ramfs" protocol. The initramfs content is passed
9+ using the same memory buffer protocol used by initrd, but the content
1310is different. The initramfs buffer contains an archive which is
14- expanded into a ramfs filesystem; this document details the format of
15- the initramfs buffer format.
11+ expanded into a ramfs filesystem; this document details the initramfs
12+ buffer format.
1613
1714The initramfs buffer format is based around the "newc" or "crc" CPIO
1815formats, and can be created with the cpio(1) utility. The cpio
19- archive can be compressed using gzip(1). One valid version of an
20- initramfs buffer is thus a single .cpio.gz file.
16+ archive can be compressed using gzip(1), or any other algorithm provided
17+ via CONFIG_DECOMPRESS_*. One valid version of an initramfs buffer is
18+ thus a single .cpio.gz file.
2119
2220The full format of the initramfs buffer is defined by the following
2321grammar, where::
2422
2523 * is used to indicate "0 or more occurrences of"
2624 (|) indicates alternatives
2725 + indicates concatenation
28- GZIP() indicates the gzip(1) of the operand
26+ GZIP() indicates gzip compression of the operand
27+ BZIP2() indicates bzip2 compression of the operand
28+ LZMA() indicates lzma compression of the operand
29+ XZ() indicates xz compression of the operand
30+ LZO() indicates lzo compression of the operand
31+ LZ4() indicates lz4 compression of the operand
32+ ZSTD() indicates zstd compression of the operand
2933 ALGN(n) means padding with null bytes to an n-byte boundary
3034
31- initramfs := ("\0" | cpio_archive | cpio_gzip_archive )*
35+ initramfs := ("\0" | cpio_archive | cpio_compressed_archive )*
3236
33- cpio_gzip_archive := GZIP(cpio_archive)
37+ cpio_compressed_archive := (GZIP(cpio_archive) | BZIP2(cpio_archive)
38+ | LZMA(cpio_archive) | XZ(cpio_archive) | LZO(cpio_archive)
39+ | LZ4(cpio_archive) | ZSTD(cpio_archive))
3440
3541 cpio_archive := cpio_file* + (<nothing> | cpio_trailer)
3642
@@ -75,6 +81,8 @@ c_chksum 8 bytes Checksum of data field if c_magic is 070702;
7581The c_mode field matches the contents of st_mode returned by stat(2)
7682on Linux, and encodes the file type and file permissions.
7783
84+ c_mtime is ignored unless CONFIG_INITRAMFS_PRESERVE_MTIME=y is set.
85+
7886The c_filesize should be zero for any file which is not a regular file
7987or symlink.
8088
0 commit comments