2010年4月25日 星期日

PUPPY Start process

http://www-128.ibm.com/developerworks/linux/library/l-linuxboot/?ca=dgr-lnxw06LinuxBoot

1. /sbin/init. as configured through /etc/inittab

2 /etc/fstab 的用途

/etc/fstab 是設定分割區與 mount 目錄關係的檔案,開機時會依這個檔案的內容 mount 檔案系統,mount 檔案系統的命令為:

linux# mount -av

會依 /etc/fstab 的內容 mount 進除了 root 以外的所有檔案系統。


init 是在核心 mount 進 root 後,第一個執行的程式 (第一個 process),init 所負責的工作包括:

  • 執 行 /etc/rc.d/rc?.d/ 裡的 scripts
  • 將系統由開機狀態 (boot-up state) 切換至多使用者狀態 (multiuser state)
  • 負責載入 tty (本地端) 的 login shell
  • 負 責開機與關機的程序 (procedure)。
3 /etc/rc.d/rc.sysinit


(1) Puppy doesn't use run levels

(2) X starts with the command 'exec xwin' near the bottom of /etc/profile, it can be removed or commented out.




Useful tools for locating things:
    grep
    which
    readlink


Code:
# grep -nR startx /etc
/etc/ati/authatieventsd.sh:32: # vary depending upon whether X was started via xdm/kdm, gdm or startx, so
/etc/ati/authatieventsd.sh:54: # Finally, check for startx
# which startx
/usr/X11R7/bin/startx
# readlink /usr/X11R7/bin/startx
xwin
# grep -nR xwin /etc
/etc/cups/mime.convs:67:#image/x-xwindowdump application/vnd.cups-postscript66 imagetops
/etc/cups/mime.convs:99:#image/x-xwindowdump application/vnd.cups-raster 100 imagetoraster
/etc/cups/mime.types:111:#image/x-xwindowdump xwd string(4,<00000007>)
/etc/rc.d/rc.country:126: #xwin also set these...
/etc/rc.d/rc.country:130: #...this needs work. messes up font set required by dialog program. see also /usr/X11R7/bin/xwin.
/etc/rc.d/rc.sysinit:388:#note, if wanted to detect serial mouse here, k2.6.25.16 has module 'sermouse' that must be loaded (currently in xwin).
/etc/rc.d/rc.update:98: cp -af $NEWFILESMNTPT/usr/X11R7/bin/xwin /usr/X11R7/bin/
/etc/profile:196: exec xwin
/etc/mime.types:409:image/x-xwindowdump xwd
#

Grep searched through all the files in /etc to find the ones that contained the string 'startx' and returned the filenames, line numbers, and the lines themselves. Looking at them, they didn't seem to run it. So, I used the "which" command to see where the startx command was located. Then the "readlink" command told me that startx was actually a symlink to the xwin script (if it had been a real file, "readlink" wouldn't have returned anything). So then I did another grep to find the files that mention "xwin". Looking through the lines returned, only /etc/profile looks like it runs xwin, on line 196.

I already knew which file it was. But this is roughly the process I would use to find out if I didn't know. I often want to know which script is modifying a configuration file or doing some task. I usually look in /etc first, and if I don't see it there, I try /usr/sbin. When looking in the /usr tree, it can be a good idea to give grep the "-I" flag (that's an uppercase i, not an L) so that it doesn't look at binary files.

沒有留言:

張貼留言