Some understanding of using Initramfs and RAMDisk to mount the root file system
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reprint please indicate the source
CSDN Author: Andoubi
Original link: http://blog.csdn.net/andoubi/article/details/51958927
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Initramfs and RAMDisk file systems are both memory-based file systems. To choose between these two ways to mount the root file system, you should set up the kernel at the very beginning. Typically, a root file system is created on a virtual machine, and then the kernel is configured to support INITRAMFS and RAMDisk:
General Setup------------------->
[*] Initial RAM filesystem and ARM disk (INITRAMFS/INITRD) support
Then enter the full path name of the prepared root file system in the following entry. The final example is as follows: (assuming that the/home/rootfs root file path is a.)
General Setup------------------->
[*] Initial RAM filesystem and ARM disk (INITRAMFS/INITRD) support (/HOME/ROOTFS) Initramfs source file (s)
Once configured, compile the kernel and download the kernel to the Development Board. After running the kernel, you can see the root file system you made on the Development Board.
Error correcting:
The following are all Initramfs file systems, the RAMDisk file system is not the same, it can be compiled separately into a mirror.
Note: Both file systems are memory based and run in RAM, so a power outage disappears and data cannot be saved. So, when you restart the Development Board, you will find that the contents of the root file system on the board have not changed any, before the creation of some files or added data all disappeared, before the deleted things are back. If you want to add some files to the Linux system on the board, you must go back to the created root file system on the virtual machine and add the files you want to add here. Then recompile the kernel, download the kernel back to the board, and after the kernel runs, you'll notice that the developer board appears with the file you just added.
This part of the understanding is not much, my understanding is: If you use these two ways to mount the root file system, compile the kernel, we will make a good root file system into the kernel, they form an inseparable whole. This whole will be downloaded into the Nandflash, running the system, the root file system will run in memory, so it appears in front of us. However, it runs only in memory and does not synchronize data with Nandflash, so all the changes we make to the file system are in memory only, and these changes are not synchronized back to Nandflash. Therefore, restart the board, Nandflash inside the file system or that file system, no changes, the original mode as is. If you want to add files to the system on the board, you can only add them to the root file system you made, and then recompile the kernel. This is just a personal understanding, do not know right, but also please know the friend in the comments section to introduce.