Initrd. img, an important file loaded during Linux kernel startup, Linux general technology, and Linux programming and kernel information. For more information, see the following. Usually initrd. img divides the kernel startup into two phases. The kernel only retains some basic startup code, and compiles some code such as the device driver into a load-able module to enable initrd. imgfile to load and execute, which can effectively reduce the size of the kernel. In the startup parameter, You need to specify something similar to INITRD =/boot/initrd. img parameters to describe initrd in your system. the location of the imgfile. If no value is specified or an error is specified, the system cannot find initrd. the imgfile may not be found by some important device drivers. After the startup, some devices cannot be enabled or the system is suspended, and "kernel panic: VFS: unable to mount root fs.
Generally, initrd. imgfiles are different from those of the ramdisk and cramfs types. They are not really img files, but ramdisk files compressed by gzip-9, therefore, you can use gunzip to decompress the package first, and then mount it with mount-o loop. To resolve this issue, you must modify the extension name of the initrd.img file to .gz before using gunzipping. Otherwise, gunzip cannot correctly identify the compression format of initrd. img.
However, in some newer linux releases, the kernel versions are already above 2.6, initrd. the imgfile is also different from the previous one. After unzipping with gunzip, it cannot be directly mounted using the mount-o loop command, because it is no longer a standard img file after decompression, therefore, the system prompts you to specify the mounted file system type during mount, but no matter what type you specify, it is useless. This is because the new initrd. img is a cpio archive file, which is then compressed by gzip-9, so we don't need to mount it. After gunzip is decompressed, we can use "cpio? Idgmm <待解压的文件”这个命令来解开cpio档即可,通常解出来的initrd包括以下文件:
The init file is the initialization file to be called during initrd. img loading. It should be noted that the init file is required for the initrd. imgfile in cpio format. If it is not in cpio format, it is to call the linuxrc file instead of init.
There are two ways to start the initrd. imgfile: ramdisk and initramfs. It seems that the initramfs method is simpler.
Next we will summarize the process of extracting and making the initrd. imgfile:
2. Create the initrd. imgfile:
Cd needs to be packaged into the directory where the initrd file is located
Find. | cpio-c-o> initrd. img
Gzip-9 initrd. img
Mv initrd.img.gz initrd. img
Note that the-c parameter of cpio cannot be dropped; otherwise, the initrd. imgfile may not work properly.
If you want the kernel to think that the initrd. img startup mode is initramfs, you need to use the following parameters to create the cpio file:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.