xref: /OK3568_Linux_fs/buildroot/fs/initramfs/initramfs.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun################################################################################
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# Build a kernel with an integrated initial ramdisk filesystem based on cpio.
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun################################################################################
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun# The generic fs infrastructure isn't very useful here.
8*4882a593Smuzhiyun#
9*4882a593Smuzhiyun# The initramfs image does not actually build an image; its only purpose is:
10*4882a593Smuzhiyun# 1- to ensure rootfs.cpio is generated,
11*4882a593Smuzhiyun# 2- to then rebuild the kernel with rootfs.cpio as initramfs
12*4882a593Smuzhiyun#
13*4882a593Smuzhiyun# Note: ordering of the dependencies is not guaranteed here, but in
14*4882a593Smuzhiyun# linux/linux.mk, via the linux-rebuild-with-initramfs rule, which depends
15*4882a593Smuzhiyun# on the rootfs-cpio filesystem rule.
16*4882a593Smuzhiyun#
17*4882a593Smuzhiyun# Note: the trick here is that we directly depend on rebuilding the Linux
18*4882a593Smuzhiyun# kernel image (which itself depends on the rootfs-cpio rule), while we
19*4882a593Smuzhiyun# advertise that our dependency is on the rootfs-cpio rule, which is
20*4882a593Smuzhiyun# cleaner in the dependency graph.
21*4882a593Smuzhiyun
22*4882a593Smuzhiyunrootfs-initramfs: linux-rebuild-with-initramfs
23*4882a593Smuzhiyun
24*4882a593Smuzhiyunrootfs-initramfs-show-depends:
25*4882a593Smuzhiyun	@echo rootfs-cpio
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun.PHONY: rootfs-initramfs rootfs-initramfs-show-depends
28*4882a593Smuzhiyun
29*4882a593Smuzhiyunifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
30*4882a593SmuzhiyunTARGETS_ROOTFS += rootfs-initramfs
31*4882a593Smuzhiyunendif
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun# Not using the rootfs infra, so fake the variables
34*4882a593SmuzhiyunROOTFS_INITRAMFS_NAME = rootfs-initramfs
35*4882a593SmuzhiyunROOTFS_INITRAMFS_TYPE = rootfs
36*4882a593SmuzhiyunROOTFS_INITRAMFS_DEPENDENCIES = rootfs-cpio linux
37