Skip to content

Commit

Permalink
Fix custom initramfs generation
Browse files Browse the repository at this point in the history
  • Loading branch information
rkunze authored and ski7777 committed Jul 23, 2018
1 parent ef26ffd commit d64af48
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions fs/initramfs/initramfs.mk
Expand Up @@ -4,6 +4,12 @@
#
################################################################################

ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS_ROOTFS),y)
ROOTFS_INITRAMFS_DEPENDENCIES += rootfs-cpio
endif

ROOTFS_INITRAMFS_DEPENDENCIES += $(BINARIES_DIR)/initramfs.cpio

# The generic fs infrastructure isn't very useful here.
#
# The initramfs image does not actually build an image; its only purpose is:
Expand All @@ -26,6 +32,16 @@ rootfs-initramfs-show-depends:

.PHONY: rootfs-initramfs rootfs-initramfs-show-depends

ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS_ROOTFS),y)
$(BINARIES_DIR)/initramfs.cpio: rootfs-cpio
ln -sf rootfs.cpio $(BINARIES_DIR)/initramfs.cpio
endif

ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS_CUSTOM),y)
$(BINARIES_DIR)/initramfs.cpio: target-finalize $(call qstrip,$(BR2_TARGET_ROOTFS_INITRAMFS_CUSTOM_CONTENTS))
$(LINUX_DIR)/usr/gen_init_cpio $(BR2_TARGET_ROOTFS_INITRAMFS_CUSTOM_CONTENTS) > $(BINARIES_DIR)/initramfs.cpio
endif

ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
TARGETS_ROOTFS += rootfs-initramfs
endif
6 changes: 3 additions & 3 deletions linux/linux.mk
Expand Up @@ -278,8 +278,8 @@ define LINUX_KCONFIG_FIXUP_CMDS
# replaced later by the real cpio archive, and the kernel will be
# rebuilt using the linux-rebuild-with-initramfs target.
$(if $(BR2_TARGET_ROOTFS_INITRAMFS),
touch $(BINARIES_DIR)/rootfs.cpio
$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,"$${BR_BINARIES_DIR}/rootfs.cpio",$(@D)/.config)
touch $(BINARIES_DIR)/initramfs.cpio
$(call KCONFIG_SET_OPT,CONFIG_INITRAMFS_SOURCE,"$${BR_BINARIES_DIR}/initramfs.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))
$(if $(BR2_ROOTFS_DEVICE_CREATION_STATIC),,
Expand Down Expand Up @@ -505,7 +505,7 @@ $(eval $(kconfig-package))
.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
linux-rebuild-with-initramfs: $(BINARIES_DIR)/initramfs.cpio
linux-rebuild-with-initramfs:
@$(call MESSAGE,"Rebuilding kernel with initramfs")
# Build the kernel.
Expand Down

0 comments on commit d64af48

Please sign in to comment.