Yet another rootfs reorganization related to the rootfs initialization scripts.
This commit is contained in:
parent
8420232e44
commit
cbb890865a
@ -1,5 +1,31 @@
|
|||||||
#!/bin/sh
|
#!/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."
|
echo "Suppress most kernel messages."
|
||||||
dmesg -n 1
|
dmesg -n 1
|
||||||
|
|
||||||
|
@ -1,5 +1,31 @@
|
|||||||
#!/bin/sh
|
#!/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.
|
# Create the new mountpoint in RAM.
|
||||||
mount -t tmpfs none /mnt
|
mount -t tmpfs none /mnt
|
||||||
|
|
||||||
|
@ -1,5 +1,31 @@
|
|||||||
#!/bin/sh
|
#!/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
|
# 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:
|
# the default initialization of the system. For example, you could use this:
|
||||||
#
|
#
|
||||||
@ -36,6 +62,7 @@ cat << CEOF
|
|||||||
|
|
||||||
CEOF
|
CEOF
|
||||||
|
|
||||||
|
# Interactive shell with controlling tty as PID 1.
|
||||||
exec setsid cttyhack sh
|
exec setsid cttyhack sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
36
src/08_generate_rootfs/etc/04_bootscript.sh
Executable file
36
src/08_generate_rootfs/etc/04_bootscript.sh
Executable 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
|
||||||
|
|
41
src/08_generate_rootfs/etc/05_rc.dhcp
Executable file
41
src/08_generate_rootfs/etc/05_rc.dhcp
Executable 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
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
::sysinit:/etc/bootscript.sh
|
::sysinit:/etc/04_bootscript.sh
|
||||||
::restart:/sbin/init
|
::restart:/sbin/init
|
||||||
::shutdown:echo "Sync file buffers..."
|
::shutdown:echo "Sync file buffers..."
|
||||||
::shutdown:sync
|
::shutdown:sync
|
||||||
|
@ -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
|
|
||||||
|
|
@ -1,5 +1,31 @@
|
|||||||
#!/bin/sh
|
#!/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)"
|
echo "Welcome to \"Minimal Linux Live\" (/init)"
|
||||||
|
|
||||||
# Let's mount all core file systems.
|
# 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
|
# 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
|
# 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
|
exec /etc/02_overlay.sh
|
||||||
|
|
||||||
echo "(/init) - you can never see this unless there is a serious bug..."
|
echo "(/init) - you can never see this unless there is a serious bug..."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user