diff options
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-core/toybox')
5 files changed, 147 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/inittab b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/inittab new file mode 100644 index 0000000000..ffb2f17a66 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/inittab @@ -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 + diff --git a/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/rcK b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/rcK new file mode 100644 index 0000000000..617d3c0c3f --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/rcK @@ -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 + diff --git a/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/rcS b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/rcS new file mode 100644 index 0000000000..b8e29855d4 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab/rcS @@ -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 + diff --git a/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab_0.8.2.bb b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab_0.8.2.bb new file mode 100644 index 0000000000..9af1e3f149 --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab_0.8.2.bb @@ -0,0 +1,61 @@ +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 \ +" + +# most users may want to have getty enabled by default +PACKAGECONFIG ??= "getty" + +PACKAGECONFIG[getty] = "\ + enable_getty \ +" + +do_patch[noexec] = "1" + +do_configure() { + # copy over files now to have a fresh start on each config + for f in inittab rcK rcS; do + cp ${WORKDIR}/$f ${S} + done + + for config in ${PACKAGECONFIG_CONFARGS}; do + if [[ ${config} == "enable_getty" ]]; then + 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 + fi + 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 \ +" + diff --git a/meta-openembedded/meta-oe/recipes-core/toybox/toybox_0.8.3.bb b/meta-openembedded/meta-oe/recipes-core/toybox/toybox_0.8.3.bb index 4e72f295d3..5d453219f2 100644 --- a/meta-openembedded/meta-oe/recipes-core/toybox/toybox_0.8.3.bb +++ b/meta-openembedded/meta-oe/recipes-core/toybox/toybox_0.8.3.bb @@ -15,6 +15,8 @@ SRC_URI[sha256sum] = "eab28fd29d19d4e61ef09704e5871940e6f35fd35a3bb1285e41f20450 SECTION = "base" +RDEPENDS_${PN} = "${@["", "toybox-inittab"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'toybox')]}" + TOYBOX_BIN = "generated/unstripped/toybox" # Toybox is strict on what CC, CFLAGS and CROSS_COMPILE variables should contain. @@ -52,6 +54,11 @@ do_configure() { # Disable swapon as it doesn't handle the '-a' argument used during boot sed -e 's/CONFIG_SWAPON=y/# CONFIG_SWAPON is not set/' -i .config + + # Enable init if toybox was set as init manager + if [[ ${VIRTUAL-RUNTIME_init_manager} == *"toybox"* ]]; then + sed -e 's/# CONFIG_INIT is not set/CONFIG_INIT=y/' -i .config + fi } do_compile() { |