summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2017-11-02 18:59:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-03 10:39:19 -0400
commite08b1877452a0055c65f6394163ce5a0fbd720a3 (patch)
tree2ab068c535f00a7a6f53f7adfab5e1d08c944805
parentab615a5b879292e83653be60aa82113f7c6f462d (diff)
initramfs: fix initramfs rebuilds w/ compression after disabling
This is a follow-up to commit 57ddfdaa9a72 ("initramfs: fix disabling of initramfs (and its compression)"). This particular commit fixed the use case where we build the kernel with an initramfs with no compression, and then we build the kernel with no initramfs. Now this still left us with the same case as described here: http://lkml.kernel.org/r/20170521033337.6197-1-f.fainelli@gmail.com not working with initramfs compression. This can be seen by the following steps/timestamps: https://www.spinics.net/lists/kernel/msg2598153.html .initramfs_data.cpio.gz.cmd is correct: cmd_usr/initramfs_data.cpio.gz := /bin/bash ./scripts/gen_initramfs_list.sh -o usr/initramfs_data.cpio.gz -u 1000 -g 1000 /home/fainelli/work/uclinux-rootfs/romfs /home/fainelli/work/uclinux-rootfs/misc/initramfs.dev and was generated the first time we did generate the gzip initramfs, so the command has not changed, nor its arguments, so we just don't call it, no initramfs cpio is re-generated as a consequence. The fix for this problem is just to properly keep track of the .initramfs_cpio_data.d file by suffixing it with the compression extension. This takes care of properly tracking dependencies such that the initramfs get (re)generated any time files are added/deleted etc. Link: http://lkml.kernel.org/r/20170930033936.6722-1-f.fainelli@gmail.com Fixes: db2aa7fd15e8 ("initramfs: allow again choice of the embedded initramfs compression algorithm") Fixes: 9e3596b0c653 ("kbuild: initramfs cleanup, set target from Kconfig") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Cc: "Francisco Blas Izquierdo Riera (klondike)" <klondike@xiscosoft.net> Cc: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--usr/Makefile9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr/Makefile b/usr/Makefile
index 34a9fcd0f537..237a028693ce 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -8,6 +8,7 @@ PHONY += klibcdirs
8 8
9suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION)) 9suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
10datafile_y = initramfs_data.cpio$(suffix_y) 10datafile_y = initramfs_data.cpio$(suffix_y)
11datafile_d_y = .$(datafile_y).d
11AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)" 12AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
12 13
13 14
@@ -30,12 +31,12 @@ ramfs-args := \
30 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ 31 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
31 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) 32 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
32 33
33# .initramfs_data.cpio.d is used to identify all files included 34# $(datafile_d_y) is used to identify all files included
34# in initramfs and to detect if any files are added/removed. 35# in initramfs and to detect if any files are added/removed.
35# Removed files are identified by directory timestamp being updated 36# Removed files are identified by directory timestamp being updated
36# The dependency list is generated by gen_initramfs.sh -l 37# The dependency list is generated by gen_initramfs.sh -l
37ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),) 38ifneq ($(wildcard $(obj)/$(datafile_d_y)),)
38 include $(obj)/.initramfs_data.cpio.d 39 include $(obj)/$(datafile_d_y)
39endif 40endif
40 41
41quiet_cmd_initfs = GEN $@ 42quiet_cmd_initfs = GEN $@
@@ -53,5 +54,5 @@ $(deps_initramfs): klibcdirs
53# 3) If gen_init_cpio are newer than initramfs_data.cpio 54# 3) If gen_init_cpio are newer than initramfs_data.cpio
54# 4) arguments to gen_initramfs.sh changes 55# 4) arguments to gen_initramfs.sh changes
55$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs 56$(obj)/$(datafile_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
56 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d 57 $(Q)$(initramfs) -l $(ramfs-input) > $(obj)/$(datafile_d_y)
57 $(call if_changed,initfs) 58 $(call if_changed,initfs)