kumquat-buildroot/fs
Thomas Petazzoni f507921d39 linux: add support for initramfs
In Buildroot, the kernel is built and installed *before* the root
filesystems are built. This allows the root filesystem to correctly
contain the kernel modules that have been installed.

However, in the initramfs case, the root filesystem is part of the
kernel. Therefore, the kernel should be built *after* the root
filesystem (which, in the initramfs case simply builds a text file
listing all files/directories/devices/symlinks that should be part of
the initramfs). However, this isn't possible as the initramfs text
file would lack all kernel modules.

So, the solution choosen here is to keep the normal order: kernel is
built before the root filesystem is generated, and to add a little
quirk to retrigger a kernel compilation after the root filesystem
generation.

To do so, we add a ROOTFS_$(FSTYPE)_POST_TARGETS variable to the
fs/common.mk infrastructure. This allows individual filesystems to set
a target name that we should depend on *after* generating the root
filesystem itself (contrary to normal ROOTFS_$(FSTYPE)_DEPENDENCIES,
on which we depend *before* generating the root filesystem).

The initramfs code in fs/initramfs/initramfs.mk uses this to add a
dependency on 'linux26-rebuild-with-initramfs'.

In linux/linux.mk, we do various things :

 * If BR2_TARGET_ROOTFS_INITRAMFS is enabled (i.e if initramfs is
   enabled as a root filesystem type), then we create an empty
   rootfs.initramfs file (remember that at this point, the root
   filesystem hasn't been generated) and we adjust the kernel
   configuration to include an initramfs. Of course, in the initial
   kernel build, this initramfs will be empty.

 * In the linux26-rebuild-with-initramfs target, we retrigger a
   compilation of the kernel image, after removing the initramfs in
   the kernel sources to make sure it gets properly rebuilt (we've
   experienced cases were modifying the rootfs.initramfs file wouldn't
   retrigger the generation of the initramfs at the kernel level).

This is fairly quirky, but initramfs really is a special case, so in
one way or another, we need a little quirk to solve its specialness.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-06-22 21:20:28 +02:00
..
cloop Move all filesystem generation code to fs/ 2010-04-09 11:04:36 +02:00
cpio fs/*/Config.in: remove useless configuration comments 2010-04-09 11:04:36 +02:00
cramfs cramfs/jffs2: use the new ROOTFS_DEVICE_TABLE variable 2010-04-17 04:36:23 +02:00
ext2 fs/ext2: fix blocks/inodes calculation 2010-04-19 14:33:14 +02:00
initramfs linux: add support for initramfs 2010-06-22 21:20:28 +02:00
iso9660 iso9660: take into account the linux changes 2010-06-22 21:20:26 +02:00
jffs2 jffs2: let makedevs create device files 2010-06-05 21:23:28 +02:00
romfs Move all filesystem generation code to fs/ 2010-04-09 11:04:36 +02:00
squashfs fs/squashfs: squashfs3 needs to set big/little endian 2010-05-26 22:47:32 +02:00
tar fs/*/Config.in: remove useless configuration comments 2010-04-09 11:04:36 +02:00
ubifs fs/*/Config.in: remove useless configuration comments 2010-04-09 11:04:36 +02:00
common.mk linux: add support for initramfs 2010-06-22 21:20:28 +02:00
Config.in fs: change the way the device table is configured 2010-04-17 04:36:23 +02:00