亚洲欧美精品沙发,日韩在线精品视频,亚洲Av每日更新在线观看,亚洲国产另类一区在线5

<pre id="hdphd"></pre>

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

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

      時(shí)間: 若木635 分享

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

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

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

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

        使用這種方法,有兩點(diǎn)需要注意:

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

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

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

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

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

        描述文件的語(yǔ)法格式的說明如下:

        # 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程序打包進(jìn)內(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)核配置項(xiàng)initramfs sources中指定描述文件hello-init.desp,編譯內(nèi)核時(shí)就會(huì)生成hello world的initramfs,運(yùn)行效果與第一節(jié)用指定構(gòu)建目錄的方法構(gòu)建的initramfs的完全相同。

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

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