jollen.org

Jollen 的 Blog
Jollen's email: jollen # jollen.org
more:  Jollen's Training

簡易的 initramfs 製作方式

.作者:jollen/
.日期:December 19, 2006 1:10 AM


Linus 本人在 Linux 2.6 時代所提出的 "initramfs" 是一種更好的 "root=" 做法。在這裡先不對 initramfs 做詳細介紹與原由說明,不過,簡單來說,initramfs 就是「kernel 2.6 的 initrd」。Initrd(initial ramdisk)即 /dev/ram0,是一種普遍使用在 embedded Linux 的觀念;embedded Linux 利用 initrd 來載入 root filesystem(或是 bootstrap root filesystem 後再以 NFS 掛進完整 RFS)。

本日記介紹製作 Linux 2.6 的 initramfs 簡易方法。假設 RFS 的目錄為 /home/rootfs,則製作 initramfs 的指令為:

# cd /home/rootfs
# find . | cpio -o -H newc | gzip -9 >../cramfs.gz

更明確地說,initramfs 是 "compressed" ramfs(ram filesystem),ramfs 並不等於傳統的 ramdisk;像是以 "genext2fs" 工具所製作的 initrd(ext2 格式的 image file)才是基於 ramdisk 的傳統做法,也就是說,initramfs 並不等於傳統上的 initrd,這點要請大家多留意。

Tags:

純手工打造說明:技術專欄文章為 Jollen 原創,內容皆為人工撰寫,無 AI 生成。轉載請註明出處與作者,並全文引用。轉載時請在文章開頭或結尾明顯處註明「本文出處:https://www.jollen.org,已取得原作者同意並授權使用。」
訂閱電子報:不定期 Jollen's Blog 精選文章隨 Moko365 電子報寄送;請透過 Moko365 電子報訂閱(可隨時取消)。

Copyright(c) 2001–2006 www.jollen.org. All rights reserved.
Last update: 2026-07-22