国产宅男网站在线|亚洲A级性爱免费视频|亚洲中精品级在线|午夜福利AA毛

  • <dd id="gf5jf"><th id="gf5jf"></th></dd>

    <cite id="gf5jf"><label id="gf5jf"></label></cite>
  • <div id="gf5jf"><listing id="gf5jf"></listing></div>
    學(xué)習(xí)啦>學(xué)習(xí)電腦>操作系統(tǒng)>Linux教程>

    如何將initramfs打包進內(nèi)核

    時間: 若木635 分享

      將initramfs打包進內(nèi)核

      如果我們有一個已經(jīng)做好的cpio格式的initramfs,可以在內(nèi)核編譯時直接編譯進內(nèi)核。

      在將init程序打包進內(nèi)核中,我們在內(nèi)核配置參數(shù)中的initramfs sources配置項下輸入構(gòu)建initramfs的目錄路徑。

      其實我們也可以直接輸出現(xiàn)成的initramfs的文件名,這樣在內(nèi)核編譯時,就可以把它編譯進內(nèi)核了。

      使用這種方法,有兩點需要注意:

      (1)cpio文件不能壓縮。一般作為initrd的cpio文件都經(jīng)過了壓縮,所以編譯前需要先把壓縮過的文件解壓。

      (2)cpio文件的后綴名必須是 .cpio。內(nèi)核編譯通過 .cpio的后綴名來識別此文件是cpio打包文件,而其他文件后綴名則會被認為是initramfs構(gòu)建的描述文件(關(guān)于描述文件,下面后詳細說明)。

      用描述文件構(gòu)建initramfs

      用內(nèi)核編譯工具構(gòu)建initramfs的第三種方法是使用描述文件。

      在內(nèi)核配置參數(shù)中的initramfs sources配置項下可以輸入initramfs構(gòu)建描述文件的文件名,內(nèi)核編譯工具根據(jù)描述文件完成initramfs的構(gòu)建。

      描述文件的語法格式的說明如下:

      # a comment

      file

      dir

      nod

      slink

      pipe

      sock

      name of the file/dir/nod/etc in the archive

      location of the file in the current filesystem

      link target

      mode/permissions of the file

      user id (0=root)

      group id (0=root)

      device type (b=block, c=character)

      major number of nod

      minor number of nod

      例子: 我們用描述文件的方式,構(gòu)建將init程序打包進內(nèi)核中的hello world的initramfs。

      hello-init.desp:

      dir /dev 0755 0 0

      nod /dev/console 0600 0 0 c 5 1

      file /init /home/wyk/initramfs-test/hello_static 0755 0 0

      在內(nèi)核配置項initramfs sources中指定描述文件hello-init.desp,編譯內(nèi)核時就會生成hello world的initramfs,運行效果與第一節(jié)用指定構(gòu)建目錄的方法構(gòu)建的initramfs的完全相同。

    如何將initramfs打包進內(nèi)核

    將initramfs打包進內(nèi)核 如果我們有一個已經(jīng)做好的cpio格式的initramfs,可以在內(nèi)核編譯時直接編譯進內(nèi)核。 在將init程序打包進內(nèi)核中,我們在內(nèi)核配置參數(shù)中的initramfs sources配置項下輸入構(gòu)建initramfs的目錄路徑。 其實我們也可以直
    推薦度:
    點擊下載文檔文檔為doc格式
    75407