Blame view
usr/Makefile
2.24 KB
d39a206bc
|
1 2 3 |
# # kbuild file for usr/ - including initramfs image # |
1da177e4c
|
4 |
|
d39a206bc
|
5 |
klibcdirs:; |
48f1f0589
|
6 |
PHONY += klibcdirs |
a26ee60f9
|
7 |
|
0bc9f9e63
|
8 |
# Gzip |
ab76f3d77
|
9 |
suffix_$(CONFIG_INITRAMFS_COMPRESSION_GZIP) = .gz |
a26ee60f9
|
10 11 |
# Bzip2 |
ab76f3d77
|
12 |
suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) = .bz2 |
a26ee60f9
|
13 |
|
ab76f3d77
|
14 15 |
# Lzma suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma |
1da177e4c
|
16 |
|
2a2a400f6
|
17 18 |
# Lzo suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo |
6ae64e428
|
19 |
AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)" |
d39a206bc
|
20 |
# Generate builtin.o based on initramfs_data.o |
6ae64e428
|
21 |
obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o |
1da177e4c
|
22 |
|
a26ee60f9
|
23 |
# initramfs_data.o contains the compressed initramfs_data.cpio image. |
1da177e4c
|
24 25 |
# The image is included using .incbin, a dependency which is not # tracked automatically. |
6ae64e428
|
26 |
$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE |
1da177e4c
|
27 |
|
d39a206bc
|
28 29 30 31 32 33 |
##### # Generate the initramfs cpio archive hostprogs-y := gen_init_cpio initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ |
a26d79ca8
|
34 |
$(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) |
d39a206bc
|
35 36 |
ramfs-args := \ $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ |
ff5417107
|
37 |
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) |
d39a206bc
|
38 |
|
a26ee60f9
|
39 |
# .initramfs_data.cpio.d is used to identify all files included |
d39a206bc
|
40 41 42 |
# in initramfs and to detect if any files are added/removed. # Removed files are identified by directory timestamp being updated # The dependency list is generated by gen_initramfs.sh -l |
a26ee60f9
|
43 44 |
ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),) include $(obj)/.initramfs_data.cpio.d |
1da177e4c
|
45 |
endif |
d39a206bc
|
46 47 |
quiet_cmd_initfs = GEN $@ cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) |
2a2a400f6
|
48 |
targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio.lzo initramfs_data.cpio |
58a2f7d85
|
49 50 |
# do not try to update files included in initramfs $(deps_initramfs): ; |
d39a206bc
|
51 |
$(deps_initramfs): klibcdirs |
a26ee60f9
|
52 53 |
# We rebuild initramfs_data.cpio if: # 1) Any included file is newer then initramfs_data.cpio |
d39a206bc
|
54 |
# 2) There are changes in which files are included (added or deleted) |
a26ee60f9
|
55 |
# 3) If gen_init_cpio are newer than initramfs_data.cpio |
d39a206bc
|
56 |
# 4) arguments to gen_initramfs.sh changes |
a26ee60f9
|
57 58 |
$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d |
d39a206bc
|
59 |
$(call if_changed,initfs) |
1da177e4c
|
60 |