mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
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) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
committed by
Peter Korsgaard
parent
3fac21ef8d
commit
13a3afc536
@@ -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)
|
||||
|
||||
define ROOTFS_INITRAMFS_ADD_INIT
|
||||
if [ ! -e $(TARGET_DIR)/init ]; then \
|
||||
ln -sf sbin/init $(TARGET_DIR)/init; \
|
||||
fi
|
||||
endef
|
||||
|
||||
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
|
||||
|
||||
ROOTFS_INITRAMFS_PRE_GEN_HOOKS += ROOTFS_INITRAMFS_ADD_INIT
|
||||
|
||||
define ROOTFS_INITRAMFS_CMD
|
||||
$(SHELL) fs/initramfs/gen_initramfs_list.sh -u 0 -g 0 $(TARGET_DIR) > $$@
|
||||
endef
|
||||
ROOTFS_INITRAMFS_DEPENDENCIES += rootfs-cpio
|
||||
|
||||
ROOTFS_INITRAMFS_POST_TARGETS += linux26-rebuild-with-initramfs
|
||||
|
||||
$(eval $(call ROOTFS_TARGET,initramfs))
|
||||
|
||||
# The generic fs infrastructure isn't very useful here.
|
||||
|
||||
rootfs-initramfs: $(ROOTFS_INITRAMFS_DEPENDENCIES) $(ROOTFS_INITRAMFS_POST_TARGETS)
|
||||
|
||||
rootfs-initramfs-show-depends:
|
||||
@echo $(ROOTFS_INITRAMFS_DEPENDENCIES)
|
||||
|
||||
ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
|
||||
TARGETS += rootfs-initramfs
|
||||
endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user