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

BooyoLiveCD/rc.sysinit


To do something instead of anaconda

  • define function: stringinstring(), getbootparam(), checkbootparam()
  • move Mount /proc and /sys to here
  • CMDLINE, LANGUAGE ¼³Á¤
  • LANGUAGE ¿¡ µû¶ó ¼³Á¤
    • LANG="ko_KR.UTF-8"
    • SUPPORTED="ko_KR.UTF-8:ko_KR:ko"
    • SYSFONT="latarcyrheb-sun16"
    • KEYBOARDTYPE="pc"
    • 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
fi
fi
anaconda
def createPcmciaConfig(path, test = 0):
    f = open(path, "w")

    pcic = pcicType(test = test)

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

    f.write("PCIC_OPTS=\n")
    f.write("CORE_OPTS=\n")

    f.close()
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)"
        DEVICE=eth0
        echo " ${GREEN}Network device ${MAGENTA}$DEVICE${GREEN} detected, IP is ${YELLOW}${IP}${GREEN}.${NORMAL}"
        cat << EOM > /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=$IP
NETMASK=255.255.255.0
EOM
        sed "s/#GATEWAY=192.168.1.1/GATEWAY=${IP%.*}.1/g" /etc/sysconfig/network > /tmp/network && mv /tmp/network /etc/sysconfig/network
        ifup eth0
else
        NETDEVICES="$(awk -F: '/eth.:|tr.:/{print $1}' /proc/net/dev 2>/dev/null)"
#       for DEVICE in $NETDEVICES
        for DEVICE in "eth0"
        do
                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}"
        done
fi


/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
  • IN_INITLOG= , USEMODULES=y
  • 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.

/etc/init.d/functions


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 ÀÌ ¾ø´Â °æ¿ì
    • BOOTUP, RES_COL, MOVE_TO_COL, SETCOLOR_* ´Â À§¿Í °°°Ô
    • 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 127.0.0.1 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
    • CAPTURE, SCSI, OTHER, RAID: load
    • SOCKET: do nothing
hwsetup ÈÄ¿¡ ÇÊ¿äÇÑ ÀÏ
  • knoppix ÀÇ °æ¿ì
    • mouse, sound, keyboard
    • agp

mkxf86config Àü¿¡ ÇÊ¿äÇÑ ÀÏ mkxf86config ÈÄ¿¡ ÇÊ¿äÇÑ ÀÏ

ID
Password
Join
If it pours before seven, it has rained by eleven.


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.0140 sec