summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-01-22 20:49:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-25 12:44:12 +0000
commitbe145ad5dc4edfd7dffc74b8970aaafd0eb247f7 (patch)
treee8994340c4b994e244344e35abe6112dcf075d8d /meta/recipes-core
parent716fa93a8e0ce83bc602e53cf03b63c7966eaf4b (diff)
downloadpoky-be145ad5dc4edfd7dffc74b8970aaafd0eb247f7.tar.gz
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 (From OE-Core rev: 75cb4fe38fade382450c5f6f35d5dcf55962143e) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/busybox/busybox.inc15
-rw-r--r--meta/recipes-core/busybox/busybox/init.cfg3
-rw-r--r--meta/recipes-core/busybox/busybox/mdev.cfg11
-rw-r--r--meta/recipes-core/busybox/busybox_1.24.1.bb6
-rw-r--r--meta/recipes-core/busybox/files/inittab24
-rw-r--r--meta/recipes-core/busybox/files/rcK25
-rw-r--r--meta/recipes-core/busybox/files/rcS26
-rw-r--r--meta/recipes-core/busybox/files/runlevel11
8 files changed, 121 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index 95411230b9..e5710f05f4 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -275,6 +275,21 @@ do_install () {
275 install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev 275 install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
276 fi 276 fi
277 fi 277 fi
278 if grep "CONFIG_INIT=y" ${B}/.config; then
279 install -D -m 0777 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS
280 install -D -m 0777 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK
281 install -D -m 0755 ${WORKDIR}/runlevel ${D}${base_sbindir}/runlevel
282 if grep "CONFIG_FEATURE_USE_INITTAB=y" ${B}/.config; then
283 install -D -m 0777 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
284 tmp="${SERIAL_CONSOLES}"
285 for i in $tmp
286 do
287 j=`echo ${i} | sed s/\;/\ /g`
288 label=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
289 echo "tty$label::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
290 done
291 fi
292 fi
278 293
279 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then 294 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
280 if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then 295 if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
diff --git a/meta/recipes-core/busybox/busybox/init.cfg b/meta/recipes-core/busybox/busybox/init.cfg
new file mode 100644
index 0000000000..006d4c633e
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/init.cfg
@@ -0,0 +1,3 @@
1CONFIG_INIT=y
2CONFIG_FEATURE_USE_INITTAB=y
3
diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg
new file mode 100644
index 0000000000..6aefe90e43
--- /dev/null
+++ b/meta/recipes-core/busybox/busybox/mdev.cfg
@@ -0,0 +1,11 @@
1CONFIG_MDEV=y
2CONFIG_FEATURE_MDEV_CONF=y
3CONFIG_FEATURE_MDEV_RENAME=y
4CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
5CONFIG_FEATURE_MDEV_EXEC=y
6CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
7
8CONFIG_SETSID=y
9CONFIG_CTTYHACK=y
10
11CONFIG_FEATURE_SHADOWPASSWDS=y
diff --git a/meta/recipes-core/busybox/busybox_1.24.1.bb b/meta/recipes-core/busybox/busybox_1.24.1.bb
index 5e19d9c605..8adee53911 100644
--- a/meta/recipes-core/busybox/busybox_1.24.1.bb
+++ b/meta/recipes-core/busybox/busybox_1.24.1.bb
@@ -39,6 +39,12 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
39 file://sha256sum.cfg \ 39 file://sha256sum.cfg \
40 file://getopts.cfg \ 40 file://getopts.cfg \
41 file://resize.cfg \ 41 file://resize.cfg \
42 ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'busybox')]} \
43 ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager', True) == 'busybox-mdev')]} \
44 file://inittab \
45 file://rcS \
46 file://rcK \
47 file://runlevel \
42" 48"
43SRC_URI_append_libc-musl = " file://musl.cfg " 49SRC_URI_append_libc-musl = " file://musl.cfg "
44 50
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 @@
1# This is run first except when booting in single-user mode.
2
3# Startup the system
4null::sysinit:/bin/mount -t proc proc /proc
5null::sysinit:/bin/mount -t sysfs sysfs /sys
6null::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
7null::sysinit:/bin/mount -o remount,rw /
8null::sysinit:/bin/mkdir -p /dev/pts
9null::sysinit:/bin/mount -t devpts devpts /dev/pts
10null::sysinit:/bin/mount -a
11
12::sysinit:/etc/init.d/rcS
13
14# Stuff to do before rebooting
15::ctrlaltdel:/sbin/reboot
16::shutdown:/etc/init.d/rcK
17::shutdown:/sbin/swapoff -a
18::shutdown:/bin/umount -a -r
19
20# Stuff to do when restarting the init process
21::restart:/sbin/init
22
23# set hostname
24null::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 @@
1#!/bin/sh
2
3# Stop all init scripts in /etc/init.d
4# executing them in reversed numerical order.
5#
6for i in /etc/rc6.d/K??*; do
7 # Ignore dangling symlinks (if any).
8 [ ! -f "$i" ] && continue
9
10 case "$i" in
11 *.sh)
12 # Source shell script for speed.
13 (
14 trap - INT QUIT TSTP
15 set stop
16 . $i
17 )
18 ;;
19 *)
20 # No sh extension, so fork subprocess.
21 $i stop
22 ;;
23 esac
24done
25
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 @@
1#!/bin/sh
2
3# Stop all init scripts in /etc/init.d
4# executing them in reversed numerical order.
5#
6
7for i in /etc/rcS.d/S??* /etc/rc5.d/S??* ;do
8 # Ignore dangling symlinks (if any).
9 [ ! -f "$i" ] && continue
10
11 case "$i" in
12 *.sh)
13 # Source shell script for speed.
14 (
15 trap - INT QUIT TSTP
16 set stop
17 . $i
18 )
19 ;;
20 *)
21 # No sh extension, so fork subprocess.
22 $i start
23 ;;
24 esac
25done
26
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 @@
1#!/bin/sh
2# busybox init does not have LSB ( sysvinit ) like initlevels
3# so lets fake it to 5 which is what we default anyway
4# this helps with opkg post installs where it tries to invoke
5# update-rc.d ad post install step.
6# for package upgrades
7# See code in update-rc.d around line 190 where it calls runlevel
8# program
9#
10echo "5"
11