* [PATCH] initramfs: Fix initramfs rebuilds w/ compression after disabling
@ 2017-09-30 3:39 Florian Fainelli
2017-09-30 3:42 ` Florian Fainelli
0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2017-09-30 3:39 UTC (permalink / raw)
To: linux-kernel
Cc: Florian Fainelli, Francisco Blas Izquierdo Riera (klondike),
Nicholas Piggin, Andrew Morton
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.
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>
---
usr/Makefile | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/usr/Makefile b/usr/Makefile
index 0b87e71c00fc..2d7d7f4b91f1 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -7,6 +7,7 @@ PHONY += klibcdirs
suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
datafile_y = initramfs_data.cpio$(suffix_y)
+datafile_d_y = .$(datafile_y).d
AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
@@ -29,12 +30,12 @@ ramfs-args := \
$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
-# .initramfs_data.cpio.d is used to identify all files included
+# $(datafile_d_y) is used to identify all files included
# 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
-ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),)
- include $(obj)/.initramfs_data.cpio.d
+ifneq ($(wildcard $(obj)/$(datafile_d_y)),)
+ include $(obj)/$(datafile_d_y)
endif
quiet_cmd_initfs = GEN $@
@@ -52,5 +53,5 @@ $(deps_initramfs): klibcdirs
# 3) If gen_init_cpio are newer than initramfs_data.cpio
# 4) arguments to gen_initramfs.sh changes
$(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)/$(datafile_d_y)
$(call if_changed,initfs)
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] initramfs: Fix initramfs rebuilds w/ compression after disabling
2017-09-30 3:39 [PATCH] initramfs: Fix initramfs rebuilds w/ compression after disabling Florian Fainelli
@ 2017-09-30 3:42 ` Florian Fainelli
0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2017-09-30 3:42 UTC (permalink / raw)
To: linux-kernel
Cc: Francisco Blas Izquierdo Riera (klondike),
Nicholas Piggin, Andrew Morton
On 09/29/2017 08:39 PM, Florian Fainelli wrote:
> 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.
>
> 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>
> ---
Nick, thanks a lot for your patience and help on the other thread! At
some point I did mention that I was wondering if this would cause
systematic rebuilds of the compressed initramfs, but after more testing,
it does not, things now work as expected again (until next time ;) ).
> usr/Makefile | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/usr/Makefile b/usr/Makefile
> index 0b87e71c00fc..2d7d7f4b91f1 100644
> --- a/usr/Makefile
> +++ b/usr/Makefile
> @@ -7,6 +7,7 @@ PHONY += klibcdirs
>
> suffix_y = $(subst $\",,$(CONFIG_INITRAMFS_COMPRESSION))
> datafile_y = initramfs_data.cpio$(suffix_y)
> +datafile_d_y = .$(datafile_y).d
> AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/$(datafile_y)"
>
>
> @@ -29,12 +30,12 @@ ramfs-args := \
> $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
> $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
>
> -# .initramfs_data.cpio.d is used to identify all files included
> +# $(datafile_d_y) is used to identify all files included
> # 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
> -ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),)
> - include $(obj)/.initramfs_data.cpio.d
> +ifneq ($(wildcard $(obj)/$(datafile_d_y)),)
> + include $(obj)/$(datafile_d_y)
> endif
>
> quiet_cmd_initfs = GEN $@
> @@ -52,5 +53,5 @@ $(deps_initramfs): klibcdirs
> # 3) If gen_init_cpio are newer than initramfs_data.cpio
> # 4) arguments to gen_initramfs.sh changes
> $(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)/$(datafile_d_y)
> $(call if_changed,initfs)
>
--
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-30 3:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-30 3:39 [PATCH] initramfs: Fix initramfs rebuilds w/ compression after disabling Florian Fainelli
2017-09-30 3:42 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®