uTools-Manuals/docs/linux/mkinitrd.html
2019-04-21 11:50:48 +08:00

45 lines
2.3 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="mkinitrd">mkinitrd</h1>
<p>建立要载入ramdisk的映像文件</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>mkinitrd命令</strong> 建立要载入ramdisk的映像文件以供Linux开机时载入ramdisk。</p>
<p>这个是重新封包核心的命令,例如你自己修改了一个设备的驱动,如果这个驱动要加入核心级别的话,就需要对核心进行重新封包,把新加的配置编译到核心内部去!</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">mkinitrd(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-f若指定的映像问家名称与现有文件重复则覆盖现有的文件
-v执行时显示详细的信息
--omit-scsi-modules不要载入SCSI模块
--preload=&lt;模块名称&gt;:指定要载入的模块;
--with=&lt;模块名称&gt;:指定要载入的模块;
--version显示版本信息。</code></pre>
<h3 id="参数">参数</h3>
<ul>
<li>映像文件:指定要创建的映像文件;</li>
<li>内核版本:指定内核版本。</li>
</ul>
<h3 id="实例">实例</h3>
<pre><code class="language-bash">[root@localhost tmp]# mkinitrd -v -f myinitrd.img $(uname -r)
Creating initramfs
WARNING: using /tmp for temporary files
Looking for deps of module ide-disk
Looking for deps of module ext3 jbd
Looking for deps of module jbd
Using modules: ./kernel/fs/jbd/jbd.ko ./kernel/fs/ext3/ext3.ko
/sbin/nash -&gt; /tmp/initrd.Vz3928/bin/nash
/sbin/insmod.static -&gt; /tmp/initrd.Vz3928/bin/insmod
/sbin/udev.static -&gt; /tmp/initrd.Vz3928/sbin/udev
/etc/udev/udev.conf -&gt; /tmp/initrd.Vz3928/etc/udev/udev.conf
copy from /lib/modules/2.6.9-5.EL/./kernel/fs/jbd/jbd.ko(elf32-i386) to /tmp/initrd.Vz3928/lib/jbd.ko(elf32-i386)
copy from /lib/modules/2.6.9-5.EL/./kernel/fs/ext3/ext3.ko(elf32-i386) to /tmp/initrd.Vz3928/lib/ext3.ko(elf32-i386)
Loading module jbd
Loading module ext3
[root@localhost tmp]# file myinitrd.img
myinitrd.img: gzip compressed data, from Unix, max compression
[root@localhost tmp]# mv myinitrd.img myinitrd.img.gz
[root@localhost tmp]# gzip -d myinitrd.img.gz
[root@localhost tmp]# file myinitrd.img
myinitrd.img: ASCII cpio archive (SVR4 with no CRC)</code></pre>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->