· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Booyo LiveCD/Sys Vinit


As we have seen, the init program is run by the kernel at boot time. It is in charge of starting all the normal processes that need to start up with the system. These include the getty processes that allow you to log in, NFS daemons, FTP daemons, and anything else you want to run when your machine boots.
  • The kernel looks in /sbin for init
  • init runs the /etc/rc.d/rc.sysinit script
  • rc.sysinit handles most of the boot loader's processes and then runs rc.serial (if it exists)
  • init runs all the scripts for the default runlevel
  • init runs /etc/rc.d/rc.local
knoppix 는 sysvinit_2.84-186.tar.gz 사용 FC3SysVinit-2.85-34.src.rpm 사용


bin -> /KNOPPIX/bin
boot -> /KNOPPIX/boot
lib -> /KNOPPIX/lib
opt -> /KNOPPIX/opt
sbin -> /KNOPPIX/sbin
usr -> /KNOPPIX/usr

root@ttyp1[/]# cd /sbin
root@ttyp1[sbin]# ls -l init
-rwxr-xr-x  1 root root 50932 2004-11-11 08:31 init
root@ttyp1[sbin]# ls -l halt
lrwxrwxrwx  1 root root 4 2005-01-22 13:42 halt -> init
root@ttyp1[sbin]# ls -l reboot
lrwxrwxrwx  1 root root 4 2005-01-22 13:42 reboot -> init

ca::ctrlaltdel:/etc/init 0
kb::kbrequest:/bin/echo "Keyboard Request -- edit /etc/inittab to let this work."
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop

knoppix-autoconfig -> /KNOPPIX/etc/init.d/knoppix-autoconfig
knoppix-halt -> /KNOPPIX/etc/init.d/knoppix-halt
knoppix-reboot -> /KNOPPIX/etc/init.d/knoppix-reboot

case "$CMDLINE" in *noprompt*) NOPROMPT="yes"; ;; esac
if [ -z "$INSTALLED" -a -z "$NOPROMPT" ]; then
[ -x /etc/init ] || cp -p /sbin/init /etc/
[ -x /etc/init ] && FINALCMD="/etc/init"

knoppix-halt -> knoppix-reboot

  • halt, reboot, Ctl-Alt-Del 모두 knoppix-halt 를 수행하고, 결과적으로 /etc/init 를 마지막으로 수행함.
  • /etc/init.d/powerfail 이 없슴.


< init:         init.o init_utmp.o
< halt:         halt.o ifdown.o hddown.o utmp.o reboot.h
> init:         init.o init_utmp.o halt.o ifdown.o utmp.o reboot.h
<               cd $(ROOT)/sbin; ln -sf halt reboot;
<               cd $(ROOT)/sbin; ln -sf halt poweroff;
>               cd $(ROOT)/sbin; ln -sf init halt;
>               cd $(ROOT)/sbin; ln -sf init reboot; 
>               cd $(ROOT)/sbin; ln -sf init poweroff;
diff -r sysvinit-2.85/src/halt.c /home/tcheun/sysvinit-knoppix-2.84/src/halt.c
<  * Usage:     halt [-n] [-w] [-d] [-f] [-p]
>  * Usage:     halt [-n] [-w] [-d] [-f] [-p] [-r]
>  *            -r: reboot (act like "reboot")
>   /* KNOPPIX: the "halt" options idfnpwt
if (!strcmp(progname, "reboot")) do_reboot = 1;
if (!strcmp(progname, "poweroff")) do_poweroff = 1;

case 'n': do_sync = 0; do_wtmp = 0;
case 'w': do_nothing = 1;
case 'd': do_wtmp = 0;
case 'f': do_hard = 1;
case 'i': do_ifdown = 1;
case 'p': do_poweroff = 1;
case 'r': do_reboot = 1;
case 't': tm = optarg;

fc3 추가 
case 'h': do_hddown = 1;
  • halt.c 에서 Please remove CD, close cdrom drive and hit return. 처리

inittab in fedora

  • ca::ctrlaltdel:/sbin/shutdown -t3 -r now
  • pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
  • pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
  • shutdown.c
  • -r 의 경우 reboot rc6.d 수행
    • S00killall
    • S01reboot /sbin/reboot 링크 to /sbin/halt
  • -h 의 경우 halt rc0.d 수행
    • S00killall
    • S01halt /sbin/halt


gnome -> 명령 -> 로그아웃

/proc/sys/dev/cdrom/autoclose /proc/sys/dev/cdrom/autoeject /proc/sys/dev/cdrom/check_media /proc/sys/dev/cdrom/debug /proc/sys/dev/cdrom/info /proc/sys/dev/cdrom/lock

As an example, the auto eject feature can be turned on by the superuser with the command echo "1" > /proc/sys/dev/cdrom/autoeject. This will cause cdroms to be ejected from the drive when unmounted.

modify sysvinit

boot booyo need libsepol-devel-1.1.1-2.i386.rpm make BUILD mv src to fedora for CVS (sshd) boot fedora change source code (Makefile, halt.c, init.c) boot booyo mv source code make

해야 할 일 halt.c commit 할 것 /sbin/init.org halt.org reboot.org
1019 mv init init.org 1020 cp -p /usr/src/booyo/BUILD/sysvinit-2.85/src/init . 1023 mv halt halt.org 1025 ln -sf init halt 1028 mv reboot reboot.org 1029 ls -l reboot.org 1030 ln -sf init reboot 1033 mv poweroff poweroff.org 1034 ln -sf init poweroff

booyo-halt 수정 필요

/initrd/etc/rc.d/inittab, /initrd/init 수정했슴.


init 을 만들때 static 옵션을 주어야 함. 아직 문제가 없는 것은 아님. inittab 를 6 로 하고 booyo-halt 를 바로 수행할 경우에 /BOOYO 가 busy 로 나오는 이유는 무엇일까?

strip init cp init /mnt/sda11/sbin/ reboot /mnt/sda11 make compressed

새 버전으로 수정해야 함.

sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2005-07-03 12:39:31
Processing time 0.0059 sec