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 --- fs/initramfs/initramfs.mk | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'fs/initramfs/initramfs.mk') diff --git a/fs/initramfs/initramfs.mk b/fs/initramfs/initramfs.mk index 1cd48b6c8..f1eb8b6e6 100644 --- a/fs/initramfs/initramfs.mk +++ b/fs/initramfs/initramfs.mk @@ -1,36 +1,23 @@ ############################################################# # -# Make a initramfs_list file to be used by gen_init_cpio -# gen_init_cpio is part of the 2.6 linux kernels to build an -# initial ramdisk filesystem based on cpio +# Build a kernel with an integrated initial ramdisk +# filesystem based on cpio. # ############################################################# -ifeq ($(BR2_ROOTFS_DEVICE_CREATION_STATIC),y) +ROOTFS_INITRAMFS_DEPENDENCIES += rootfs-cpio -define ROOTFS_INITRAMFS_ADD_INIT - if [ ! -e $(TARGET_DIR)/init ]; then \ - ln -sf sbin/init $(TARGET_DIR)/init; \ - fi -endef +ROOTFS_INITRAMFS_POST_TARGETS += linux26-rebuild-with-initramfs -else -# devtmpfs does not get automounted when initramfs is used. -# Add a pre-init script to mount it before running init -define ROOTFS_INITRAMFS_ADD_INIT - if [ ! -e $(TARGET_DIR)/init ]; then \ - $(INSTALL) -m 0755 fs/initramfs/init $(TARGET_DIR)/init; \ - fi -endef -endif # BR2_ROOTFS_DEVICE_CREATION_STATIC +# The generic fs infrastructure isn't very useful here. -ROOTFS_INITRAMFS_PRE_GEN_HOOKS += ROOTFS_INITRAMFS_ADD_INIT +rootfs-initramfs: $(ROOTFS_INITRAMFS_DEPENDENCIES) $(ROOTFS_INITRAMFS_POST_TARGETS) -define ROOTFS_INITRAMFS_CMD - $(SHELL) fs/initramfs/gen_initramfs_list.sh -u 0 -g 0 $(TARGET_DIR) > $$@ -endef +rootfs-initramfs-show-depends: + @echo $(ROOTFS_INITRAMFS_DEPENDENCIES) -ROOTFS_INITRAMFS_POST_TARGETS += linux26-rebuild-with-initramfs +ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y) +TARGETS += rootfs-initramfs +endif -$(eval $(call ROOTFS_TARGET,initramfs)) -- cgit v1.2.3