0001
0002
0003
0004
0005
0006 compress-y := copy
0007 compress-$(CONFIG_INITRAMFS_COMPRESSION_GZIP) := gzip
0008 compress-$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) := bzip2
0009 compress-$(CONFIG_INITRAMFS_COMPRESSION_LZMA) := lzma
0010 compress-$(CONFIG_INITRAMFS_COMPRESSION_XZ) := xzmisc
0011 compress-$(CONFIG_INITRAMFS_COMPRESSION_LZO) := lzo
0012 compress-$(CONFIG_INITRAMFS_COMPRESSION_LZ4) := lz4
0013 compress-$(CONFIG_INITRAMFS_COMPRESSION_ZSTD) := zstd
0014
0015 obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
0016
0017 $(obj)/initramfs_data.o: $(obj)/initramfs_inc_data
0018
0019 ramfs-input := $(CONFIG_INITRAMFS_SOURCE)
0020 cpio-data :=
0021
0022
0023
0024 ifeq ($(ramfs-input),)
0025 ramfs-input := $(srctree)/$(src)/default_cpio_list
0026 endif
0027
0028 ifeq ($(words $(ramfs-input)),1)
0029
0030
0031
0032 ifneq ($(filter %.cpio,$(ramfs-input)),)
0033 cpio-data := $(ramfs-input)
0034 endif
0035
0036
0037
0038 ifeq ($(words $(subst .cpio.,$(space),$(ramfs-input))),2)
0039 cpio-data := $(ramfs-input)
0040 compress-y := copy
0041 endif
0042
0043 endif
0044
0045
0046
0047 ifeq ($(cpio-data),)
0048
0049 cpio-data := $(obj)/initramfs_data.cpio
0050
0051 hostprogs := gen_init_cpio
0052
0053
0054
0055
0056
0057 -include $(obj)/.initramfs_data.cpio.d
0058
0059
0060 $(deps_initramfs): ;
0061
0062 quiet_cmd_initfs = GEN $@
0063 cmd_initfs = \
0064 $(CONFIG_SHELL) $< -o $@ -l $(obj)/.initramfs_data.cpio.d \
0065 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
0066 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \
0067 $(ramfs-input)
0068
0069
0070
0071
0072
0073
0074 $(obj)/initramfs_data.cpio: $(src)/gen_initramfs.sh $(obj)/gen_init_cpio $(deps_initramfs) FORCE
0075 $(call if_changed,initfs)
0076
0077 endif
0078
0079 $(obj)/initramfs_inc_data: $(cpio-data) FORCE
0080 $(call if_changed,$(compress-y))
0081
0082 targets += initramfs_data.cpio initramfs_inc_data
0083
0084 subdir-$(CONFIG_UAPI_HEADER_TEST) += include