Yet another rootfs reorganization related to the rootfs initialization scripts.

This commit is contained in:
Ivan Davidov 2016-04-23 04:41:57 +03:00
parent 8420232e44
commit cbb890865a
9 changed files with 184 additions and 27 deletions

View File

@ -1,5 +1,31 @@
#!/bin/sh
# System initialization sequence:
#
# /init
# |
# +--(1) /etc/01_prepare.sh (this file)
# |
# +--(2) /etc/02_overlay.sh
# |
# +-- /etc/03_init.sh
# |
# +-- /sbin/init
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
# +--(2) /bin/sh (Alt + F2)
# |
# +--(2) /bin/sh (Alt + F3)
# |
# +--(2) /bin/sh (Alt + F4)
echo "Suppress most kernel messages."
dmesg -n 1

View File

@ -1,5 +1,31 @@
#!/bin/sh
# System initialization sequence:
#
# /init
# |
# +--(1) /etc/01_prepare.sh
# |
# +--(2) /etc/02_overlay.sh (this file)
# |
# +-- /etc/03_init.sh
# |
# +-- /sbin/init
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
# +--(2) /bin/sh (Alt + F2)
# |
# +--(2) /bin/sh (Alt + F3)
# |
# +--(2) /bin/sh (Alt + F4)
# Create the new mountpoint in RAM.
mount -t tmpfs none /mnt

View File

@ -1,5 +1,31 @@
#!/bin/sh
# System initialization sequence:
#
# /init
# |
# +--(1) /etc/01_prepare.sh
# |
# +--(2) /etc/02_overlay.sh
# |
# +-- /etc/03_init.sh (this file)
# |
# +-- /sbin/init
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
# +--(2) /bin/sh (Alt + F2)
# |
# +--(2) /bin/sh (Alt + F3)
# |
# +--(2) /bin/sh (Alt + F4)
# If you have persistent overlay support then you can edit this file and replace
# the default initialization of the system. For example, you could use this:
#
@ -36,6 +62,7 @@ cat << CEOF
CEOF
# Interactive shell with controlling tty as PID 1.
exec setsid cttyhack sh
fi

View File

@ -0,0 +1,36 @@
#!/bin/sh
# System initialization sequence:
#
# /init
# |
# +--(1) /etc/01_prepare.sh
# |
# +--(2) /etc/02_overlay.sh
# |
# +-- /etc/03_init.sh
# |
# +-- /sbin/init
# |
# +--(1) /etc/04_bootscript.sh (this file)
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
# +--(2) /bin/sh (Alt + F2)
# |
# +--(2) /bin/sh (Alt + F3)
# |
# +--(2) /bin/sh (Alt + F4)
echo "Welcome to \"Minimal Linux Live\" (/sbin/init)"
for DEVICE in /sys/class/net/* ; do
echo "Found network device ${DEVICE##*/}"
ip link set ${DEVICE##*/} up
[ ${DEVICE##*/} != lo ] && udhcpc -b -i ${DEVICE##*/} -s /etc/05_rc.dhcp
done

View File

@ -0,0 +1,41 @@
#!/bin/sh
# System initialization sequence:
#
# /init
# |
# +--(1) /etc/01_prepare.sh
# |
# +--(2) /etc/02_overlay.sh
# |
# +-- /etc/03_init.sh
# |
# +-- /sbin/init
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp (this file)
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
# +--(2) /bin/sh (Alt + F2)
# |
# +--(2) /bin/sh (Alt + F3)
# |
# +--(2) /bin/sh (Alt + F4)
ip addr add $ip/$mask dev $interface
if [ "$router" ]; then
ip route add default via $router dev $interface
fi
if [ "$ip" ]; then
echo "DHCP configuration for device $interface"
echo "ip: $ip"
echo "mask: $mask"
echo "router: $router"
fi

View File

@ -1,10 +0,0 @@
#!/bin/sh
echo "Welcome to \"Minimal Linux Live\" (/sbin/init)"
for DEVICE in /sys/class/net/* ; do
echo "Found network device ${DEVICE##*/}"
ip link set ${DEVICE##*/} up
[ ${DEVICE##*/} != lo ] && udhcpc -b -i ${DEVICE##*/} -s /etc/rc.dhcp
done

View File

@ -1,4 +1,4 @@
::sysinit:/etc/bootscript.sh
::sysinit:/etc/04_bootscript.sh
::restart:/sbin/init
::shutdown:echo "Sync file buffers..."
::shutdown:sync

View File

@ -1,15 +0,0 @@
#!/bin/sh
ip addr add $ip/$mask dev $interface
if [ "$router" ]; then
ip route add default via $router dev $interface
fi
if [ "$ip" ]; then
echo "DHCP configuration for device $interface"
echo "ip: $ip"
echo "mask: $mask"
echo "router: $router"
fi

View File

@ -1,5 +1,31 @@
#!/bin/sh
# System initialization sequence:
#
# /init (this file)
# |
# +--(1) /etc/01_prepare.sh
# |
# +--(2) /etc/02_overlay.sh
# |
# +-- /etc/03_init.sh
# |
# +-- /sbin/init
# |
# +--(1) /etc/04_bootscript.sh
# | |
# | +-- udhcpc
# | |
# | +-- /etc/05_rc.udhcp
# |
# +--(2) /bin/sh (Alt + F1, main console)
# |
# +--(2) /bin/sh (Alt + F2)
# |
# +--(2) /bin/sh (Alt + F3)
# |
# +--(2) /bin/sh (Alt + F4)
echo "Welcome to \"Minimal Linux Live\" (/init)"
# Let's mount all core file systems.
@ -7,7 +33,7 @@ echo "Welcome to \"Minimal Linux Live\" (/init)"
# Create new mountpoint in RAM, make it our new root location and overlay it
# with our storage area (if overlay area exists at all). This operation invokes
# the script '/etc/03_switch.sh' as the new init process.
# the script '/etc/03_init.sh' as the new init process.
exec /etc/02_overlay.sh
echo "(/init) - you can never see this unless there is a serious bug..."