<p dir="ltr">We have lsb compliant scripts unlike buildroot. Ditto wont work here</p>
<div class="gmail_quote">On Jan 25, 2016 12:39 PM, "Andre McCurdy" <<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Jan 22, 2016 at 12:49 PM, Khem Raj <<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>> wrote:<br>
> in config metadata we can configure busybox based init and device<br>
> initializer ( mdev ) using e.g.<br>
><br>
> VIRTUAL-RUNTIME_dev_manager = "busybox-mdev"<br>
> VIRTUAL-RUNTIME_login_manager = "busybox"<br>
> VIRTUAL-RUNTIME_init_manager = "busybox"<br>
> VIRTUAL-RUNTIME_initscripts = "initscripts"<br>
> VIRTUAL-RUNTIME_keymaps = "keymaps"<br>
> DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"<br>
><br>
> busybox can be used to provide init system<br>
> combined with mdev it makes it a complete init<br>
> system for really tiny systems.<br>
><br>
> This patch uses above defines to configure features in busybox to enable<br>
> the init system and mdev in a configurable manner<br>
><br>
> Signed-off-by: Khem Raj <<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>><br>
> ---<br>
> meta/recipes-core/busybox/busybox.inc | 15 +++++++++++++++<br>
> meta/recipes-core/busybox/busybox/init.cfg | 3 +++<br>
> meta/recipes-core/busybox/busybox/mdev.cfg | 11 +++++++++++<br>
> meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a> | 6 ++++++<br>
> meta/recipes-core/busybox/files/inittab | 24 ++++++++++++++++++++++++<br>
> meta/recipes-core/busybox/files/rcK | 25 +++++++++++++++++++++++++<br>
> meta/recipes-core/busybox/files/rcS | 26 ++++++++++++++++++++++++++<br>
> meta/recipes-core/busybox/files/runlevel | 11 +++++++++++<br>
> 8 files changed, 121 insertions(+)<br>
> create mode 100644 meta/recipes-core/busybox/busybox/init.cfg<br>
> create mode 100644 meta/recipes-core/busybox/busybox/mdev.cfg<br>
> create mode 100644 meta/recipes-core/busybox/files/inittab<br>
> create mode 100644 meta/recipes-core/busybox/files/rcK<br>
> create mode 100644 meta/recipes-core/busybox/files/rcS<br>
> create mode 100644 meta/recipes-core/busybox/files/runlevel<br>
><br>
> diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc<br>
> index 9541123..e5710f0 100644<br>
> --- a/meta/recipes-core/busybox/busybox.inc<br>
> +++ b/meta/recipes-core/busybox/busybox.inc<br>
> @@ -275,6 +275,21 @@ do_install () {<br>
> install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev<br>
> fi<br>
> fi<br>
> + if grep "CONFIG_INIT=y" ${B}/.config; then<br>
> + install -D -m 0777 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS<br>
> + install -D -m 0777 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK<br>
> + install -D -m 0755 ${WORKDIR}/runlevel ${D}${base_sbindir}/runlevel<br>
> + if grep "CONFIG_FEATURE_USE_INITTAB=y" ${B}/.config; then<br>
> + install -D -m 0777 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab<br>
> + tmp="${SERIAL_CONSOLES}"<br>
> + for i in $tmp<br>
> + do<br>
> + j=`echo ${i} | sed s/\;/\ /g`<br>
> + label=`echo ${i} | sed -e 's/tty//' -e 's/^.*;//' -e 's/;.*//'`<br>
> + echo "tty$label::respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab<br>
> + done<br>
> + fi<br>
> + fi<br>
><br>
> if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then<br>
> if grep -q "CONFIG_SYSLOGD=y" ${B}/.config; then<br>
> diff --git a/meta/recipes-core/busybox/busybox/init.cfg b/meta/recipes-core/busybox/busybox/init.cfg<br>
> new file mode 100644<br>
> index 0000000..006d4c6<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/busybox/busybox/init.cfg<br>
> @@ -0,0 +1,3 @@<br>
> +CONFIG_INIT=y<br>
> +CONFIG_FEATURE_USE_INITTAB=y<br>
> +<br>
> diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg<br>
> new file mode 100644<br>
> index 0000000..6aefe90<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/busybox/busybox/mdev.cfg<br>
> @@ -0,0 +1,11 @@<br>
> +CONFIG_MDEV=y<br>
> +CONFIG_FEATURE_MDEV_CONF=y<br>
> +CONFIG_FEATURE_MDEV_RENAME=y<br>
> +CONFIG_FEATURE_MDEV_RENAME_REGEXP=y<br>
> +CONFIG_FEATURE_MDEV_EXEC=y<br>
> +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y<br>
> +<br>
> +CONFIG_SETSID=y<br>
> +CONFIG_CTTYHACK=y<br>
> +<br>
> +CONFIG_FEATURE_SHADOWPASSWDS=y<br>
> diff --git a/meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a> b/meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a><br>
> index 5e19d9c..8adee53 100644<br>
> --- a/meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a><br>
> +++ b/meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a><br>
> @@ -39,6 +39,12 @@ SRC_URI = "<a href="http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball" rel="noreferrer" target="_blank">http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball</a> \<br>
> file://sha256sum.cfg \<br>
> file://getopts.cfg \<br>
> file://resize.cfg \<br>
> + ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'busybox')]} \<br>
> + ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager', True) == 'busybox-mdev')]} \<br>
> + file://inittab \<br>
> + file://rcS \<br>
> + file://rcK \<br>
> + file://runlevel \<br>
> "<br>
> SRC_URI_append_libc-musl = " file://musl.cfg "<br>
><br>
> diff --git a/meta/recipes-core/busybox/files/inittab b/meta/recipes-core/busybox/files/inittab<br>
> new file mode 100644<br>
> index 0000000..bfec4a7<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/busybox/files/inittab<br>
> @@ -0,0 +1,24 @@<br>
> +# This is run first except when booting in single-user mode.<br>
> +<br>
> +# Startup the system<br>
> +null::sysinit:/bin/mount -t proc proc /proc<br>
> +null::sysinit:/bin/mount -t sysfs sysfs /sys<br>
> +null::sysinit:/bin/mount -t devtmpfs devtmpfs /dev<br>
> +null::sysinit:/bin/mount -o remount,rw /<br>
> +null::sysinit:/bin/mkdir -p /dev/pts<br>
> +null::sysinit:/bin/mount -t devpts devpts /dev/pts<br>
> +null::sysinit:/bin/mount -a<br>
> +<br>
> +::sysinit:/etc/init.d/rcS<br>
> +<br>
> +# Stuff to do before rebooting<br>
> +::ctrlaltdel:/sbin/reboot<br>
> +::shutdown:/etc/init.d/rcK<br>
> +::shutdown:/sbin/swapoff -a<br>
> +::shutdown:/bin/umount -a -r<br>
> +<br>
> +# Stuff to do when restarting the init process<br>
> +::restart:/sbin/init<br>
> +<br>
> +# set hostname<br>
> +null::sysinit:/bin/busybox hostname -F /etc/hostname<br>
> diff --git a/meta/recipes-core/busybox/files/rcK b/meta/recipes-core/busybox/files/rcK<br>
> new file mode 100644<br>
> index 0000000..050086e<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/busybox/files/rcK<br>
> @@ -0,0 +1,25 @@<br>
> +#!/bin/sh<br>
> +<br>
> +# Stop all init scripts in /etc/init.d<br>
> +# executing them in reversed numerical order.<br>
> +#<br>
> +for i in /etc/rc6.d/K??*; do<br>
<br>
Running the K?? scripts here is different to the way the Buildroot<br>
initscipts work. It's also not clear how the order is going to be<br>
reversed?<br>
<br>
Maybe try to work with the Buildroot version as-is, or add some<br>
comments to the commit message explaining why the OE and Buildroot<br>
versions need to differ.<br>
<br>
<a href="https://git.busybox.net/buildroot/tree/package/initscripts/init.d/rcK" rel="noreferrer" target="_blank">https://git.busybox.net/buildroot/tree/package/initscripts/init.d/rcK</a><br>
<br>
> + # Ignore dangling symlinks (if any).<br>
> + [ ! -f "$i" ] && continue<br>
> +<br>
> + case "$i" in<br>
> + *.sh)<br>
> + # Source shell script for speed.<br>
> + (<br>
> + trap - INT QUIT TSTP<br>
> + set stop<br>
> + . $i<br>
> + )<br>
> + ;;<br>
> + *)<br>
> + # No sh extension, so fork subprocess.<br>
> + $i stop<br>
> + ;;<br>
> + esac<br>
> +done<br>
> +<br>
> diff --git a/meta/recipes-core/busybox/files/rcS b/meta/recipes-core/busybox/files/rcS<br>
> new file mode 100644<br>
> index 0000000..d18c26b<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/busybox/files/rcS<br>
> @@ -0,0 +1,26 @@<br>
> +#!/bin/sh<br>
> +<br>
> +# Stop all init scripts in /etc/init.d<br>
> +# executing them in reversed numerical order.<br>
<br>
This is a copy of the comment from rcK.<br>
<br>
> +<br>
> +for i in /etc/rcS.d/S??* /etc/rc5.d/S??* ;do<br>
> + # Ignore dangling symlinks (if any).<br>
> + [ ! -f "$i" ] && continue<br>
> +<br>
> + case "$i" in<br>
> + *.sh)<br>
> + # Source shell script for speed.<br>
> + (<br>
> + trap - INT QUIT TSTP<br>
> + set stop<br>
<br>
Should that be start? The Buildroot original is:<br>
<br>
<a href="https://git.busybox.net/buildroot/tree/package/initscripts/init.d/rcS" rel="noreferrer" target="_blank">https://git.busybox.net/buildroot/tree/package/initscripts/init.d/rcS</a><br>
<br>
> + . $i<br>
> + )<br>
> + ;;<br>
> + *)<br>
> + # No sh extension, so fork subprocess.<br>
> + $i start<br>
> + ;;<br>
> + esac<br>
> +done<br>
> +<br>
> diff --git a/meta/recipes-core/busybox/files/runlevel b/meta/recipes-core/busybox/files/runlevel<br>
> new file mode 100644<br>
> index 0000000..866f3b5<br>
> --- /dev/null<br>
> +++ b/meta/recipes-core/busybox/files/runlevel<br>
> @@ -0,0 +1,11 @@<br>
> +#!/bin/sh<br>
> +# busybox init does not have LSB ( sysvinit ) like initlevels<br>
> +# so lets fake it to 5 which is what we default anyway<br>
> +# this helps with opkg post installs where it tries to invoke<br>
> +# update-rc.d ad post install step.<br>
> +# for package upgrades<br>
> +# See code in update-rc.d around line 190 where it calls runlevel<br>
> +# program<br>
> +#<br>
> +echo "5"<br>
> +<br>
> --<br>
> 2.7.0<br>
><br>
> --<br>
> _______________________________________________<br>
> Openembedded-core mailing list<br>
> <a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a><br>
> <a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/mailman/listinfo/openembedded-core</a><br>
</blockquote></div>