kbuild: initramfs cleanup, set target from Kconfig
Rather than keep a list of all possible compression types in the Makefile, set the target explicitly from Kconfig. Reviewed-by: Francisco Blas Izquierdo Riera (klondike) <klondike@klondike.es> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ae30ab4cd7
commit
9e3596b0c6
14
usr/Makefile
14
usr/Makefile
@ -6,7 +6,9 @@ klibcdirs:;
|
|||||||
PHONY += klibcdirs
|
PHONY += klibcdirs
|
||||||
|
|
||||||
suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
|
suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
|
||||||
AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
|
datafile_y = initramfs_data.cpio$(suffix_y)
|
||||||
|
AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
|
||||||
|
|
||||||
|
|
||||||
# Generate builtin.o based on initramfs_data.o
|
# Generate builtin.o based on initramfs_data.o
|
||||||
obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
|
obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
|
||||||
@ -14,7 +16,7 @@ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
|
|||||||
# initramfs_data.o contains the compressed initramfs_data.cpio image.
|
# initramfs_data.o contains the compressed initramfs_data.cpio image.
|
||||||
# The image is included using .incbin, a dependency which is not
|
# The image is included using .incbin, a dependency which is not
|
||||||
# tracked automatically.
|
# tracked automatically.
|
||||||
$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE
|
$(obj)/initramfs_data.o: $(obj)/$(datafile_y) FORCE
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# Generate the initramfs cpio archive
|
# Generate the initramfs cpio archive
|
||||||
@ -38,10 +40,8 @@ endif
|
|||||||
quiet_cmd_initfs = GEN $@
|
quiet_cmd_initfs = GEN $@
|
||||||
cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
|
cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
|
||||||
|
|
||||||
targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 \
|
targets := $(datafile_y)
|
||||||
initramfs_data.cpio.lzma initramfs_data.cpio.xz \
|
|
||||||
initramfs_data.cpio.lzo initramfs_data.cpio.lz4 \
|
|
||||||
initramfs_data.cpio
|
|
||||||
# do not try to update files included in initramfs
|
# do not try to update files included in initramfs
|
||||||
$(deps_initramfs): ;
|
$(deps_initramfs): ;
|
||||||
|
|
||||||
@ -51,6 +51,6 @@ $(deps_initramfs): klibcdirs
|
|||||||
# 2) There are changes in which files are included (added or deleted)
|
# 2) There are changes in which files are included (added or deleted)
|
||||||
# 3) If gen_init_cpio are newer than initramfs_data.cpio
|
# 3) If gen_init_cpio are newer than initramfs_data.cpio
|
||||||
# 4) arguments to gen_initramfs.sh changes
|
# 4) arguments to gen_initramfs.sh changes
|
||||||
$(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
|
$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
|
||||||
$(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
|
$(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
|
||||||
$(call if_changed,initfs)
|
$(call if_changed,initfs)
|
||||||
|
Loading…
Reference in New Issue
Block a user