· KLDP.org · KLDP.net · KLDP Wiki · KLDP BBS ·
Booyo LiveCD/Rcdot Sysinit


To do something instead of anaconda

  • define function: stringinstring(), getbootparam(), checkbootparam()
  • move Mount /proc and /sys to here
  • LANGUAGE 에 따라 설정
    • LANG="ko_KR.UTF-8"
    • SUPPORTED="ko_KR.UTF-8:ko_KR:ko"
    • SYSFONT="latarcyrheb-sun16"
    • KEYTABLE="us"
    • CHARSET="iso8859-1"
    • ZONE="Asia/Seoul"
    • UTC=false
    • ARC=false
  • xorg.conf 를 새로 생성하기 위해 /etc/X11/xorg.conf /etc/sysconfig/hwconf /etc/sysconfig/mouse 제거
  • /etc/localtime 설정
  • /etc/sysconfig/i18n /etc/sysconfig/keyboard /etc/sysconfig/clock 생성
  • /etc/sysconfig/network, /etc/sysconfig/network-scripts/ifcfg-eth0 설정
    • eth 가 아닐 경우는 어떻게 해야 하나?
  • FC3 rc.sysinit 시작
  • /sbin/initlog 제거
  • HOSTNAME 을 booyo 로 설정 (host 가 아닐때 의미가 있나?)
  • Mount /proc and /sys 위로 이동
  • Check SELinux status 없앰.
  • banner 수정
  • Initializing hardware... (pcmcia 추가) 좀 더 조사할 필요 있슴.
  • change monitor resolution
  • cmdline=$(cat /proc/cmdline) 위로 올림.
    • strstr 과 stringinstring 는 같은 기능이나 arg 순서가 틀림. 둘 다 사용
  • fastboot, fsck, readonly, quata 부분 없앰.
  • umount initrd 부분 comment 화
  • update quata 없앰
  • LVM 없앰.
  • Clean up SELinux labels 없앰.
  • zfcpconf.sh 부분 없앰
  • IN_INITLOG= 부분 없앰
  • RAID 부분 없앰
  • check remaining quotas other than root 부분 없앰
  • relabel_selinux 없앰
  • /.unconfigured 부분 없앰.
    • network 를 잡지 못했을때 해주는 것이 좋지 않을까? text mode 라?
  • (w|u)tmpx 없앰.
  • swapon 검토 필요함.

/etc/sysconfig i18n

clock /usr/share/zoneinfo/Asia/Seoul 을 /etc/localtime 로 복사할 것.

Build, or linuxrc or here rm /etc/X11/xorg.cong /etc/sysconfig/hwconf /etc/sysconfig/mouse

kmodule 을 변경하여 사용해야 함. initscripts-7.93.2
  • kmodule 의 경우 probeDevice 에서 PROBE_NOLOAD 옵션을 주지만, 현재 이 옵션은 probeclass 가 CLASS_NETWORK 로 설정되어 있는 경우에만 영향을 줌. CLASS_UNSPEC 로 되어 있으므로 현재는 PROBE_ALL 과 같은 결과일 것임.

rhpl-0.148/src/xhwstate.py colordepth=16 resolution="800x600" 으로 initial set 이를 바꾸기 위해서는 kudzu-1.1.95/hwconf.c 에서 /usr/bin/system-config-display 에 옵션을 주어야 함.

pcmcia knoppix-autoconfig
if checkbootparam "nopcmcia"; then
echo " ${BLUE}Skipping PCMCIA detection as requested on boot commandline.${NORMAL}"
else modprobe pcmcia_core >/dev/null 2>&1
# Try Cardbus or normal PCMCIA socket drivers
modprobe yenta_socket >/dev/null 2>&1 || modprobe i82365 >/dev/null 2>&1 || modprobe tcic >/dev/null 2>&1
if [ "$?" = "0" ]; then
echo " ${GREEN}PCMCIA found, starting cardmgr.${NORMAL}"
modprobe ds >/dev/null 2>&1
cardmgr >/dev/null 2>&1 && sleep 4
def createPcmciaConfig(path, test = 0):
    f = open(path, "w")

    pcic = pcicType(test = test)

    if (pcic):
        f.write("PCIC=%s\n" % (pcic,))


def pcicType(test = 0):
    devs = kudzu.probe(kudzu.CLASS_SOCKET, kudzu.BUS_PCI, 0)
    if devs:
        log("Found a pcic controller of type: yenta_socket")
        return "yenta_socket"

    # lets look for non-PCI socket controllers now
    devs = kudzu.probe(kudzu.CLASS_SOCKET, kudzu.BUS_MISC, 0)

    if devs and devs[0].driver not in ["ignore", "unknown", "disabled"]:
        log("Found a pcic controller of type: %s", devs[0].driver)
        return devs[0].driver

    log("No pcic controller detected")
    return None
knoppix-autoconfig 의 부분이 추가되어야 함. 여기에 /etc/sysconfig/pcmcia 에 쓰는 부분을 추가해야 함. kmodule 뒤에 추가하는 것이 맞는지? berry 의 경우 관련 드라이브를 모두 blacklist 에 넣어 놓았슴.

kernel bootloader 를 설치하면 생성됨. installer 에서 고려해야 함.

desktop, system-config-securitylevel, firstboot, installinfo, installinfo.rpmsave

network-scripts/ifcfg-* network
# < Fat-Client-Version: DHCP Broadcast for IP address >
if checkbootparam "nodhcp"; then
        echo " ${BLUE}Skipping DHCP broadcast/network detection as requested on boot commandline.${NORMAL}"
elif checkbootparam "ip"; then
        IP="$(getbootparam ip 2>/dev/null)"
        echo " ${GREEN}Network device ${MAGENTA}$DEVICE${GREEN} detected, IP is ${YELLOW}${IP}${GREEN}.${NORMAL}"
        cat << EOM > /etc/sysconfig/network-scripts/ifcfg-eth0
        sed "s/#GATEWAY=${IP%.*}.1/g" /etc/sysconfig/network > /tmp/network && mv /tmp/network /etc/sysconfig/network
        ifup eth0
        NETDEVICES="$(awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null)"
#       for DEVICE in $NETDEVICES
        for DEVICE in "eth0"
                echo -n " ${GREEN}Network device ${MAGENTA}$DEVICE${GREEN} detected, DHCP broadcasting for IP.${NORMAL}"
                trap 2 3 11
                dhclient $DEVICE >/dev/null 2>&1 &
                trap "" 2 3 11
                sleep 1
                echo " ${BLUE}(Backgrounding)${NORMAL}"

/etc inittab, fstab, mdadm.conf, mtab, resolv.conf, hosts, reconfigSys, mtab, arch,

FC3 rc.sysinit

  • Uses initlog to log it activities according do what is configured in /etc/initlog.conf and /etc/syslog.conf
    • 두 파일의 내용을 알아야 함. livecd 의 경우 너무 많은 log 는 메모리에 영향을 줌.
  • If DEVFS is used, starts devfsd (FC2 에만 있슴.) udev 사용으로 전환됨.
  • Sets up hostname, hosttype and sources /etc/sysconfig/network
  • Mounts the procfs and the sysfs in /proc and /sys
    • /proc/bus/usb 가 있으면 usbfs 마운트
  • Sources /etc/init.d/functions with various common shell functions used by other init scripts: daemon() , killproc() , pidofproc() , status() , echo_success() (the green OK) , confirm() ...
The script also sources some important configuration files: /etc/sysconfig/i18n (the system default language, in UTF format (ex: LANG="en_US.UTF-8"), which can create problems with some older software, particularly in Perl, either export LANG="en_US" before launching a troubled application or set it directly in /etc/sysconfig/i18n), /etc/sysconfig/init (the various color codes used in the booting output).
  • Checks SeLinux status (disable by default) (FC2 는 functions 앞에서 수행함)
  • restorecon - set file security contexts /sbin/restorecon -R /dev
  • HOSTTYPE 가 390, 390x 가 아니면 /etc/inittab 에서 /dev/tty? 를 찾아 reset
  • CONSOLETYPE 가 vt 면 Sets the system default font
  • Prints the well known "Welcome to ..." banner
  • Press 'I' to enter interactive startup
  • /bin/dmesg -n $LOGLEVEL: Fix console loglevel
  • /etc/udev/udev.conf
    • udev_root="/dev/" : where in the filesystem to place the device nodes
    • udev_db="/dev/.udev.tdb" : The name and location of the udev database.
    • udev_rules="/etc/udev/rules.d/" : The name and location of the udev rules file
    • udev_permissions="/etc/udev/permissions.d/" : The name and location of the udev permission file
    • default_mode="0600" : set the default mode for all nodes that have no explicit match in the permissions file
    • default_owner="root" : set the default owner for all nodes that have no explicit match in the permissions file
    • default_group="root" : set the default group for all nodes that have no explicit match in the permissions file
    • udev_log="no" : set to "yes" if you want logging, else "no"
  • /sbin/start_udev
  • sysctl -w kernel.modprobe="/sbin/modprobe"
  • sysctl -w kernel.hotplug="/sbin/hotplug"
  • kmodule
  • load module for IDE, SCSI, floppy, Network, sound and else
  • echo "raidautorun /dev/md0" | nash --quiet
  • mount -n /dev/pts
  • Starts the graphical boot screen with the rhgb program which uses graphics from /usr/bin/rhgb
  • Configures kernel according to /etc/sysctl.conf settings
  • Sets system clock accoring to /etc/sysconfig/clock parameters
  • Sets the keyboard layout according to /etc/sysconfig/keyboard
  • Sets hostname
  • Initializes ACPI settings
  • Initializes USB controller and HID devices (FC3 에서는 없어짐)
  • Checks the files /fastboot, /fsckoptions, /forcefsck and /.autofsck and sources /etc/sysconfig/autofsck in order to determine if and how launch a file system check.
  • Checks quota settings if any
  • Unmount the initrd, if necessary
  • Possibly update quotas if fsck was run on /.
  • Sets up ISA PNP devices according to the configuration file /etc/isapnp.conf
  • Mounts the Root filesystem in read/write mode
  • If configured sets up the Logical Volume Management (LVM)
  • Clean up SELinux labels
  • Clear mtab
  • rm -f /etc/mtab~ /etc/mtab~~
  • Enter root, /proc and (potentially) /proc/bus/usb and devfs into mtab.
/etc/fstab 에 /, /proc, /sys. /dev/pts 가 있어야 된다는 것을 의미하는 것 같다.
mount -f /
mount -f /proc
mount -f /sys >/dev/null 2>&1
mount -f /dev/pts
[ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
[ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
  • zfcpconf.sh exists only on mainframe
  • Activates swap space (FC3 에는 없슴)
  • Loads kernel modules with the parameters specified in /etc/modules.conf
  • Starts raid (MD) devices
  • something more here
  • If there is the /.unconfigured flag files, starts the first boot configuration procedure
  • Removes various flag files in / , /var/lock , /var/run , removes the rpm database (/var/lib/rpm/__db*, it's rebuilt when a new rpm command is issued) and various files in the /tmp directory.
  • /sbin/pam_console_apply -r
  • Inizializes serial ports
  • If they asked for ide-scsi, load it
  • Inizializes SCSI tapes, USB storage, Firewire (FC3 에는 없슴. 왜 없을까?)
  • Turns on hard disk optimization with hdparm according to the settings in /etc/sysconfig/harddisks*
  • If profiles are configured, it activates the default network profile

How is Udev Integrated on Fedora? initrd / initfs

mkinitrd copies /sbin/udev.static to the initrd /sbin/udev and symlinks it to /sbin/udevstart.

After the kernel boots, it executes the nash script of the initrd. This mounts a tmpfs filesystem on /dev/. Instead of hotplug /sbin/udev is called in the initrd phase. udevstart creates all device nodes for the devices, which are compiled in the kernel and for the modules, which are loaded by nash. Problems The whole udev and hotplug infrastructure is not available in initrd. Thus no hotplug scripts, udev rules, and permissions and no /etc/dev.d/ scripts are executed for any hotplug event, which is sent from the kernel. rc.sysinit

First, if SELinux is loaded and enabled, the context of /dev/ is set. rc.sysinit calls /sbin/start_udev. start_udev mounts a tmpfs filesystem on /dev/, if there is none already mounted. Then it creates some device nodes, which need module autoloading, or where there is no kernel module. After that /sbin/udevstart is called again, which simulates the hotplug events in the initrd phase, to apply the whole udev rules and permissions. After that rc.sysinit parses the ouput of /sbin/kmodule and loads every module. This should provide device nodes for all hardware found on your computer. Console User Permissions

/etc/dev.d/default/pam_console.dev is called whenever a device node is created and calls /sbin/pam_console_setowner with the filename (and an optional symlink) of the device node. This sets the permissions for console users like specified in /etc/security/console.perms.


set variable
  • COLUMNS=80
  • CONSOLETYPE="/sbin/consoletype"
  • /etc/sysconfig/i18n
    • LANG="ko_KR.UTF-8"
    • SUPPORTED="ko_KR.UTF-8:ko_KR:ko"
    • SYSFONT="latarcyrheb-sun16"
  • export LC_MESSAGES=en_US (CONSOLETYPE != pty and LANG 가 한국어, 일본어등일 경우)
  • export LANG
  • /etc/sysconfig/init
    • BOOTUP=color
    • GRAPHICAL=yes
    • RES_COL=60 : # column to start " OK " label in
    • MOVE_TO_COL="echo -en \\033[${RES_COL}G"
    • SETCOLOR_SUCCESS="echo -en \\033[0;32m" : green
    • SETCOLOR_FAILURE="echo -en \\033[0;31m" : red
    • SETCOLOR_WARNING="echo -en \\033[0;33m" : yellow
    • SETCOLOR_NORMAL="echo -en \\033[0;39m"
    • LOGLEVEL=3
    • PROMPT=yes : # Set to anything other than 'no' to allow hotkey interactive startup...
  • /etc/sysconfig/init 이 없는 경우
    • LOGLEVEL=1
  • if "$CONSOLETYPE" = "serial" ;
    • BOOTUP=serial, MOVE_TO_COL, SETCOLOR_* 는 null

set function
  • checkpid(): Check if $pid (could be plural) are running
  • daemon(): A function to start a program.
  • killproc(): A function to stop a program.
  • pidfileofproc(): A function to find the pid of a program. Looks *only* at the pidfile
  • pidofproc(): A function to find the pid of a program.
  • status()
  • echo_success()
  • echo_failure()
  • echo_passed()
  • echo_warning()
  • update_boot_stage(): Inform the graphical boot of our current state
  • success(): Log that something succeeded
  • failure(): Log that something failed
  • passed(): Log that something passed, but may have had errors. Useful for fsck
  • warning(): Log a warning
  • action(): Run some action. Log its output.
  • strstr(): returns OK if $1 contains $2
  • confirm(): Confirm whether we really want to run this service

전체 흐름

hwsetup 전에 해야 할 일
  • knoppix 의 경우
    • hostname
    • hwclock
    • localtime copy
    • 파일 생성 i18n, keyboard, knoppix
    • checkbootparam "idecd" || checkbootparam "atapicd" || modprobe ide-scsi >/dev/null 2>&1
    • modprobe ide-cd >/dev/null 2>&1
    • ifconfig lo up
    • test CD
    • if -d /proc/acpi ; then acpi load else apm load
    • pcmcia
    • usb
    • firewire
    • 왜 위의 일을 hwsetup 에서 하지 않고 앞에서 하는가?

hwsetup 에서 할 일
  • knoppix 의 경우
    • MOUSE: load, write, link
    • CDROM, MODEM, SCANNER: usb 인 경우: load, link
    • VIDEO: write
    • AUDIO, NETWORK, FLOPPY: write, load
    • KEYBOARD: usb 인 경우 load
    • SOCKET: do nothing
hwsetup 후에 필요한 일
  • knoppix 의 경우
    • mouse, sound, keyboard
    • agp

mkxf86config 전에 필요한 일 mkxf86config 후에 필요한 일

You will attract cultured and artistic people to your home.

sponsored by andamiro
sponsored by cdnetworks
sponsored by HP

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2005-03-14 18:05:51
Processing time 0.0119 sec