NVMe: Allow user initiated rescan
[linux-2.6-block.git] / usr / Makefile
CommitLineData
d39a206b
SR
1#
2# kbuild file for usr/ - including initramfs image
3#
1da177e4 4
d39a206b 5klibcdirs:;
48f1f058
SR
6PHONY += klibcdirs
7
a26ee60f 8
a26ee60f 9# Bzip2
9ba4bcb6 10suffix_$(CONFIG_RD_BZIP2) = .bz2
a26ee60f 11
ab76f3d7 12# Lzma
9ba4bcb6 13suffix_$(CONFIG_RD_LZMA) = .lzma
1da177e4 14
3ebe1243 15# XZ
9ba4bcb6 16suffix_$(CONFIG_RD_XZ) = .xz
3ebe1243 17
2a2a400f 18# Lzo
9ba4bcb6 19suffix_$(CONFIG_RD_LZO) = .lzo
20
21# Lz4
22suffix_$(CONFIG_RD_LZ4) = .lz4
23
24# Gzip
25suffix_$(CONFIG_RD_GZIP) = .gz
2a2a400f 26
6ae64e42
HB
27AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
28
d39a206b 29# Generate builtin.o based on initramfs_data.o
6ae64e42 30obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
1da177e4 31
a26ee60f 32# initramfs_data.o contains the compressed initramfs_data.cpio image.
1da177e4
LT
33# The image is included using .incbin, a dependency which is not
34# tracked automatically.
6ae64e42 35$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE
1da177e4 36
d39a206b
SR
37#####
38# Generate the initramfs cpio archive
39
40hostprogs-y := gen_init_cpio
41initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
42ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
a26d79ca 43 $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
d39a206b
SR
44ramfs-args := \
45 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
ff541710 46 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
d39a206b 47
a26ee60f 48# .initramfs_data.cpio.d is used to identify all files included
d39a206b
SR
49# in initramfs and to detect if any files are added/removed.
50# Removed files are identified by directory timestamp being updated
51# The dependency list is generated by gen_initramfs.sh -l
a26ee60f
AK
52ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),)
53 include $(obj)/.initramfs_data.cpio.d
1da177e4
LT
54endif
55
d39a206b
SR
56quiet_cmd_initfs = GEN $@
57 cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
58
9ba4bcb6 59targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 \
60 initramfs_data.cpio.lzma initramfs_data.cpio.xz \
61 initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \
62 initramfs_data.cpio
58a2f7d8
SR
63# do not try to update files included in initramfs
64$(deps_initramfs): ;
65
d39a206b 66$(deps_initramfs): klibcdirs
a26ee60f
AK
67# We rebuild initramfs_data.cpio if:
68# 1) Any included file is newer then initramfs_data.cpio
d39a206b 69# 2) There are changes in which files are included (added or deleted)
a26ee60f 70# 3) If gen_init_cpio are newer than initramfs_data.cpio
d39a206b 71# 4) arguments to gen_initramfs.sh changes
a26ee60f
AK
72$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
73 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
d39a206b 74 $(call if_changed,initfs)