fbs rev 6
Add a minimal rcS boot script for example (from ARM version but usable on a desktop)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Fri May 02 14:14:56 2014 +0200 (2014-05-02) |
parents | f631a039dc1c |
children | 2736565d8cf9 |
files | examples/rcS.minimal |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/examples/rcS.minimal Fri May 02 14:14:56 2014 +0200 1.3 @@ -0,0 +1,125 @@ 1.4 +#!/bin/sh 1.5 +# 1.6 +# /etc/init.d/rcS : Initial boot script for SliTaz 1.7 +# Config file is : /etc/rcS.conf 1.8 +# 1.9 +# rcS is the main initialization script used to check fs, mount, clean, 1.10 +# run scripts and start daemons. This is a custom script for ARM to get 1.11 +# a faster boot and skip things like handling cdrom. 1.12 +# 1.13 +# Copyright (C) 2012-2014 SliTaz - BSD License 1.14 +# 1.15 +. /lib/libtaz.sh 1.16 +. /etc/rcS.conf 1.17 +. /etc/fbs.conf 1.18 + 1.19 +# Set default path 1.20 +export PATH=/bin:/sbin:/usr/bin:/usr/sbin 1.21 + 1.22 +# Framebuffer Boot Splash 1.23 +if [ "$FBSPLASH" == "on" ]; then 1.24 + clear && usleep 250000 1.25 + fifo="/fbs.fifo" && fbs start 1.26 + echo "0" > ${fifo} && usleep 500000 1.27 +fi 1.28 + 1.29 +echo $(colorize 34 "Processing: /etc/init.d/rcS") 1.30 + 1.31 +# Mount all from: /etc/fstab 1.32 +echo "Mounting filesystems in fstab..." 1.33 +mkdir -p /dev/pts /dev/shm 1.34 +mount -a 1.35 + 1.36 +[ "$fifo" ] && echo "10" > ${fifo} && usleep 500000 1.37 + 1.38 +# Mount /run as tmpfs so runtime data are not written to disk 1.39 +echo "Mounting tmpfs filesystem on: /run" 1.40 +mount -t tmpfs tmpfs /run 1.41 +mount --bind /run /var/run 1.42 + 1.43 +# Store boot messages to log files 1.44 +log="/var/log/boot.log" 1.45 +dmesg > /var/log/dmesg.log & 1.46 + 1.47 +# Be quiet at boot 1.48 +echo "0 0 0 0" > /proc/sys/kernel/printk 1.49 + 1.50 +[ "$fifo" ] && echo "20" > ${fifo} 1.51 + 1.52 +# Use udev and disable hotplug helper (udevd listen to netlink) 1.53 +if [ -x "/sbin/udevd" ]; then 1.54 + echo "" > /proc/sys/kernel/hotplug 1.55 + echo "Starting udev daemon..." 1.56 + udevd --daemon 2>/dev/null 1.57 + udevadm trigger 1.58 + udevadm settle --timeout=120 1.59 +else 1.60 + # Fallback to Busybox mdev 1.61 + echo -n "Creating device nodes: /sbin/mdev -s" 1.62 + echo "/sbin/mdev" > /proc/sys/kernel/hotplug 1.63 + mdev -s; status 1.64 +fi 1.65 + 1.66 +[ "$fifo" ] && echo "30" > ${fifo} 1.67 + 1.68 +# Clean up /tmp 1.69 +echo -n "Cleaning up temporary files: /tmp" 1.70 +rm -rf /tmp && mkdir /tmp && chmod 1777 /tmp 1.71 +status 1.72 + 1.73 +[ "$fifo" ] && echo "40" > ${fifo} 1.74 + 1.75 +# Start syslogd and klogd 1.76 +echo -n "Starting system log daemons: syslogd/klogd..." 1.77 +syslogd -s ${SYSLOGD_SIZE} && klogd 1.78 +status 1.79 + 1.80 +[ "$fifo" ] && echo "50" > ${fifo} 1.81 + 1.82 +# Load all modules from config file 1.83 +if [ "$LOAD_MODULES" ]; then 1.84 + colorize 33 "Loading Kernel modules..." 1.85 + for mod in ${LOAD_MODULES}; do 1.86 + modprobe -v $mod | tee -a ${log} 1.87 + done 1.88 +fi 1.89 + 1.90 +[ "$fifo" ] && echo "60" > ${fifo} 1.91 + 1.92 +# Start all init scripts 1.93 +for script in ${RUN_SCRIPTS}; do 1.94 + colorize 34 "Processing: /etc/init.d/$script" 1.95 + /etc/init.d/$script | tee -a ${log} 1.96 +done 1.97 + 1.98 +[ "$fifo" ] && echo "70" > ${fifo} 1.99 + 1.100 +# Start all daemons 1.101 +if [ "$RUN_DAEMONS" ]; then 1.102 + colorize 33 "Starting all daemons..." 1.103 + for daemon in ${RUN_DAEMONS}; do 1.104 + /etc/init.d/$daemon start 1.105 + done 1.106 +fi 1.107 + 1.108 +[ "$fifo" ] && echo "80" > ${fifo} 1.109 + 1.110 +# Start X session 1.111 +if [ -x "/etc/init.d/$LOGIN_MANAGER" ]; then 1.112 + colorize 36 "Starting X environment..." 1.113 + /etc/init.d/$LOGIN_MANAGER start >/dev/null & 1.114 +fi 1.115 + 1.116 +[ "$fifo" ] && echo "90" > ${fifo} 1.117 + 1.118 +newline 1.119 +colorize 32 "$MESSAGE" 1.120 + 1.121 +# Exit fbs 1.122 +if [ "$fifo" ]; then 1.123 + echo "100" > ${fifo} && sleep 1 1.124 + sleep 1 && echo "exit" > ${fifo} && rm -f ${fifo} 1.125 +fi 1.126 + 1.127 +# Back to a verbose mode but wait to finish with a clean boot 1.128 +(sleep 4; echo "7 4 1 7" > /proc/sys/kernel/printk) &