[03/14] linux: meddle not in the internals of filesystems

Message ID f458e45958374aa7194fcffc42b17d2432ca9b29.1510508733.git.yann.morin.1998@free.fr
State New
Headers show
  • [01/14] core: sort packages and eliminate duplicates in show-targets
Related show

Commit Message

Yann E. MORIN Nov. 12, 2017, 5:45 p.m.
Currently, the rule to rebuild the Linux kernel with an initramfs
directly depends on the path of the file of the intermediate cpio image.

This is inherently "bad" from a purity point of view; linux.mk should
not have to delve into the fs internals.

Rather, make it directly depend on the "frontal" rule that generates the
cpio image.

Drop the comment for linux-rebuild-with-initramfs, it was misleading
(talking about generating "the initramfs list of files", which is not
what was done, since we use a cpio as source of initramfs, not a list of

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Romain Naour <romain.naour@openwide.fr>

Changes v2 -> v3:
  - use $(LINUX_DIR) instead of $(@D) since there's no longer any
    directory component in the target rule  (Romain)

Changes v1 -> v2:
  - drop intermediate, unneeded stamp-file
  - drop misleading comment

This, too, will be useful for the initramfs patch coming next.
 linux/linux.mk | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)


diff --git a/linux/linux.mk b/linux/linux.mk
index 1c5631f937..5300b9cfc5 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -484,21 +484,17 @@  endif # BR_BUILDING
 $(eval $(kconfig-package))
 # Support for rebuilding the kernel after the cpio archive has
-# been generated in $(BINARIES_DIR)/rootfs.cpio.
-$(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_target_installed
-$(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_images_installed
-$(LINUX_DIR)/.stamp_initramfs_rebuilt: $(BINARIES_DIR)/rootfs.cpio
+# been generated.
+.PHONY: linux-rebuild-with-initramfs
+linux-rebuild-with-initramfs: $(LINUX_DIR)/.stamp_target_installed
+linux-rebuild-with-initramfs: $(LINUX_DIR)/.stamp_images_installed
+linux-rebuild-with-initramfs: rootfs-cpio
 	@$(call MESSAGE,"Rebuilding kernel with initramfs")
 	# Build the kernel.
 	# Copy the kernel image(s) to its(their) final destination
 	# If there is a .ub file copy it to the final destination
 	test ! -f $(LINUX_IMAGE_PATH).ub || cp $(LINUX_IMAGE_PATH).ub $(BINARIES_DIR)
-	$(Q)touch $@
-# The initramfs building code must make sure this target gets called
-# after it generated the initramfs list of files.
-linux-rebuild-with-initramfs: $(LINUX_DIR)/.stamp_initramfs_rebuilt