About initramfs
Initramfs is compiled at the same time and connected to the kernel into a file. It is linked to address _ initramfs_start and loaded to Ram at the same time as the kernel. The space occupied by the original cpio package (compressed or non-compressed) after initramfs is parsed (& __ initramfs_start-& __ initramfs_end) is directly stored in the system as part of the system, will not be released.
Because initramfs uses the cpio package format, it is easy to compile a single file, directory, and node to the system. This is very easy to use in the system, you do not need to mount another file system.
However, the cpio package is actually a Language Pack for describing files, directories, and nodes. To describe a file, directory, and node, a lot of additional overhead of description text is required, especially for directories and nodes, the cpio package is much larger than the corresponding image file.
About Kernel configuration and compilation
Kernel configuration: Make menuconfig to enter the configuration
EnterGeneral setup --->
Select kernel compression to lzma Compression
Kernelcompression mode (lzma) --->
Then select
[*] Initial Ram filesystem and RAM disk (initramfs/initrd) Support
(/Rootfs_dir) initramfs source file (s)
Rootfs_dir is the path of the rootfs to be compressed.
1. Modify the storage location of the compressed package in the memory: (MIPs chip)
In ARCH/MIPS/boot/compressed/calc_vmlinuz_load_addr.c
Vmlinuz_load_addr = 0x81a00000; (this address can be adjusted as needed)
2. Modify the busybox link of rootfs and run the following command in the rootfs directory:
Ln-sbin/busybox init
3. Modify cmdline:
"Console = ttysac0, 115200 init/init RW kgdbttysac0, 115200 kgdboc = ttysac0
Mem = 32m"
4. Make Compilation
Make vmlinuz. Bin
The vmlinuz. Bin compressed package will be generated in the current directory.
5. compilation may fail. In this case, the root permission is granted to rootfs and the user group is root. You need to modify the user group before compiling.