ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2008年6月12日 星期四

Root HD Image : tty0

Linux 0.01 build 完只有 kernel image,缺 root 。 所以要建 root。 follow 上次的方法,create了 hd image 和 partition,filesystem後。 QEMU boot message是:
Booting from Floppy

Loading system ...

Partition table ok. <--hd.c
40513/40950 free block  <--super.c
13663/13354 free inodes
_
因為 init/main.c 中的 init( ) 會去 open /dev/tty0,所以我們要先在 root hd image中,先準備好 /dev/tty0。 /dev/tty0 是 char device,所以開啟fs/char_dev.c 來看.. 可以看到 character device的 major number table:
static crw_ptr crw_table[]={
 NULL,        /* nodev */
 NULL,        /* /dev/mem */
 NULL,        /* /dev/fd */
 NULL,        /* /dev/hd */
 rw_ttyx,    /* /dev/ttyx */
 rw_tty,        /* /dev/tty */
 NULL,        /* /dev/lp */
 NULL};        /* unnamed pipes */
其中 /dev/tty0 的index是4 (ttyx)。 所以 /dev/tty0 的 major number 是 4。 把 root image mount 起來,然後
sudo mkdir dev
sudo mknod tty0 c 4 0
這樣的hd root image,boot 後,會增加以下的message..
1513 buffers = 1549312 buffer space
Ok.
child 2 die with code ff00
-
對照 init/main.c 的 init( )來看,可以知道剛剛的 /dev/tty0 有作用了。 接下來的fail message是fork( )後去執行"/bin/sh" 發生問題。 因為 root hd 中沒有 /bin/sh.. 所以要準備 sh...

沒有留言:

標籤

網誌存檔