mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-01-12 03:24:08 +00:00
meta-oe toybox-inittab: toybox inittab implementation
adds lightweight inittab scripts for use with toybox Signed-off-by: Adam Miartus <adam.miartus@softhows.eu> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
26
meta-oe/recipes-core/toybox/toybox-inittab/inittab
Normal file
26
meta-oe/recipes-core/toybox/toybox-inittab/inittab
Normal file
@@ -0,0 +1,26 @@
|
||||
# STARTUP
|
||||
::sysinit:/bin/mount -t proc proc /proc
|
||||
::sysinit:/bin/mount -t sysfs sysfs /sys
|
||||
::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
|
||||
::sysinit:/bin/mount -o remount,rw /
|
||||
::sysinit:/bin/mkdir -p /dev/pts
|
||||
::sysinit:/bin/mount -t devpts devpts /dev/pts
|
||||
::sysinit:/bin/mount -a
|
||||
|
||||
::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
|
||||
::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
|
||||
::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
|
||||
::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
|
||||
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
|
||||
::sysinit:/etc/init.d/rcS
|
||||
|
||||
# REBOOT
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
::shutdown:/etc/init.d/rcK
|
||||
::shutdown:/bin/umount -a -r
|
||||
|
||||
# RESTART INIT
|
||||
::restart:/sbin/init
|
||||
|
||||
26
meta-oe/recipes-core/toybox/toybox-inittab/rcK
Normal file
26
meta-oe/recipes-core/toybox/toybox-inittab/rcK
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Stop all init scripts in /etc/rc6.d
|
||||
# executing them in numerical order.
|
||||
#
|
||||
for i in /etc/rc6.d/K??*; do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set stop
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i stop
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
27
meta-oe/recipes-core/toybox/toybox-inittab/rcS
Normal file
27
meta-oe/recipes-core/toybox/toybox-inittab/rcS
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Start all init scripts in /etc/rcS.d and /etc/rc5.d
|
||||
# executing them in numerical order.
|
||||
#
|
||||
|
||||
for i in /etc/rcS.d/S??* /etc/rc5.d/S??* ;do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set start
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i start
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
50
meta-oe/recipes-core/toybox/toybox-inittab_0.8.2.bb
Normal file
50
meta-oe/recipes-core/toybox/toybox-inittab_0.8.2.bb
Normal file
@@ -0,0 +1,50 @@
|
||||
SUMMARY = "Toybox Inittab Configuration"
|
||||
LICENSE = "BSD-0-Clause"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-0-Clause;md5=81eeb0083e31f11ab1e33ded846d521c"
|
||||
|
||||
SRC_URI = "\
|
||||
file://inittab \
|
||||
file://rcK \
|
||||
file://rcS \
|
||||
"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
RCONFLICTS_${PN} = "\
|
||||
busybox-inittab \
|
||||
sysvinit-inittab \
|
||||
"
|
||||
|
||||
do_patch[noexec] = "1"
|
||||
|
||||
do_configure() {
|
||||
# copy over files now to have a fresh start on each config
|
||||
for file in ${SRC_URI}; do
|
||||
cp ${WORKDIR}/${file/file:\/\//} ${S}
|
||||
done
|
||||
|
||||
echo "# generated by bitbake recipe ${PN}" >> ${S}/inittab
|
||||
for console in "${SERIAL_CONSOLES}"; do
|
||||
param=$(echo ${console} | sed s/\;/\ /g)
|
||||
name=$(echo ${param} | cut -d' ' -f2)
|
||||
echo "$name::respawn:${base_sbindir}/getty ${param}" >> ${S}/inittab
|
||||
done
|
||||
}
|
||||
|
||||
do_compile[noexec] = "1"
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${sysconfdir}
|
||||
install -D -m 0644 ${S}/inittab ${D}${sysconfdir}/inittab
|
||||
|
||||
install -d ${D}${sysconfdir}/init.d
|
||||
install -D -m 0744 ${S}/rcK ${D}${sysconfdir}/init.d/rcK
|
||||
install -D -m 0744 ${S}/rcS ${D}${sysconfdir}/init.d/rcS
|
||||
}
|
||||
|
||||
FILES_${PN} = "\
|
||||
${sysconfdir}/inittab \
|
||||
${sysconfdir}/init.d/rcK \
|
||||
${sysconfdir}/init.d/rcS \
|
||||
"
|
||||
|
||||
Reference in New Issue
Block a user