initrd 做法

| | Comments (0)

範例環境
欲製作的 system root directory 在 /systemroot
size 大小為 32mb 的 initrd
CF 在 /dev/hdc, 已格式化, 只有一個 partition /dev/hdc1
boot loader 使用 grub

Step 1: 製作 initrd loop device
dd if=/dev/zero of=initrd bs=1024k count=32
mke2fs -F -m0 -i 2048 initrd
mount -o loop initrd /mnt

Step 2: 複製系統至 initrd, 不含 kernel
cp -a /systemroot/* /mnt
umount /mnt

Step 3: 壓縮 initrd, 產生 initrd.gz
gzip -9 initrd

Step 4: 將 kernel 及 initrd.gz 複製到目標(CF, DOM...etc.)
mount /dev/hdc1 /mnt
cp kernel initrd.gz /mnt

Step 5: 安裝 boot loader
cp -a /boot/grub /mnt
printf "root (hd0,0)\nsetup (hd1)\nquit\n" | grub --no-floppy --batch

Step 6: 設定開機設定(menu.lst)
編輯 /mnt/grub/menu.lst 內容如下
timeout 0
default 0
title linux
root (hd0,0)
kernel /kernel ramdisk_size=32768 root=/dev/ram0 quite
initrd /initrd.gz

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on September 10, 2003 11:37 AM.

Oh! happy day was the previous entry in this blog.

Windows 2003 取消關機, 重開機輸入理由 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.