@@ -4,33 +4,39 @@ initramfs buffer format
4
4
5
5
Al Viro, H. Peter Anvin
6
6
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
13
10
is 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.
16
13
17
14
The initramfs buffer format is based around the "newc" or "crc" CPIO
18
15
formats, 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.
21
19
22
20
The full format of the initramfs buffer is defined by the following
23
21
grammar, where::
24
22
25
23
* is used to indicate "0 or more occurrences of"
26
24
(|) indicates alternatives
27
25
+ 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
29
33
ALGN(n) means padding with null bytes to an n-byte boundary
30
34
31
- initramfs := ("\0" | cpio_archive | cpio_gzip_archive )*
35
+ initramfs := ("\0" | cpio_archive | cpio_compressed_archive )*
32
36
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))
34
40
35
41
cpio_archive := cpio_file* + (<nothing> | cpio_trailer)
36
42
@@ -75,6 +81,8 @@ c_chksum 8 bytes Checksum of data field if c_magic is 070702;
75
81
The c_mode field matches the contents of st_mode returned by stat(2)
76
82
on Linux, and encodes the file type and file permissions.
77
83
84
+ c_mtime is ignored unless CONFIG_INITRAMFS_PRESERVE_MTIME=y is set.
85
+
78
86
The c_filesize should be zero for any file which is not a regular file
79
87
or symlink.
80
88
0 commit comments