You are not logged in.

#1 2010-12-21 11:13:21

Cody
Member
Registered: 2010-11-08
Posts: 42

Boot Process Help

I'm trying to make my boot up as minimal as possible, but I'm running into a few problems.

This is my current bootchart.
Can someone help me find out why udevd runs twice? Is kthreadd controlled by the kernel?

Load-modules.sh is symbolically linked to modprobe.

These are my init scripts:

rc.sysinit:

#!/bin/bash
#
# /etc/rc.sysinit
#

. /etc/rc.conf
. /etc/rc.d/functions

# bring up the loopback interface
if [ -d /sys/class/net/lo ]; then
    stat_busy "Bringing up loopback interface"
    /sbin/ifconfig lo 127.0.0.1 up
    if [ $? -ne 0 ]; then
        stat_fail
    else
        stat_done
    fi
fi

# mount /proc, /sys and our RAM /dev
#/bin/mount -n -t tmpfs none /dev -o mode=0755
#/bin/mount -n -t proc none /proc
#/bin/mount -n -t sysfs none /sys

# Copy static device nodes to /dev
/bin/cp -a /lib/udev/devices/* /dev/


############################### HARD DISK NODES ###############################

/bin/mknod -m 660 /dev/sda1 b 8 1
/bin/mknod -m 660 /dev/sda2 b 8 2
/bin/mknod -m 660 /dev/sda3 b 8 3
/bin/mknod -m 660 /dev/sda4 b 8 4
#/bin/mknod -m 660 /dev/sda5 b 8 5
/bin/mknod -m 660 /dev/sda6 b 8 6

#############


# Default nodes
/bin/mknod -m 666 /dev/random c 1 8
/bin/mknod -m 666 /dev/urandom c 1 9 
/bin/mknod /dev/full c 1 7
/bin/mknod -m 640 /dev/kmem c 1 2
/bin/mknod -m 755 /dev/ptmx c 5 2

/bin/mknod -m 666 /dev/tty c 5 0
/bin/mknod -m 620 /dev/tty0 c 4 0
/bin/mknod -m 620 /dev/tty1 c 4 1
/bin/mknod -m 620 /dev/tty2 c 4 2
#/bin/mknod -m 620 /dev/tty3 c 4 3
#/bin/mknod -m 620 /dev/tty4 c 4 4
#/bin/mknod -m 620 /dev/tty5 c 4 5
#/bin/mknod -m 620 /dev/tty6 c 4 6
/bin/mknod -m 620 /dev/tty7 c 4 7

/bin/mknod -m 660 /dev/vcs c 7 0
/bin/mknod -m 660 /dev/vcs1 c 7 1
/bin/mknod -m 660 /dev/vcs2 c 7 2
/bin/mknod -m 660 /dev/vcs3 c 7 3
/bin/mknod -m 660 /dev/vcs4 c 7 4
/bin/mknod -m 660 /dev/vcs5 c 7 5
/bin/mknod -m 660 /dev/vcs6 c 7 6
/bin/mknod -m 660 /dev/vcs7 c 7 7

/bin/mknod -m 660 /dev/vcsa c 7 128
/bin/mknod -m 660 /dev/vcsa1 c 7 129
/bin/mknod -m 660 /dev/vcsa2 c 7 130
/bin/mknod -m 660 /dev/vcsa3 c 7 131
/bin/mknod -m 660 /dev/vcsa4 c 7 132
/bin/mknod -m 660 /dev/vcsa5 c 7 133
/bin/mknod -m 660 /dev/vcsa6 c 7 134
/bin/mknod -m 660 /dev/vcsa7 c 7 135

/bin/mknod -m 640 /dev/mem c 1 1

    /bin/mkdir -m 755 /dev/dri
    /bin/mknod -m 666 /dev/dri/card0 c 226 0

# enable rtc access
/sbin/modprobe rtc-cmos >/dev/null 2>&1
RTC_MAJOR=$(/bin/grep -w rtc /proc/devices 2>/dev/null)
RTC_MAJOR="${RTC_MAJOR%% *}"
if [ -n "$RTC_MAJOR" ]; then
    /bin/mknod /dev/rtc0 c $RTC_MAJOR 0
    /bin/ln -s /dev/rtc0 /dev/rtc
fi

HWCLOCK_PARAMS="--hctosys"
if [ "$HARDWARECLOCK" = "UTC" ]; then
    HWCLOCK_PARAMS="$HWCLOCK_PARAMS --utc"
elif [ "$HARDWARECLOCK" = "localtime" ]; then
    HWCLOCK_PARAMS="$HWCLOCK_PARAMS --localtime"
else
    HWCLOCK_PARAMS=""
fi

# Set clock early to fix some bugs with filesystem checks
# Clock is set again later to match rc.conf
if [ -n "$HWCLOCK_PARAMS" -a -f /etc/localtime ]; then
    /sbin/hwclock $HWCLOCK_PARAMS --noadjfile
fi


# If necessary, find md devices and manually assemble RAID arrays
#if [ -f /etc/mdadm.conf -a "$(/bin/grep ^ARRAY /etc/mdadm.conf 2>/dev/null)" ]; then
#    status "Activating RAID arrays" /sbin/mdadm --assemble --scan
#fi


status "Mounting Root Read-only" /bin/mount -n -o remount,ro /

FORCEFSCK=
[ -f /forcefsck ] && FORCEFSCK="-- -f"
NETFS="nonfs,nonfs4,nosmbfs,nocifs,nocodafs,noncpfs,nosysfs,noshfs,nofuse,nofuseblk,noglusterfs"

fsck_reboot() {
    echo "Automatic reboot in progress..."
    /bin/umount -a
    /bin/mount -n -o remount,ro /
    /sbin/reboot -f
    exit 0
}

if [ -x /sbin/fsck ]; then
    stat_busy "Checking Filesystems"
    FSCK_OUT=/dev/stdout
    FSCK_ERR=/dev/null
    /sbin/fsck -A -T -C -a -t $NETFS $FORCEFSCK >$FSCK_OUT 2>$FSCK_ERR
    fsckret=$?
    if [ ${fsckret} -gt 1 ]; then
        stat_fail
    fi
    if [ $((${fsckret}&2)) -eq 2 ]; then
        echo
        echo "********************** REBOOT REQUIRED *********************"
        echo "*                                                          *"
        echo "* The system will be rebooted automatically in 15 seconds. *"
        echo "*                                                          *"
        echo "************************************************************"
        echo
        /bin/sleep 15
        fsck_reboot
    fi
    if [ ${fsckret} -gt 1 -a ${fsckret} -ne 32 ]; then
        echo
        echo "*****************  FILESYSTEM CHECK FAILED  ****************"
        echo "*                                                          *"
        echo "*  Please repair manually and reboot. Note that the root   *"
        echo "*  file system is currently mounted read-only. To remount  *"
        echo "*  it read-write type: mount -n -o remount,rw /            *"
        echo "*  When you exit the maintenance shell the system will     *"
        echo "*  reboot automatically.                                   *"
        echo "*                                                          *"
        echo "************************************************************"
        echo
        /sbin/sulogin -p
        fsck_reboot
    fi
    stat_done
fi

stat_busy "Mounting Local Filesystems"
/bin/mount -n -o remount,rw /
/bin/rm -f /etc/mtab*
# make sure / gets written to /etc/mtab
/bin/mount -o remount,rw /
# Write /proc, /sys and /dev to /etc/mtab
if [ -e /proc/mounts ]; then
    /bin/grep -e "/proc " -e "/sys " -e "/dev " /proc/mounts >> /etc/mtab
fi
# now mount all the local filesystems
/bin/mount -a -t $NETFS -O no_netdev
stat_done

stat_busy "Removing Leftover Files"
/bin/rm -f /etc/nologin &>/dev/null
/bin/rm -f /etc/shutdownpid &>/dev/null
/bin/rm -f /var/lock/* &>/dev/null
/bin/rm -rf /tmp/* /tmp/.* &>/dev/null
/bin/rm -f /forcefsck &>/dev/null
(cd /var/run && /usr/bin/find . ! -type d -exec /bin/rm -f -- {} \; )
: > /var/run/utmp
/bin/chmod 0664 /var/run/utmp
stat_done

#status "Updating Shared Library Links" /sbin/ldconfig

if [ "$HOSTNAME" != "" ]; then
    status "Setting Hostname: $HOSTNAME" /bin/hostname $HOSTNAME
fi

# Setting console lang
 /bin/loadkeys -q $KEYMAP

# Starting Xorg
if [ -x /etc/rc.local ]; then
    /etc/rc.local &
fi

# End of file
# vim: set ts=2 noet:

rc.multi

#!/bin/bash
#
# /etc/rc.multi
#

. /etc/rc.conf
. /etc/rc.d/functions

#Starting UDEV
if [ -x /sbin/udevadm ]; then
    /sbin/udevd --daemon
fi
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
  /sbin/udevadm trigger &
fi
if /bin/pidof -o %PPID /sbin/udevd >/dev/null; then
    /sbin/udevadm settle
fi

# Activating Swap
/sbin/swapon -a

stat_busy "Configuring System Clock"
if [ ! -f /var/lib/hwclock/adjtime ]; then
    echo "0.0 0 0.0" > /var/lib/hwclock/adjtime
fi
if [ "$TIMEZONE" != "" -a -e "/usr/share/zoneinfo/$TIMEZONE" ]; then
    /bin/rm -f /etc/localtime
    /bin/cp "/usr/share/zoneinfo/$TIMEZONE" /etc/localtime
fi

if [ -n "$HWCLOCK_PARAMS" ]; then
    /sbin/hwclock --adjust #Adjust for system drift
    /sbin/hwclock $HWCLOCK_PARAMS
fi
stat_done

RANDOM_SEED=/var/lib/misc/random-seed
if [ -f $RANDOM_SEED ]; then
    stat_busy "Initializing Random Seed"
    /bin/cat $RANDOM_SEED > /dev/urandom
    stat_done
fi


# Load sysctl variables if sysctl.conf is present
[ -r /etc/sysctl.conf ] && /sbin/sysctl -q -p &>/dev/null

# Start daemons
for daemon in "${DAEMONS[@]}"; do
    if [ "$daemon" = "${daemon#!}" ]; then
        if [ "$daemon" = "${daemon#@}" ]; then
            start_daemon $daemon
        else
            start_daemon_bkgd ${daemon:1}
        fi
    fi
done

# Set the NIS domain name, if necessary
#[ -f /etc/conf.d/nisdomainname ] && . /etc/conf.d/nisdomainname
#if [ "$NISDOMAINNAME" != "" ]; then
#    status "Setting NIS Domain Name: $NISDOMAINNAME" /bin/nisdomainname $NISDOMAINNAME
#fi

/bin/dmesg >| /var/log/dmesg.log

rc.conf

#
# /etc/rc.conf - Main Configuration for Arch Linux
#

# -----------------------------------------------------------------------
# LOCALIZATION
# -----------------------------------------------------------------------
#
LOCALE="en_US.UTF-8"
HARDWARECLOCK="localtime"
TIMEZONE="America/Chicago"
KEYMAP="dvorak"
CONSOLEFONT="Agafari-12"
CONSOLEMAP=
USECOLOR="yes"

# -----------------------------------------------------------------------
# HARDWARE
# -----------------------------------------------------------------------
#
#
MOD_AUTOLOAD="yes"
MODULES=()

USELVM="no"

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="Arch"

eth0="dhcp"
INTERFACES=(wlan0 eth0)

gateway="default gw 192.168.0.1"
ROUTES=(!gateway)
 
# Setting this to "yes" will skip network shutdown.
# This is required if your root device is on NFS.
NETWORK_PERSIST="no"

# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
#
DAEMONS=(dbus @wicd @syslog-ng crond alsa)

inittab

#
# /etc/inittab
#

#  Runlevels:
#    0    Halt
#    1(S)    Single-user
#    2    Not used
#    3    Multi-user
#    4    Not used
#    5    X11
#    6    Reboot

id:3:initdefault:
# use once instead of wait
rc::sysinit:/etc/rc.sysinit
rs:S1:once:/etc/rc.single

# -8 options fixes umlauts problem on login
c1:2345:respawn:/sbin/mingetty --autologin cody tty1 linux
c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux
#c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux
#c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux
#c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux
#c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux

rm:2345:once:/etc/rc.multi > /dev/null
rh:06:once:/etc/rc.shutdown
su:S:once:/sbin/sulogin -p

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

Thanks in advance (: Any tips for making the above scripts faster/smaller/cleaner are welcome.

Edit: I've updated everything that I changed today.
Edit2: Updated bootchart

Last edited by Cody (2010-12-22 10:45:33)

Offline

#2 2010-12-21 11:35:13

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,899
Website

Re: Boot Process Help

You might some more tips here

https://bbs.archlinux.org/viewtopic.php?id=72156

MrG


Mr Green

Offline

#3 2010-12-21 11:41:31

Cody
Member
Registered: 2010-11-08
Posts: 42

Re: Boot Process Help

I've already read though that and haven't found any answers. hmm  Also my rc.sysinit is based off quick-init. I just didn't like the renaming of the scripts and also it's a package I don't need. wink

Offline

Board footer

Powered by FluxBB