diff options
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-core/toybox')
5 files changed, 161 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 000000000..ffb2f17a6 --- /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 000000000..617d3c0c3 --- /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 000000000..b8e29855d --- /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 000000000..f82f8e9ce --- /dev/null +++ b/meta-openembedded/meta-oe/recipes-core/toybox/toybox-inittab_0.8.2.bb @@ -0,0 +1,64 @@ +SUMMARY = "Toybox Inittab Configuration" +LICENSE = "BSD-0-Clause" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD-0-Clause;md5=81eeb0083e31f11ab1e33ded846d521c" + +# Unpack to ${S}/orig +# +SRC_URI = "\ + file://inittab;subdir=${BP}/orig \ + file://rcK;subdir=${BP}/orig \ + file://rcS;subdir=${BP}/orig \ +" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +RCONFLICTS_${PN} = "\ + busybox-inittab \ + sysvinit-inittab \ +" + +# Just being sure. +B = "${S}" + +# 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 + cp orig/* . + + 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 4e72f295d..1513255c4 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. @@ -27,6 +29,11 @@ CFLAGS += "${TOOLCHAIN_OPTIONS} ${TUNE_CCARGS}" COMPILER_toolchain-clang = "clang" COMPILER ?= "gcc" +PACKAGECONFIG ??= "no-iconv no-getconf" + +PACKAGECONFIG[no-iconv] = ",," +PACKAGECONFIG[no-getconf] = ",," + EXTRA_OEMAKE = 'CROSS_COMPILE="${HOST_PREFIX}" \ CC="${COMPILER}" \ STRIP="strip" \ @@ -52,6 +59,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 ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','toybox','true','false',d)}; then + sed -e 's/# CONFIG_INIT is not set/CONFIG_INIT=y/' -i .config + fi } do_compile() { @@ -60,6 +72,12 @@ do_compile() { # Create a list of links needed ${BUILD_CC} -I . scripts/install.c -o generated/instlist ./generated/instlist long | sed -e 's#^#/#' > toybox.links + if ${@bb.utils.contains('PACKAGECONFIG','no-iconv','true','false',d)}; then + sed -i -e '/iconv$/d' toybox.links + fi + if ${@bb.utils.contains('PACKAGECONFIG','no-getconf','true','false',d)}; then + sed -i -e '/getconf$/d' toybox.links + fi } do_install() { |