0001 # SPDX-License-Identifier: GPL-2.0
0002 #
0003 # Configuration for initramfs
0004 #
0005
0006 config INITRAMFS_SOURCE
0007 string "Initramfs source file(s)"
0008 default ""
0009 help
0010 This can be either a single cpio archive with a .cpio suffix or a
0011 space-separated list of directories and files for building the
0012 initramfs image. A cpio archive should contain a filesystem archive
0013 to be used as an initramfs image. Directories should contain a
0014 filesystem layout to be included in the initramfs image. Files
0015 should contain entries according to the format described by the
0016 "usr/gen_init_cpio" program in the kernel tree.
0017
0018 When multiple directories and files are specified then the
0019 initramfs image will be the aggregate of all of them.
0020
0021 See <file:Documentation/driver-api/early-userspace/early_userspace_support.rst> for more details.
0022
0023 If you are not sure, leave it blank.
0024
0025 config INITRAMFS_FORCE
0026 bool "Ignore the initramfs passed by the bootloader"
0027 depends on CMDLINE_EXTEND || CMDLINE_FORCE
0028 help
0029 This option causes the kernel to ignore the initramfs image
0030 (or initrd image) passed to it by the bootloader. This is
0031 analogous to CMDLINE_FORCE, which is found on some architectures,
0032 and is useful if you cannot or don't want to change the image
0033 your bootloader passes to the kernel.
0034
0035 config INITRAMFS_ROOT_UID
0036 int "User ID to map to 0 (user root)"
0037 depends on INITRAMFS_SOURCE!=""
0038 default "0"
0039 help
0040 If INITRAMFS_SOURCE points to a directory, files owned by this UID
0041 (-1 = current user) will be owned by root in the resulting image.
0042
0043 If you are not sure, leave it set to "0".
0044
0045 config INITRAMFS_ROOT_GID
0046 int "Group ID to map to 0 (group root)"
0047 depends on INITRAMFS_SOURCE!=""
0048 default "0"
0049 help
0050 If INITRAMFS_SOURCE points to a directory, files owned by this GID
0051 (-1 = current group) will be owned by root in the resulting image.
0052
0053 If you are not sure, leave it set to "0".
0054
0055 config RD_GZIP
0056 bool "Support initial ramdisk/ramfs compressed using gzip"
0057 default y
0058 select DECOMPRESS_GZIP
0059 help
0060 Support loading of a gzip encoded initial ramdisk or cpio buffer.
0061 If unsure, say Y.
0062
0063 config RD_BZIP2
0064 bool "Support initial ramdisk/ramfs compressed using bzip2"
0065 default y
0066 select DECOMPRESS_BZIP2
0067 help
0068 Support loading of a bzip2 encoded initial ramdisk or cpio buffer
0069 If unsure, say N.
0070
0071 config RD_LZMA
0072 bool "Support initial ramdisk/ramfs compressed using LZMA"
0073 default y
0074 select DECOMPRESS_LZMA
0075 help
0076 Support loading of a LZMA encoded initial ramdisk or cpio buffer
0077 If unsure, say N.
0078
0079 config RD_XZ
0080 bool "Support initial ramdisk/ramfs compressed using XZ"
0081 default y
0082 select DECOMPRESS_XZ
0083 help
0084 Support loading of a XZ encoded initial ramdisk or cpio buffer.
0085 If unsure, say N.
0086
0087 config RD_LZO
0088 bool "Support initial ramdisk/ramfs compressed using LZO"
0089 default y
0090 select DECOMPRESS_LZO
0091 help
0092 Support loading of a LZO encoded initial ramdisk or cpio buffer
0093 If unsure, say N.
0094
0095 config RD_LZ4
0096 bool "Support initial ramdisk/ramfs compressed using LZ4"
0097 default y
0098 select DECOMPRESS_LZ4
0099 help
0100 Support loading of a LZ4 encoded initial ramdisk or cpio buffer
0101 If unsure, say N.
0102
0103 config RD_ZSTD
0104 bool "Support initial ramdisk/ramfs compressed using ZSTD"
0105 default y
0106 select DECOMPRESS_ZSTD
0107 help
0108 Support loading of a ZSTD encoded initial ramdisk or cpio buffer.
0109 If unsure, say N.
0110
0111 choice
0112 prompt "Built-in initramfs compression mode"
0113 depends on INITRAMFS_SOURCE != ""
0114 help
0115 This option allows you to decide by which algorithm the builtin
0116 initramfs will be compressed. Several compression algorithms are
0117 available, which differ in efficiency, compression and
0118 decompression speed. Compression speed is only relevant
0119 when building a kernel. Decompression speed is relevant at
0120 each boot. Also the memory usage during decompression may become
0121 relevant on memory constrained systems. This is usually based on the
0122 dictionary size of the algorithm with algorithms like XZ and LZMA
0123 featuring large dictionary sizes.
0124
0125 High compression options are mostly useful for users who are
0126 low on RAM, since it reduces the memory consumption during
0127 boot.
0128
0129 Keep in mind that your build system needs to provide the appropriate
0130 compression tool to compress the generated initram cpio file for
0131 embedding.
0132
0133 If in doubt, select 'None'
0134
0135 config INITRAMFS_COMPRESSION_GZIP
0136 bool "Gzip"
0137 depends on RD_GZIP
0138 help
0139 Use the old and well tested gzip compression algorithm. Gzip provides
0140 a good balance between compression ratio and decompression speed and
0141 has a reasonable compression speed. It is also more likely to be
0142 supported by your build system as the gzip tool is present by default
0143 on most distros.
0144
0145 config INITRAMFS_COMPRESSION_BZIP2
0146 bool "Bzip2"
0147 depends on RD_BZIP2
0148 help
0149 It's compression ratio and speed is intermediate. Decompression speed
0150 is slowest among the choices. The initramfs size is about 10% smaller
0151 with bzip2, in comparison to gzip. Bzip2 uses a large amount of
0152 memory. For modern kernels you will need at least 8MB RAM or more for
0153 booting.
0154
0155 If you choose this, keep in mind that you need to have the bzip2 tool
0156 available to be able to compress the initram.
0157
0158 config INITRAMFS_COMPRESSION_LZMA
0159 bool "LZMA"
0160 depends on RD_LZMA
0161 help
0162 This algorithm's compression ratio is best but has a large dictionary
0163 size which might cause issues in memory constrained systems.
0164 Decompression speed is between the other choices. Compression is
0165 slowest. The initramfs size is about 33% smaller with LZMA in
0166 comparison to gzip.
0167
0168 If you choose this, keep in mind that you may need to install the xz
0169 or lzma tools to be able to compress the initram.
0170
0171 config INITRAMFS_COMPRESSION_XZ
0172 bool "XZ"
0173 depends on RD_XZ
0174 help
0175 XZ uses the LZMA2 algorithm and has a large dictionary which may cause
0176 problems on memory constrained systems. The initramfs size is about
0177 30% smaller with XZ in comparison to gzip. Decompression speed is
0178 better than that of bzip2 but worse than gzip and LZO. Compression is
0179 slow.
0180
0181 If you choose this, keep in mind that you may need to install the xz
0182 tool to be able to compress the initram.
0183
0184 config INITRAMFS_COMPRESSION_LZO
0185 bool "LZO"
0186 depends on RD_LZO
0187 help
0188 It's compression ratio is the second poorest amongst the choices. The
0189 kernel size is about 10% bigger than gzip. Despite that, it's
0190 decompression speed is the second fastest and it's compression speed
0191 is quite fast too.
0192
0193 If you choose this, keep in mind that you may need to install the lzop
0194 tool to be able to compress the initram.
0195
0196 config INITRAMFS_COMPRESSION_LZ4
0197 bool "LZ4"
0198 depends on RD_LZ4
0199 help
0200 It's compression ratio is the poorest amongst the choices. The kernel
0201 size is about 15% bigger than gzip; however its decompression speed
0202 is the fastest.
0203
0204 If you choose this, keep in mind that most distros don't provide lz4
0205 by default which could cause a build failure.
0206
0207 config INITRAMFS_COMPRESSION_ZSTD
0208 bool "ZSTD"
0209 depends on RD_ZSTD
0210 help
0211 ZSTD is a compression algorithm targeting intermediate compression
0212 with fast decompression speed. It will compress better than GZIP and
0213 decompress around the same speed as LZO, but slower than LZ4.
0214
0215 If you choose this, keep in mind that you may need to install the zstd
0216 tool to be able to compress the initram.
0217
0218 config INITRAMFS_COMPRESSION_NONE
0219 bool "None"
0220 help
0221 Do not compress the built-in initramfs at all. This may sound wasteful
0222 in space, but, you should be aware that the built-in initramfs will be
0223 compressed at a later stage anyways along with the rest of the kernel,
0224 on those architectures that support this. However, not compressing the
0225 initramfs may lead to slightly higher memory consumption during a
0226 short time at boot, while both the cpio image and the unpacked
0227 filesystem image will be present in memory simultaneously
0228
0229 endchoice