From 75cb4fe38fade382450c5f6f35d5dcf55962143e Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 22 Jan 2016 20:49:09 +0000 Subject: busybox: Add support for busybox-init in config metadata we can configure busybox based init and device initializer ( mdev ) using e.g. VIRTUAL-RUNTIME_dev_manager = "busybox-mdev" VIRTUAL-RUNTIME_login_manager = "busybox" VIRTUAL-RUNTIME_init_manager = "busybox" VIRTUAL-RUNTIME_initscripts = "initscripts" VIRTUAL-RUNTIME_keymaps = "keymaps" DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit" busybox can be used to provide init system combined with mdev it makes it a complete init system for really tiny systems. This patch uses above defines to configure features in busybox to enable the init system and mdev in a configurable manner Signed-off-by: Khem Raj Signed-off-by: Richard Purdie --- meta/recipes-core/busybox/files/inittab | 24 ++++++++++++++++++++++++ meta/recipes-core/busybox/files/rcK | 25 +++++++++++++++++++++++++ meta/recipes-core/busybox/files/rcS | 26 ++++++++++++++++++++++++++ meta/recipes-core/busybox/files/runlevel | 11 +++++++++++ 4 files changed, 86 insertions(+) create mode 100644 meta/recipes-core/busybox/files/inittab create mode 100644 meta/recipes-core/busybox/files/rcK create mode 100644 meta/recipes-core/busybox/files/rcS create mode 100644 meta/recipes-core/busybox/files/runlevel (limited to 'meta/recipes-core/busybox/files') diff --git a/meta/recipes-core/busybox/files/inittab b/meta/recipes-core/busybox/files/inittab new file mode 100644 index 0000000000..bfec4a7743 --- /dev/null +++ b/meta/recipes-core/busybox/files/inittab @@ -0,0 +1,24 @@ +# This is run first except when booting in single-user mode. + +# Startup the system +null::sysinit:/bin/mount -t proc proc /proc +null::sysinit:/bin/mount -t sysfs sysfs /sys +null::sysinit:/bin/mount -t devtmpfs devtmpfs /dev +null::sysinit:/bin/mount -o remount,rw / +null::sysinit:/bin/mkdir -p /dev/pts +null::sysinit:/bin/mount -t devpts devpts /dev/pts +null::sysinit:/bin/mount -a + +::sysinit:/etc/init.d/rcS + +# Stuff to do before rebooting +::ctrlaltdel:/sbin/reboot +::shutdown:/etc/init.d/rcK +::shutdown:/sbin/swapoff -a +::shutdown:/bin/umount -a -r + +# Stuff to do when restarting the init process +::restart:/sbin/init + +# set hostname +null::sysinit:/bin/busybox hostname -F /etc/hostname diff --git a/meta/recipes-core/busybox/files/rcK b/meta/recipes-core/busybox/files/rcK new file mode 100644 index 0000000000..050086ecd8 --- /dev/null +++ b/meta/recipes-core/busybox/files/rcK @@ -0,0 +1,25 @@ +#!/bin/sh + +# Stop all init scripts in /etc/init.d +# executing them in reversed 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/recipes-core/busybox/files/rcS b/meta/recipes-core/busybox/files/rcS new file mode 100644 index 0000000000..d18c26b4c3 --- /dev/null +++ b/meta/recipes-core/busybox/files/rcS @@ -0,0 +1,26 @@ +#!/bin/sh + +# Stop all init scripts in /etc/init.d +# executing them in reversed 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 stop + . $i + ) + ;; + *) + # No sh extension, so fork subprocess. + $i start + ;; + esac +done + diff --git a/meta/recipes-core/busybox/files/runlevel b/meta/recipes-core/busybox/files/runlevel new file mode 100644 index 0000000000..866f3b5945 --- /dev/null +++ b/meta/recipes-core/busybox/files/runlevel @@ -0,0 +1,11 @@ +#!/bin/sh +# busybox init does not have LSB ( sysvinit ) like initlevels +# so lets fake it to 5 which is what we default anyway +# this helps with opkg post installs where it tries to invoke +# update-rc.d ad post install step. +# for package upgrades +# See code in update-rc.d around line 190 where it calls runlevel +# program +# +echo "5" + -- cgit v1.2.3