<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, &quot;Andre McCurdy&quot; &lt;<a href="mailto:armccurdy@gmail.com">armccurdy@gmail.com</a>&gt; 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 &lt;<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>&gt; wrote:<br>
&gt; in config metadata we can configure busybox based init and device<br>
&gt; initializer ( mdev ) using e.g.<br>
&gt;<br>
&gt; VIRTUAL-RUNTIME_dev_manager = &quot;busybox-mdev&quot;<br>
&gt; VIRTUAL-RUNTIME_login_manager = &quot;busybox&quot;<br>
&gt; VIRTUAL-RUNTIME_init_manager = &quot;busybox&quot;<br>
&gt; VIRTUAL-RUNTIME_initscripts = &quot;initscripts&quot;<br>
&gt; VIRTUAL-RUNTIME_keymaps = &quot;keymaps&quot;<br>
&gt; DISTRO_FEATURES_BACKFILL_CONSIDERED += &quot;sysvinit&quot;<br>
&gt;<br>
&gt; busybox can be used to provide init system<br>
&gt; combined with mdev it makes it a complete init<br>
&gt; system for really tiny systems.<br>
&gt;<br>
&gt; This patch uses above defines to configure features in busybox to enable<br>
&gt; the init system and mdev in a configurable manner<br>
&gt;<br>
&gt; Signed-off-by: Khem Raj &lt;<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  meta/recipes-core/busybox/busybox.inc       | 15 +++++++++++++++<br>
&gt;  meta/recipes-core/busybox/busybox/init.cfg  |  3 +++<br>
&gt;  meta/recipes-core/busybox/busybox/mdev.cfg  | 11 +++++++++++<br>
&gt;  meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a> |  6 ++++++<br>
&gt;  meta/recipes-core/busybox/files/inittab     | 24 ++++++++++++++++++++++++<br>
&gt;  meta/recipes-core/busybox/files/rcK         | 25 +++++++++++++++++++++++++<br>
&gt;  meta/recipes-core/busybox/files/rcS         | 26 ++++++++++++++++++++++++++<br>
&gt;  meta/recipes-core/busybox/files/runlevel    | 11 +++++++++++<br>
&gt;  8 files changed, 121 insertions(+)<br>
&gt;  create mode 100644 meta/recipes-core/busybox/busybox/init.cfg<br>
&gt;  create mode 100644 meta/recipes-core/busybox/busybox/mdev.cfg<br>
&gt;  create mode 100644 meta/recipes-core/busybox/files/inittab<br>
&gt;  create mode 100644 meta/recipes-core/busybox/files/rcK<br>
&gt;  create mode 100644 meta/recipes-core/busybox/files/rcS<br>
&gt;  create mode 100644 meta/recipes-core/busybox/files/runlevel<br>
&gt;<br>
&gt; diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc<br>
&gt; index 9541123..e5710f0 100644<br>
&gt; --- a/meta/recipes-core/busybox/busybox.inc<br>
&gt; +++ b/meta/recipes-core/busybox/busybox.inc<br>
&gt; @@ -275,6 +275,21 @@ do_install () {<br>
&gt;                         install -m 0755 ${WORKDIR}/mdev-mount.sh ${D}${sysconfdir}/mdev<br>
&gt;                 fi<br>
&gt;         fi<br>
&gt; +        if grep &quot;CONFIG_INIT=y&quot; ${B}/.config; then<br>
&gt; +                install -D -m 0777 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS<br>
&gt; +                install -D -m 0777 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK<br>
&gt; +                install -D -m 0755 ${WORKDIR}/runlevel ${D}${base_sbindir}/runlevel<br>
&gt; +                if grep &quot;CONFIG_FEATURE_USE_INITTAB=y&quot; ${B}/.config; then<br>
&gt; +                        install -D -m 0777 ${WORKDIR}/inittab ${D}${sysconfdir}/inittab<br>
&gt; +                        tmp=&quot;${SERIAL_CONSOLES}&quot;<br>
&gt; +                        for i in $tmp<br>
&gt; +                        do<br>
&gt; +                                j=`echo ${i} | sed s/\;/\ /g`<br>
&gt; +                                label=`echo ${i} | sed -e &#39;s/tty//&#39; -e &#39;s/^.*;//&#39; -e &#39;s/;.*//&#39;`<br>
&gt; +                                echo &quot;tty$label::respawn:${base_sbindir}/getty ${j}&quot; &gt;&gt; ${D}${sysconfdir}/inittab<br>
&gt; +                        done<br>
&gt; +                fi<br>
&gt; +        fi<br>
&gt;<br>
&gt;      if ${@bb.utils.contains(&#39;DISTRO_FEATURES&#39;,&#39;systemd&#39;,&#39;true&#39;,&#39;false&#39;,d)}; then<br>
&gt;          if grep -q &quot;CONFIG_SYSLOGD=y&quot; ${B}/.config; then<br>
&gt; diff --git a/meta/recipes-core/busybox/busybox/init.cfg b/meta/recipes-core/busybox/busybox/init.cfg<br>
&gt; new file mode 100644<br>
&gt; index 0000000..006d4c6<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-core/busybox/busybox/init.cfg<br>
&gt; @@ -0,0 +1,3 @@<br>
&gt; +CONFIG_INIT=y<br>
&gt; +CONFIG_FEATURE_USE_INITTAB=y<br>
&gt; +<br>
&gt; diff --git a/meta/recipes-core/busybox/busybox/mdev.cfg b/meta/recipes-core/busybox/busybox/mdev.cfg<br>
&gt; new file mode 100644<br>
&gt; index 0000000..6aefe90<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-core/busybox/busybox/mdev.cfg<br>
&gt; @@ -0,0 +1,11 @@<br>
&gt; +CONFIG_MDEV=y<br>
&gt; +CONFIG_FEATURE_MDEV_CONF=y<br>
&gt; +CONFIG_FEATURE_MDEV_RENAME=y<br>
&gt; +CONFIG_FEATURE_MDEV_RENAME_REGEXP=y<br>
&gt; +CONFIG_FEATURE_MDEV_EXEC=y<br>
&gt; +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y<br>
&gt; +<br>
&gt; +CONFIG_SETSID=y<br>
&gt; +CONFIG_CTTYHACK=y<br>
&gt; +<br>
&gt; +CONFIG_FEATURE_SHADOWPASSWDS=y<br>
&gt; 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>
&gt; index 5e19d9c..8adee53 100644<br>
&gt; --- a/meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a><br>
&gt; +++ b/meta/recipes-core/busybox/<a href="http://busybox_1.24.1.bb" rel="noreferrer" target="_blank">busybox_1.24.1.bb</a><br>
&gt; @@ -39,6 +39,12 @@ SRC_URI = &quot;<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>
&gt;             file://sha256sum.cfg \<br>
&gt;             file://getopts.cfg \<br>
&gt;             file://resize.cfg \<br>
&gt; +           ${@[&quot;&quot;, &quot;file://init.cfg&quot;][(d.getVar(&#39;VIRTUAL-RUNTIME_init_manager&#39;, True) == &#39;busybox&#39;)]} \<br>
&gt; +           ${@[&quot;&quot;, &quot;file://mdev.cfg&quot;][(d.getVar(&#39;VIRTUAL-RUNTIME_dev_manager&#39;, True) == &#39;busybox-mdev&#39;)]} \<br>
&gt; +           file://inittab \<br>
&gt; +           file://rcS \<br>
&gt; +           file://rcK \<br>
&gt; +           file://runlevel \<br>
&gt;  &quot;<br>
&gt;  SRC_URI_append_libc-musl = &quot; file://musl.cfg &quot;<br>
&gt;<br>
&gt; diff --git a/meta/recipes-core/busybox/files/inittab b/meta/recipes-core/busybox/files/inittab<br>
&gt; new file mode 100644<br>
&gt; index 0000000..bfec4a7<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-core/busybox/files/inittab<br>
&gt; @@ -0,0 +1,24 @@<br>
&gt; +# This is run first except when booting in single-user mode.<br>
&gt; +<br>
&gt; +# Startup the system<br>
&gt; +null::sysinit:/bin/mount -t proc proc /proc<br>
&gt; +null::sysinit:/bin/mount -t sysfs sysfs /sys<br>
&gt; +null::sysinit:/bin/mount -t devtmpfs devtmpfs /dev<br>
&gt; +null::sysinit:/bin/mount -o remount,rw /<br>
&gt; +null::sysinit:/bin/mkdir -p /dev/pts<br>
&gt; +null::sysinit:/bin/mount -t devpts devpts /dev/pts<br>
&gt; +null::sysinit:/bin/mount -a<br>
&gt; +<br>
&gt; +::sysinit:/etc/init.d/rcS<br>
&gt; +<br>
&gt; +# Stuff to do before rebooting<br>
&gt; +::ctrlaltdel:/sbin/reboot<br>
&gt; +::shutdown:/etc/init.d/rcK<br>
&gt; +::shutdown:/sbin/swapoff -a<br>
&gt; +::shutdown:/bin/umount -a -r<br>
&gt; +<br>
&gt; +# Stuff to do when restarting the init process<br>
&gt; +::restart:/sbin/init<br>
&gt; +<br>
&gt; +# set hostname<br>
&gt; +null::sysinit:/bin/busybox hostname -F /etc/hostname<br>
&gt; diff --git a/meta/recipes-core/busybox/files/rcK b/meta/recipes-core/busybox/files/rcK<br>
&gt; new file mode 100644<br>
&gt; index 0000000..050086e<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-core/busybox/files/rcK<br>
&gt; @@ -0,0 +1,25 @@<br>
&gt; +#!/bin/sh<br>
&gt; +<br>
&gt; +# Stop all init scripts in /etc/init.d<br>
&gt; +# executing them in reversed numerical order.<br>
&gt; +#<br>
&gt; +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&#39;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>
&gt; +     # Ignore dangling symlinks (if any).<br>
&gt; +     [ ! -f &quot;$i&quot; ] &amp;&amp; continue<br>
&gt; +<br>
&gt; +     case &quot;$i&quot; in<br>
&gt; +       *.sh)<br>
&gt; +           # Source shell script for speed.<br>
&gt; +           (<br>
&gt; +               trap - INT QUIT TSTP<br>
&gt; +               set stop<br>
&gt; +               . $i<br>
&gt; +           )<br>
&gt; +           ;;<br>
&gt; +       *)<br>
&gt; +           # No sh extension, so fork subprocess.<br>
&gt; +           $i stop<br>
&gt; +           ;;<br>
&gt; +    esac<br>
&gt; +done<br>
&gt; +<br>
&gt; diff --git a/meta/recipes-core/busybox/files/rcS b/meta/recipes-core/busybox/files/rcS<br>
&gt; new file mode 100644<br>
&gt; index 0000000..d18c26b<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-core/busybox/files/rcS<br>
&gt; @@ -0,0 +1,26 @@<br>
&gt; +#!/bin/sh<br>
&gt; +<br>
&gt; +# Stop all init scripts in /etc/init.d<br>
&gt; +# executing them in reversed numerical order.<br>
<br>
This is a copy of the comment from rcK.<br>
<br>
&gt; +<br>
&gt; +for i in /etc/rcS.d/S??* /etc/rc5.d/S??* ;do<br>
&gt; +     # Ignore dangling symlinks (if any).<br>
&gt; +     [ ! -f &quot;$i&quot; ] &amp;&amp; continue<br>
&gt; +<br>
&gt; +     case &quot;$i&quot; in<br>
&gt; +       *.sh)<br>
&gt; +           # Source shell script for speed.<br>
&gt; +           (<br>
&gt; +               trap - INT QUIT TSTP<br>
&gt; +               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>
&gt; +               . $i<br>
&gt; +           )<br>
&gt; +           ;;<br>
&gt; +       *)<br>
&gt; +           # No sh extension, so fork subprocess.<br>
&gt; +           $i start<br>
&gt; +           ;;<br>
&gt; +    esac<br>
&gt; +done<br>
&gt; +<br>
&gt; diff --git a/meta/recipes-core/busybox/files/runlevel b/meta/recipes-core/busybox/files/runlevel<br>
&gt; new file mode 100644<br>
&gt; index 0000000..866f3b5<br>
&gt; --- /dev/null<br>
&gt; +++ b/meta/recipes-core/busybox/files/runlevel<br>
&gt; @@ -0,0 +1,11 @@<br>
&gt; +#!/bin/sh<br>
&gt; +# busybox init does not have LSB ( sysvinit ) like initlevels<br>
&gt; +# so lets fake it to 5 which is what we default anyway<br>
&gt; +# this helps with opkg post installs where it tries to invoke<br>
&gt; +# update-rc.d ad post install step.<br>
&gt; +# for package upgrades<br>
&gt; +# See code in update-rc.d around line 190 where it calls runlevel<br>
&gt; +# program<br>
&gt; +#<br>
&gt; +echo &quot;5&quot;<br>
&gt; +<br>
&gt; --<br>
&gt; 2.7.0<br>
&gt;<br>
&gt; --<br>
&gt; _______________________________________________<br>
&gt; Openembedded-core mailing list<br>
&gt; <a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.openembedded.org</a><br>
&gt; <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>