diff options
Diffstat (limited to 'usr/Makefile')
| -rw-r--r-- | usr/Makefile | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/usr/Makefile b/usr/Makefile index 201f27f8cbaf..b84894b3929d 100644 --- a/usr/Makefile +++ b/usr/Makefile | |||
| @@ -6,13 +6,25 @@ klibcdirs:; | |||
| 6 | PHONY += klibcdirs | 6 | PHONY += klibcdirs |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | # No compression | ||
| 10 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_NONE) = | ||
| 11 | |||
| 12 | # Gzip, but no bzip2 | ||
| 13 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_GZIP) = .gz | ||
| 14 | |||
| 15 | # Bzip2 | ||
| 16 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2) = .bz2 | ||
| 17 | |||
| 18 | # Lzma | ||
| 19 | suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma | ||
| 20 | |||
| 9 | # Generate builtin.o based on initramfs_data.o | 21 | # Generate builtin.o based on initramfs_data.o |
| 10 | obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o | 22 | obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data$(suffix_y).o |
| 11 | 23 | ||
| 12 | # initramfs_data.o contains the initramfs_data.cpio.gz image. | 24 | # initramfs_data.o contains the compressed initramfs_data.cpio image. |
| 13 | # The image is included using .incbin, a dependency which is not | 25 | # The image is included using .incbin, a dependency which is not |
| 14 | # tracked automatically. | 26 | # tracked automatically. |
| 15 | $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE | 27 | $(obj)/initramfs_data$(suffix_y).o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE |
| 16 | 28 | ||
| 17 | ##### | 29 | ##### |
| 18 | # Generate the initramfs cpio archive | 30 | # Generate the initramfs cpio archive |
| @@ -25,28 +37,28 @@ ramfs-args := \ | |||
| 25 | $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ | 37 | $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ |
| 26 | $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) | 38 | $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) |
| 27 | 39 | ||
| 28 | # .initramfs_data.cpio.gz.d is used to identify all files included | 40 | # .initramfs_data.cpio.d is used to identify all files included |
| 29 | # in initramfs and to detect if any files are added/removed. | 41 | # in initramfs and to detect if any files are added/removed. |
| 30 | # Removed files are identified by directory timestamp being updated | 42 | # Removed files are identified by directory timestamp being updated |
| 31 | # The dependency list is generated by gen_initramfs.sh -l | 43 | # The dependency list is generated by gen_initramfs.sh -l |
| 32 | ifneq ($(wildcard $(obj)/.initramfs_data.cpio.gz.d),) | 44 | ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),) |
| 33 | include $(obj)/.initramfs_data.cpio.gz.d | 45 | include $(obj)/.initramfs_data.cpio.d |
| 34 | endif | 46 | endif |
| 35 | 47 | ||
| 36 | quiet_cmd_initfs = GEN $@ | 48 | quiet_cmd_initfs = GEN $@ |
| 37 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) | 49 | cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input) |
| 38 | 50 | ||
| 39 | targets := initramfs_data.cpio.gz | 51 | targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio |
| 40 | # do not try to update files included in initramfs | 52 | # do not try to update files included in initramfs |
| 41 | $(deps_initramfs): ; | 53 | $(deps_initramfs): ; |
| 42 | 54 | ||
| 43 | $(deps_initramfs): klibcdirs | 55 | $(deps_initramfs): klibcdirs |
| 44 | # We rebuild initramfs_data.cpio.gz if: | 56 | # We rebuild initramfs_data.cpio if: |
| 45 | # 1) Any included file is newer then initramfs_data.cpio.gz | 57 | # 1) Any included file is newer then initramfs_data.cpio |
| 46 | # 2) There are changes in which files are included (added or deleted) | 58 | # 2) There are changes in which files are included (added or deleted) |
| 47 | # 3) If gen_init_cpio are newer than initramfs_data.cpio.gz | 59 | # 3) If gen_init_cpio are newer than initramfs_data.cpio |
| 48 | # 4) arguments to gen_initramfs.sh changes | 60 | # 4) arguments to gen_initramfs.sh changes |
| 49 | $(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs | 61 | $(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs |
| 50 | $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.gz.d | 62 | $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d |
| 51 | $(call if_changed,initfs) | 63 | $(call if_changed,initfs) |
| 52 | 64 | ||
