From 13a3afc536b845e8de8eea9b91bbc6e7430c4566 Mon Sep 17 00:00:00 2001 From: "Arnout Vandecappelle (Essensium/Mind)" Date: Tue, 6 Sep 2011 23:16:09 +0200 Subject: fs/initramfs: refactor with fs/cpio An initramfs is in fact the same as a cpio archive, but embedded in the kernel. So instead of duplicating the cpio infrastructure, we can simply build images/rootfs.cpio and link that into the kernel. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Signed-off-by: Peter Korsgaard --- linux/linux.mk | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'linux') diff --git a/linux/linux.mk b/linux/linux.mk index f249d9670..600b14d75 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -126,13 +126,13 @@ define LINUX_CONFIGURE_CMDS $(call KCONFIG_ENABLE_OPT,CONFIG_AEABI,$(@D)/.config), $(call KCONFIG_DISABLE_OPT,CONFIG_AEABI,$(@D)/.config)) # As the kernel gets compiled before root filesystems are - # built, we create a fake initramfs file list. It'll be - # replaced later by the real list, and the kernel will be + # built, we create a fake cpio file. It'll be + # replaced later by the real cpio archive, and the kernel will be # rebuilt using the linux26-rebuild-with-initramfs target. $(if $(BR2_TARGET_ROOTFS_INITRAMFS), - touch $(BINARIES_DIR)/rootfs.initramfs + touch $(BINARIES_DIR)/rootfs.cpio $(call KCONFIG_ENABLE_OPT,CONFIG_BLK_DEV_INITRD,$(@D)/.config) - $(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,\"$(BINARIES_DIR)/rootfs.initramfs\",$(@D)/.config) + $(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,\"$(BINARIES_DIR)/rootfs.cpio\",$(@D)/.config) $(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_ROOT_UID,0,$(@D)/.config) $(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_ROOT_GID,0,$(@D)/.config) $(call KCONFIG_DISABLE_OPT,CONFIG_INITRAMFS_COMPRESSION_NONE,$(@D)/.config) @@ -190,13 +190,10 @@ linux-savedefconfig linux26-savedefconfig: dirs $(LINUX_DIR)/.stamp_configured $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) \ $(subst linux-,,$(subst linux26-,,$@)) -# Support for rebuilding the kernel after the initramfs file list has -# been generated in $(BINARIES_DIR)/rootfs.initramfs. -$(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_target_installed $(LINUX_DIR)/.stamp_images_installed $(BINARIES_DIR)/rootfs.initramfs +# 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_images_installed $(BINARIES_DIR)/rootfs.cpio @$(call MESSAGE,"Rebuilding kernel with initramfs") - # Remove the previously generated initramfs which was empty, - # to make sure the kernel will actually regenerate it. - $(RM) -f $(@D)/usr/initramfs_data.cpio* # Build the kernel. $(TARGET_MAKE_ENV) $(MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_IMAGE_NAME) # Copy the kernel image to its final destination -- cgit v1.2.3