18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#
38c2ecf20Sopenharmony_ci# Configuration for initramfs
48c2ecf20Sopenharmony_ci#
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ciconfig INITRAMFS_SOURCE
78c2ecf20Sopenharmony_ci	string "Initramfs source file(s)"
88c2ecf20Sopenharmony_ci	default ""
98c2ecf20Sopenharmony_ci	help
108c2ecf20Sopenharmony_ci	  This can be either a single cpio archive with a .cpio suffix or a
118c2ecf20Sopenharmony_ci	  space-separated list of directories and files for building the
128c2ecf20Sopenharmony_ci	  initramfs image.  A cpio archive should contain a filesystem archive
138c2ecf20Sopenharmony_ci	  to be used as an initramfs image.  Directories should contain a
148c2ecf20Sopenharmony_ci	  filesystem layout to be included in the initramfs image.  Files
158c2ecf20Sopenharmony_ci	  should contain entries according to the format described by the
168c2ecf20Sopenharmony_ci	  "usr/gen_init_cpio" program in the kernel tree.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	  When multiple directories and files are specified then the
198c2ecf20Sopenharmony_ci	  initramfs image will be the aggregate of all of them.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	  See <file:Documentation/driver-api/early-userspace/early_userspace_support.rst> for more details.
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci	  If you are not sure, leave it blank.
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciconfig INITRAMFS_FORCE
268c2ecf20Sopenharmony_ci	bool "Ignore the initramfs passed by the bootloader"
278c2ecf20Sopenharmony_ci	depends on CMDLINE_EXTEND || CMDLINE_FORCE
288c2ecf20Sopenharmony_ci	help
298c2ecf20Sopenharmony_ci	  This option causes the kernel to ignore the initramfs image
308c2ecf20Sopenharmony_ci	  (or initrd image) passed to it by the bootloader. This is
318c2ecf20Sopenharmony_ci	  analogous to CMDLINE_FORCE, which is found on some architectures,
328c2ecf20Sopenharmony_ci	  and is useful if you cannot or don't want to change the image
338c2ecf20Sopenharmony_ci	  your bootloader passes to the kernel.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciconfig INITRAMFS_ROOT_UID
368c2ecf20Sopenharmony_ci	int "User ID to map to 0 (user root)"
378c2ecf20Sopenharmony_ci	depends on INITRAMFS_SOURCE!=""
388c2ecf20Sopenharmony_ci	default "0"
398c2ecf20Sopenharmony_ci	help
408c2ecf20Sopenharmony_ci	  If INITRAMFS_SOURCE points to a directory, files owned by this UID
418c2ecf20Sopenharmony_ci	  (-1 = current user) will be owned by root in the resulting image.
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	  If you are not sure, leave it set to "0".
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciconfig INITRAMFS_ROOT_GID
468c2ecf20Sopenharmony_ci	int "Group ID to map to 0 (group root)"
478c2ecf20Sopenharmony_ci	depends on INITRAMFS_SOURCE!=""
488c2ecf20Sopenharmony_ci	default "0"
498c2ecf20Sopenharmony_ci	help
508c2ecf20Sopenharmony_ci	  If INITRAMFS_SOURCE points to a directory, files owned by this GID
518c2ecf20Sopenharmony_ci	  (-1 = current group) will be owned by root in the resulting image.
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	  If you are not sure, leave it set to "0".
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciconfig RD_GZIP
568c2ecf20Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using gzip"
578c2ecf20Sopenharmony_ci	default y
588c2ecf20Sopenharmony_ci	select DECOMPRESS_GZIP
598c2ecf20Sopenharmony_ci	help
608c2ecf20Sopenharmony_ci	  Support loading of a gzip encoded initial ramdisk or cpio buffer.
618c2ecf20Sopenharmony_ci	  If unsure, say Y.
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciconfig RD_BZIP2
648c2ecf20Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using bzip2"
658c2ecf20Sopenharmony_ci	default y
668c2ecf20Sopenharmony_ci	select DECOMPRESS_BZIP2
678c2ecf20Sopenharmony_ci	help
688c2ecf20Sopenharmony_ci	  Support loading of a bzip2 encoded initial ramdisk or cpio buffer
698c2ecf20Sopenharmony_ci	  If unsure, say N.
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ciconfig RD_LZMA
728c2ecf20Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using LZMA"
738c2ecf20Sopenharmony_ci	default y
748c2ecf20Sopenharmony_ci	select DECOMPRESS_LZMA
758c2ecf20Sopenharmony_ci	help
768c2ecf20Sopenharmony_ci	  Support loading of a LZMA encoded initial ramdisk or cpio buffer
778c2ecf20Sopenharmony_ci	  If unsure, say N.
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciconfig RD_XZ
808c2ecf20Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using XZ"
818c2ecf20Sopenharmony_ci	default y
828c2ecf20Sopenharmony_ci	select DECOMPRESS_XZ
838c2ecf20Sopenharmony_ci	help
848c2ecf20Sopenharmony_ci	  Support loading of a XZ encoded initial ramdisk or cpio buffer.
858c2ecf20Sopenharmony_ci	  If unsure, say N.
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciconfig RD_LZO
888c2ecf20Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using LZO"
898c2ecf20Sopenharmony_ci	default y
908c2ecf20Sopenharmony_ci	select DECOMPRESS_LZO
918c2ecf20Sopenharmony_ci	help
928c2ecf20Sopenharmony_ci	  Support loading of a LZO encoded initial ramdisk or cpio buffer
938c2ecf20Sopenharmony_ci	  If unsure, say N.
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ciconfig RD_LZ4
968c2ecf20Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using LZ4"
978c2ecf20Sopenharmony_ci	default y
988c2ecf20Sopenharmony_ci	select DECOMPRESS_LZ4
998c2ecf20Sopenharmony_ci	help
1008c2ecf20Sopenharmony_ci	  Support loading of a LZ4 encoded initial ramdisk or cpio buffer
1018c2ecf20Sopenharmony_ci	  If unsure, say N.
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ciconfig RD_ZSTD
1048c2ecf20Sopenharmony_ci	bool "Support initial ramdisk/ramfs compressed using ZSTD"
1058c2ecf20Sopenharmony_ci	default y
1068c2ecf20Sopenharmony_ci	depends on BLK_DEV_INITRD
1078c2ecf20Sopenharmony_ci	select DECOMPRESS_ZSTD
1088c2ecf20Sopenharmony_ci	help
1098c2ecf20Sopenharmony_ci	  Support loading of a ZSTD encoded initial ramdisk or cpio buffer.
1108c2ecf20Sopenharmony_ci	  If unsure, say N.
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_cichoice
1138c2ecf20Sopenharmony_ci	prompt "Built-in initramfs compression mode"
1148c2ecf20Sopenharmony_ci	depends on INITRAMFS_SOURCE != ""
1158c2ecf20Sopenharmony_ci	help
1168c2ecf20Sopenharmony_ci	  This option allows you to decide by which algorithm the builtin
1178c2ecf20Sopenharmony_ci	  initramfs will be compressed.  Several compression algorithms are
1188c2ecf20Sopenharmony_ci	  available, which differ in efficiency, compression and
1198c2ecf20Sopenharmony_ci	  decompression speed.  Compression speed is only relevant
1208c2ecf20Sopenharmony_ci	  when building a kernel.  Decompression speed is relevant at
1218c2ecf20Sopenharmony_ci	  each boot. Also the memory usage during decompression may become
1228c2ecf20Sopenharmony_ci	  relevant on memory constrained systems. This is usually based on the
1238c2ecf20Sopenharmony_ci	  dictionary size of the algorithm with algorithms like XZ and LZMA
1248c2ecf20Sopenharmony_ci	  featuring large dictionary sizes.
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci	  High compression options are mostly useful for users who are
1278c2ecf20Sopenharmony_ci	  low on RAM, since it reduces the memory consumption during
1288c2ecf20Sopenharmony_ci	  boot.
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci	  Keep in mind that your build system needs to provide the appropriate
1318c2ecf20Sopenharmony_ci	  compression tool to compress the generated initram cpio file for
1328c2ecf20Sopenharmony_ci	  embedding.
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci	  If in doubt, select 'None'
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_GZIP
1378c2ecf20Sopenharmony_ci	bool "Gzip"
1388c2ecf20Sopenharmony_ci	depends on RD_GZIP
1398c2ecf20Sopenharmony_ci	help
1408c2ecf20Sopenharmony_ci	  Use the old and well tested gzip compression algorithm. Gzip provides
1418c2ecf20Sopenharmony_ci	  a good balance between compression ratio and decompression speed and
1428c2ecf20Sopenharmony_ci	  has a reasonable compression speed. It is also more likely to be
1438c2ecf20Sopenharmony_ci	  supported by your build system as the gzip tool is present by default
1448c2ecf20Sopenharmony_ci	  on most distros.
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_BZIP2
1478c2ecf20Sopenharmony_ci	bool "Bzip2"
1488c2ecf20Sopenharmony_ci	depends on RD_BZIP2
1498c2ecf20Sopenharmony_ci	help
1508c2ecf20Sopenharmony_ci	  It's compression ratio and speed is intermediate. Decompression speed
1518c2ecf20Sopenharmony_ci	  is slowest among the choices. The initramfs size is about 10% smaller
1528c2ecf20Sopenharmony_ci	  with bzip2, in comparison to gzip. Bzip2 uses a large amount of
1538c2ecf20Sopenharmony_ci	  memory. For modern kernels you will need at least 8MB RAM or more for
1548c2ecf20Sopenharmony_ci	  booting.
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci	  If you choose this, keep in mind that you need to have the bzip2 tool
1578c2ecf20Sopenharmony_ci	  available to be able to compress the initram.
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_LZMA
1608c2ecf20Sopenharmony_ci	bool "LZMA"
1618c2ecf20Sopenharmony_ci	depends on RD_LZMA
1628c2ecf20Sopenharmony_ci	help
1638c2ecf20Sopenharmony_ci	  This algorithm's compression ratio is best but has a large dictionary
1648c2ecf20Sopenharmony_ci	  size which might cause issues in memory constrained systems.
1658c2ecf20Sopenharmony_ci	  Decompression speed is between the other choices. Compression is
1668c2ecf20Sopenharmony_ci	  slowest. The initramfs size is about 33% smaller with LZMA in
1678c2ecf20Sopenharmony_ci	  comparison to gzip.
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the xz
1708c2ecf20Sopenharmony_ci	  or lzma tools to be able to compress the initram.
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_XZ
1738c2ecf20Sopenharmony_ci	bool "XZ"
1748c2ecf20Sopenharmony_ci	depends on RD_XZ
1758c2ecf20Sopenharmony_ci	help
1768c2ecf20Sopenharmony_ci	  XZ uses the LZMA2 algorithm and has a large dictionary which may cause
1778c2ecf20Sopenharmony_ci	  problems on memory constrained systems. The initramfs size is about
1788c2ecf20Sopenharmony_ci	  30% smaller with XZ in comparison to gzip. Decompression speed is
1798c2ecf20Sopenharmony_ci	  better than that of bzip2 but worse than gzip and LZO. Compression is
1808c2ecf20Sopenharmony_ci	  slow.
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the xz
1838c2ecf20Sopenharmony_ci	  tool to be able to compress the initram.
1848c2ecf20Sopenharmony_ci
1858c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_LZO
1868c2ecf20Sopenharmony_ci	bool "LZO"
1878c2ecf20Sopenharmony_ci	depends on RD_LZO
1888c2ecf20Sopenharmony_ci	help
1898c2ecf20Sopenharmony_ci	  It's compression ratio is the second poorest amongst the choices. The
1908c2ecf20Sopenharmony_ci	  kernel size is about 10% bigger than gzip. Despite that, it's
1918c2ecf20Sopenharmony_ci	  decompression speed is the second fastest and it's compression speed
1928c2ecf20Sopenharmony_ci	  is quite fast too.
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the lzop
1958c2ecf20Sopenharmony_ci	  tool to be able to compress the initram.
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_LZ4
1988c2ecf20Sopenharmony_ci	bool "LZ4"
1998c2ecf20Sopenharmony_ci	depends on RD_LZ4
2008c2ecf20Sopenharmony_ci	help
2018c2ecf20Sopenharmony_ci	  It's compression ratio is the poorest amongst the choices. The kernel
2028c2ecf20Sopenharmony_ci	  size is about 15% bigger than gzip; however its decompression speed
2038c2ecf20Sopenharmony_ci	  is the fastest.
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci	  If you choose this, keep in mind that most distros don't provide lz4
2068c2ecf20Sopenharmony_ci	  by default which could cause a build failure.
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_ZSTD
2098c2ecf20Sopenharmony_ci	bool "ZSTD"
2108c2ecf20Sopenharmony_ci	depends on RD_ZSTD
2118c2ecf20Sopenharmony_ci	help
2128c2ecf20Sopenharmony_ci	  ZSTD is a compression algorithm targeting intermediate compression
2138c2ecf20Sopenharmony_ci	  with fast decompression speed. It will compress better than GZIP and
2148c2ecf20Sopenharmony_ci	  decompress around the same speed as LZO, but slower than LZ4.
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci	  If you choose this, keep in mind that you may need to install the zstd
2178c2ecf20Sopenharmony_ci	  tool to be able to compress the initram.
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ciconfig INITRAMFS_COMPRESSION_NONE
2208c2ecf20Sopenharmony_ci	bool "None"
2218c2ecf20Sopenharmony_ci	help
2228c2ecf20Sopenharmony_ci	  Do not compress the built-in initramfs at all. This may sound wasteful
2238c2ecf20Sopenharmony_ci	  in space, but, you should be aware that the built-in initramfs will be
2248c2ecf20Sopenharmony_ci	  compressed at a later stage anyways along with the rest of the kernel,
2258c2ecf20Sopenharmony_ci	  on those architectures that support this. However, not compressing the
2268c2ecf20Sopenharmony_ci	  initramfs may lead to slightly higher memory consumption during a
2278c2ecf20Sopenharmony_ci	  short time at boot, while both the cpio image and the unpacked
2288c2ecf20Sopenharmony_ci	  filesystem image will be present in memory simultaneously
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ciendchoice
231