Kernel vs ROOTFS
I think I know but I am a bit confused. Can someone please explain the difference between Kernel and rootfs in embedded system environment?
The kernel is RAM-resident executable code. The rootfs is the essential filesystem for the system (initially a ramfs or tmpfs) , but more often is used to refer to a collection of files in a filesystem of some type (e.g. ramfs, ext2/3/4, jffs2, ubifs) that consist of essential initialization and userspace programs. Both are needed to boot a Linux system.
2 Answers 2
rootfs is just an ununmountable ramfs/tmpfs. The kernel is a chunk of code that lives on a real filesystem.
@sawdust: «Rootfs is a special instance of ramfs (or tmpfs, if that’s enabled) . » You can pivot another root filesystem over it, but the entity called «rootfs» is a memory-resident filesystem.
But the most common and widespread use of «rootfs» (e.g. build a rootfs or install a rootfs in NAND) refers to contents of an essential filesystem, rather than that special instance. The kernel command-line parameter «root=» for specifying the «root filesystem» helps perpetuate this (mis)use.
«The kernel is a chunk of code that lives on a real filesystem.» — There is no requirement that the kernel be stored in a filesystem. The most widely used embedded boot program, U-Boot, can access raw flash. The convention for Atmel ARM is to store the Linux kernel in raw flash: at91.com/linux4sam/bin/view/Linux4SAM/… IIRC Allwinner may also be similar.