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>
This commit is contained in:
parent
716fa93a8e
commit
be145ad5dc
|
@ -275,6 +275,21 @@ do_install () {
|
|||
install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev
|
||||
fi
|
||||
fi
|
||||
if grep "CONFIG_INIT=y" ${B}/.config; then
|
||||
install -D -m 0777 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS
|
||||
install -D -m 0777 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK
|
||||
install -D -m 0755 ${WORKDIR}/runlevel ${D}${base_sbindir}/runlevel
|
||||
if grep "CONFIG_FEATURE_USE_INITTAB=y" ${B}/.config; then
|
||||
install -D -m 0777 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab
|
||||
tmp="${SERIAL_CONSOLES}"
|
||||
for i in $tmp
|
||||
do
|
||||
j=`echo ${i} | sed s/\;/\ /g`
|
||||
label=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`
|
||||
echo "tty$label::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||
if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
CONFIG_INIT=y
|
||||
CONFIG_FEATURE_USE_INITTAB=y
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
CONFIG_MDEV=y
|
||||
CONFIG_FEATURE_MDEV_CONF=y
|
||||
CONFIG_FEATURE_MDEV_RENAME=y
|
||||
CONFIG_FEATURE_MDEV_RENAME_REGEXP=y
|
||||
CONFIG_FEATURE_MDEV_EXEC=y
|
||||
CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y
|
||||
|
||||
CONFIG_SETSID=y
|
||||
CONFIG_CTTYHACK=y
|
||||
|
||||
CONFIG_FEATURE_SHADOWPASSWDS=y
|
|
@ -39,6 +39,12 @@ SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
|
|||
file://sha256sum.cfg \
|
||||
file://getopts.cfg \
|
||||
file://resize.cfg \
|
||||
${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'busybox')]} \
|
||||
${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager', True) == 'busybox-mdev')]} \
|
||||
file://inittab \
|
||||
file://rcS \
|
||||
file://rcK \
|
||||
file://runlevel \
|
||||
"
|
||||
SRC_URI_append_libc-musl = " file://musl.cfg "
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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"
|
||||
|
Loading…
Reference in New Issue