162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# Configuration for initramfs
462306a36Sopenharmony_ci#
562306a36Sopenharmony_ci
662306a36Sopenharmony_ciconfig INITRAMFS_SOURCE
762306a36Sopenharmony_ci	string "Initramfs source file(s)"
862306a36Sopenharmony_ci	default ""
962306a36Sopenharmony_ci	help
1062306a36Sopenharmony_ci	  This can be either a single cpio archive with a .cpio suffix or a
1162306a36Sopenharmony_ci	  space-separated list of directories and files for building the
1262306a36Sopenharmony_ci	  initramfs image.  A cpio archive should contain a filesystem archive
1362306a36Sopenharmony_ci	  to be used as an initramfs image.  Directories should contain a
1462306a36Sopenharmony_ci	  filesystem layout to be included in the initramfs image.  Files
1562306a36Sopenharmony_ci	  should contain entries according to the format described by the
1662306a36Sopenharmony_ci	  "usr/gen_init_cpio" program in the kernel tree.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci	  When multiple directories and files are specified then the
1962306a36Sopenharmony_ci	  initramfs image will be the aggregate of all of them.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci	  See <file:Documentation/driver-api/early-userspace/early_userspace_support.rst> for more details.
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci	  If you are not sure, leave it blank.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciconfig INITRAMFS_FORCE
2662306a36Sopenharmony_ci	bool "Ignore the initramfs passed by the bootloader"
2762306a36Sopenharmony_ci	depends on CMDLINE_EXTEND || CMDLINE_FORCE
2862306a36Sopenharmony_ci	help
2962306a36Sopenharmony_ci	  This option causes the kernel to ignore the initramfs image
3062306a36Sopenharmony_ci	  (or initrd image) passed to it by the bootloader. This is
3162306a36Sopenharmony_ci	  analogous to CMDLINE_FORCE, which is found on some architectures,
3262306a36Sopenharmony_ci	  and is useful if you cannot or don't want to change the image
3362306a36Sopenharmony_ci	  your bootloader passes to the kernel.
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciconfig INITRAMFS_ROOT_UID
3662306a36Sopenharmony_ci	int "User ID to map to 0 (user root)"
3762306a36Sopenharmony_ci	depends on INITRAMFS_SOURCE!=""
3862306a36Sopenharmony_ci	default "0"
3962306a36Sopenharmony_ci	help
4062306a36Sopenharmony_ci	  If INITRAMFS_SOURCE points to a directory, files owned by this UID
4162306a36Sopenharmony_ci	  (-1 = current user) will be owned by root in the resulting image.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci	  If you are not sure, leave it set to "0".
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciconfig INITRAMFS_ROOT_GID
4662306a36Sopenharmony_ci	int "Group ID to map to 0 (group root)"
4762306a36Sopenharmony_ci	depends on INITRAMFS_SOURCE!=""
4862306a36Sopenharmony_ci	default "0"
4962306a36Sopenharmony_ci	help
5062306a36Sopenharmony_ci	  If INITRAMFS_SOURCE points to a directory, files owned by this GID
5162306a36Sopenharmony_ci	  (-1 = current group) will be owned by root in the resulting image.
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci	  If you are not sure, leave it set to "0".
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ciconfig RD_GZIP
5662306a36Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using gzip"
5762306a36Sopenharmony_ci	default y
5862306a36Sopenharmony_ci	select DECOMPRESS_GZIP
5962306a36Sopenharmony_ci	help
6062306a36Sopenharmony_ci	  Support loading of a gzip encoded initial ramdisk or cpio buffer.
6162306a36Sopenharmony_ci	  If unsure, say Y.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ciconfig RD_BZIP2
6462306a36Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using bzip2"
6562306a36Sopenharmony_ci	default y
6662306a36Sopenharmony_ci	select DECOMPRESS_BZIP2
6762306a36Sopenharmony_ci	help
6862306a36Sopenharmony_ci	  Support loading of a bzip2 encoded initial ramdisk or cpio buffer
6962306a36Sopenharmony_ci	  If unsure, say N.
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ciconfig RD_LZMA
7262306a36Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using LZMA"
7362306a36Sopenharmony_ci	default y
7462306a36Sopenharmony_ci	select DECOMPRESS_LZMA
7562306a36Sopenharmony_ci	help
7662306a36Sopenharmony_ci	  Support loading of a LZMA encoded initial ramdisk or cpio buffer
7762306a36Sopenharmony_ci	  If unsure, say N.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ciconfig RD_XZ
8062306a36Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using XZ"
8162306a36Sopenharmony_ci	default y
8262306a36Sopenharmony_ci	select DECOMPRESS_XZ
8362306a36Sopenharmony_ci	help
8462306a36Sopenharmony_ci	  Support loading of a XZ encoded initial ramdisk or cpio buffer.
8562306a36Sopenharmony_ci	  If unsure, say N.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ciconfig RD_LZO
8862306a36Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using LZO"
8962306a36Sopenharmony_ci	default y
9062306a36Sopenharmony_ci	select DECOMPRESS_LZO
9162306a36Sopenharmony_ci	help
9262306a36Sopenharmony_ci	  Support loading of a LZO encoded initial ramdisk or cpio buffer
9362306a36Sopenharmony_ci	  If unsure, say N.
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ciconfig RD_LZ4
9662306a36Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using LZ4"
9762306a36Sopenharmony_ci	default y
9862306a36Sopenharmony_ci	select DECOMPRESS_LZ4
9962306a36Sopenharmony_ci	help
10062306a36Sopenharmony_ci	  Support loading of a LZ4 encoded initial ramdisk or cpio buffer
10162306a36Sopenharmony_ci	  If unsure, say N.
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ciconfig RD_ZSTD
10462306a36Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using ZSTD"
10562306a36Sopenharmony_ci	default y
10662306a36Sopenharmony_ci	select DECOMPRESS_ZSTD
10762306a36Sopenharmony_ci	help
10862306a36Sopenharmony_ci	  Support loading of a ZSTD encoded initial ramdisk or cpio buffer.
10962306a36Sopenharmony_ci	  If unsure, say N.
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_cichoice
11262306a36Sopenharmony_ci	prompt "Built-in initramfs compression mode"
11362306a36Sopenharmony_ci	depends on INITRAMFS_SOURCE != ""
11462306a36Sopenharmony_ci	help
11562306a36Sopenharmony_ci	  This option allows you to decide by which algorithm the builtin
11662306a36Sopenharmony_ci	  initramfs will be compressed.  Several compression algorithms are
11762306a36Sopenharmony_ci	  available, which differ in efficiency, compression and
11862306a36Sopenharmony_ci	  decompression speed.  Compression speed is only relevant
11962306a36Sopenharmony_ci	  when building a kernel.  Decompression speed is relevant at
12062306a36Sopenharmony_ci	  each boot. Also the memory usage during decompression may become
12162306a36Sopenharmony_ci	  relevant on memory constrained systems. This is usually based on the
12262306a36Sopenharmony_ci	  dictionary size of the algorithm with algorithms like XZ and LZMA
12362306a36Sopenharmony_ci	  featuring large dictionary sizes.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci	  High compression options are mostly useful for users who are
12662306a36Sopenharmony_ci	  low on RAM, since it reduces the memory consumption during
12762306a36Sopenharmony_ci	  boot.
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci	  Keep in mind that your build system needs to provide the appropriate
13062306a36Sopenharmony_ci	  compression tool to compress the generated initram cpio file for
13162306a36Sopenharmony_ci	  embedding.
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci	  If in doubt, select 'None'
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_GZIP
13662306a36Sopenharmony_ci	bool "Gzip"
13762306a36Sopenharmony_ci	depends on RD_GZIP
13862306a36Sopenharmony_ci	help
13962306a36Sopenharmony_ci	  Use the old and well tested gzip compression algorithm. Gzip provides
14062306a36Sopenharmony_ci	  a good balance between compression ratio and decompression speed and
14162306a36Sopenharmony_ci	  has a reasonable compression speed. It is also more likely to be
14262306a36Sopenharmony_ci	  supported by your build system as the gzip tool is present by default
14362306a36Sopenharmony_ci	  on most distros.
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_BZIP2
14662306a36Sopenharmony_ci	bool "Bzip2"
14762306a36Sopenharmony_ci	depends on RD_BZIP2
14862306a36Sopenharmony_ci	help
14962306a36Sopenharmony_ci	  It's compression ratio and speed is intermediate. Decompression speed
15062306a36Sopenharmony_ci	  is slowest among the choices. The initramfs size is about 10% smaller
15162306a36Sopenharmony_ci	  with bzip2, in comparison to gzip. Bzip2 uses a large amount of
15262306a36Sopenharmony_ci	  memory. For modern kernels you will need at least 8MB RAM or more for
15362306a36Sopenharmony_ci	  booting.
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_ci	  If you choose this, keep in mind that you need to have the bzip2 tool
15662306a36Sopenharmony_ci	  available to be able to compress the initram.
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_LZMA
15962306a36Sopenharmony_ci	bool "LZMA"
16062306a36Sopenharmony_ci	depends on RD_LZMA
16162306a36Sopenharmony_ci	help
16262306a36Sopenharmony_ci	  This algorithm's compression ratio is best but has a large dictionary
16362306a36Sopenharmony_ci	  size which might cause issues in memory constrained systems.
16462306a36Sopenharmony_ci	  Decompression speed is between the other choices. Compression is
16562306a36Sopenharmony_ci	  slowest. The initramfs size is about 33% smaller with LZMA in
16662306a36Sopenharmony_ci	  comparison to gzip.
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the xz
16962306a36Sopenharmony_ci	  or lzma tools to be able to compress the initram.
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_XZ
17262306a36Sopenharmony_ci	bool "XZ"
17362306a36Sopenharmony_ci	depends on RD_XZ
17462306a36Sopenharmony_ci	help
17562306a36Sopenharmony_ci	  XZ uses the LZMA2 algorithm and has a large dictionary which may cause
17662306a36Sopenharmony_ci	  problems on memory constrained systems. The initramfs size is about
17762306a36Sopenharmony_ci	  30% smaller with XZ in comparison to gzip. Decompression speed is
17862306a36Sopenharmony_ci	  better than that of bzip2 but worse than gzip and LZO. Compression is
17962306a36Sopenharmony_ci	  slow.
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the xz
18262306a36Sopenharmony_ci	  tool to be able to compress the initram.
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_LZO
18562306a36Sopenharmony_ci	bool "LZO"
18662306a36Sopenharmony_ci	depends on RD_LZO
18762306a36Sopenharmony_ci	help
18862306a36Sopenharmony_ci	  It's compression ratio is the second poorest amongst the choices. The
18962306a36Sopenharmony_ci	  kernel size is about 10% bigger than gzip. Despite that, it's
19062306a36Sopenharmony_ci	  decompression speed is the second fastest and it's compression speed
19162306a36Sopenharmony_ci	  is quite fast too.
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the lzop
19462306a36Sopenharmony_ci	  tool to be able to compress the initram.
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_LZ4
19762306a36Sopenharmony_ci	bool "LZ4"
19862306a36Sopenharmony_ci	depends on RD_LZ4
19962306a36Sopenharmony_ci	help
20062306a36Sopenharmony_ci	  It's compression ratio is the poorest amongst the choices. The kernel
20162306a36Sopenharmony_ci	  size is about 15% bigger than gzip; however its decompression speed
20262306a36Sopenharmony_ci	  is the fastest.
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci	  If you choose this, keep in mind that most distros don't provide lz4
20562306a36Sopenharmony_ci	  by default which could cause a build failure.
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_ZSTD
20862306a36Sopenharmony_ci	bool "ZSTD"
20962306a36Sopenharmony_ci	depends on RD_ZSTD
21062306a36Sopenharmony_ci	help
21162306a36Sopenharmony_ci	  ZSTD is a compression algorithm targeting intermediate compression
21262306a36Sopenharmony_ci	  with fast decompression speed. It will compress better than GZIP and
21362306a36Sopenharmony_ci	  decompress around the same speed as LZO, but slower than LZ4.
21462306a36Sopenharmony_ci
21562306a36Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the zstd
21662306a36Sopenharmony_ci	  tool to be able to compress the initram.
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ciconfig INITRAMFS_COMPRESSION_NONE
21962306a36Sopenharmony_ci	bool "None"
22062306a36Sopenharmony_ci	help
22162306a36Sopenharmony_ci	  Do not compress the built-in initramfs at all. This may sound wasteful
22262306a36Sopenharmony_ci	  in space, but, you should be aware that the built-in initramfs will be
22362306a36Sopenharmony_ci	  compressed at a later stage anyways along with the rest of the kernel,
22462306a36Sopenharmony_ci	  on those architectures that support this. However, not compressing the
22562306a36Sopenharmony_ci	  initramfs may lead to slightly higher memory consumption during a
22662306a36Sopenharmony_ci	  short time at boot, while both the cpio image and the unpacked
22762306a36Sopenharmony_ci	  filesystem image will be present in memory simultaneously
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ciendchoice
230