Patchwork [11/32] sysvinit-inittab_2.88dsf.bb: Allow multiple serial port consoles to be defined

login
register
mail settings
Submitter Scott Garman
Date Aug. 13, 2012, 9:14 p.m.
Message ID <2e7dddfce4a40a56f671116a2001b13c57667c70.1344892361.git.scott.a.garman@intel.com>
Download mbox | patch
Permalink /patch/34405/
State New
Headers show

Comments

Scott Garman - Aug. 13, 2012, 9:14 p.m.
From: Matthew McClintock <msm@freescale.com>

Set SERIAL_CONSOLES if you want to define multiple serial consoles, also if
you need to check for the presence of the serial consoles you can also define
SERIAL_CONSOLES_CHECK to determine if these are present when you boot. This
will prevent error message that pop up when the serial port is not present.

SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1 115200;ttyEHV0"
SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}"

The above lines in machine.conf or elsewhere will have the effect of having
two serial consoles and removing any that are not present at boot

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../sysvinit/sysvinit-inittab_2.88dsf.bb           |   22 ++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
Phil Blundell - Sept. 8, 2012, 9:21 p.m.
On Mon, 2012-08-13 at 14:14 -0700, Scott Garman wrote:
> +pkg_postinst_${PN} () {
> +# run this on the target
> +if [ "x$D" == "x" ]; then
> +	tmp="${SERIAL_CONSOLES_CHECK}"
> +	for i in $tmp
> +	do
> +		j=`echo ${i} | sed s/^.*\;//g`
> +		if [ -z "`cat /proc/consoles | grep ${j}`" ]; then
> +			sed -i /^.*${j}$/d /etc/inittab
> +		fi
> +	done
> +	kill -HUP 1
> +else
> +	exit 1
> +fi
> +}

This makes the package uninstallable, even if SERIAL_CONSOLES_CHECK is
empty, on a READ_ONLY_ROOTFS.

p.
McClintock Matthew-B29882 - Sept. 10, 2012, 4:56 p.m.
On Sat, Sep 8, 2012 at 4:21 PM, Phil Blundell <philb@gnu.org> wrote:
> On Mon, 2012-08-13 at 14:14 -0700, Scott Garman wrote:
>> +pkg_postinst_${PN} () {
>> +# run this on the target
>> +if [ "x$D" == "x" ]; then
>> +     tmp="${SERIAL_CONSOLES_CHECK}"
>> +     for i in $tmp
>> +     do
>> +             j=`echo ${i} | sed s/^.*\;//g`
>> +             if [ -z "`cat /proc/consoles | grep ${j}`" ]; then
>> +                     sed -i /^.*${j}$/d /etc/inittab
>> +             fi
>> +     done
>> +     kill -HUP 1
>> +else
>> +     exit 1
>> +fi
>> +}
>
> This makes the package uninstallable, even if SERIAL_CONSOLES_CHECK is
> empty, on a READ_ONLY_ROOTFS.

What do you mean uninstallable? I could see this generating an error
message at each boot, but not sure what you mean about uninstallable.

-M
Phil Blundell - Sept. 10, 2012, 4:59 p.m.
On Mon, 2012-09-10 at 16:56 +0000, McClintock Matthew-B29882 wrote:
> On Sat, Sep 8, 2012 at 4:21 PM, Phil Blundell <philb@gnu.org> wrote:
> > On Mon, 2012-08-13 at 14:14 -0700, Scott Garman wrote:
> >> +pkg_postinst_${PN} () {
> >> +# run this on the target
> >> +if [ "x$D" == "x" ]; then
> >> +     tmp="${SERIAL_CONSOLES_CHECK}"
> >> +     for i in $tmp
> >> +     do
> >> +             j=`echo ${i} | sed s/^.*\;//g`
> >> +             if [ -z "`cat /proc/consoles | grep ${j}`" ]; then
> >> +                     sed -i /^.*${j}$/d /etc/inittab
> >> +             fi
> >> +     done
> >> +     kill -HUP 1
> >> +else
> >> +     exit 1
> >> +fi
> >> +}
> >
> > This makes the package uninstallable, even if SERIAL_CONSOLES_CHECK is
> > empty, on a READ_ONLY_ROOTFS.
> 
> What do you mean uninstallable? I could see this generating an error
> message at each boot, but not sure what you mean about uninstallable.

rootfs_ipk will refuse to generate a rootfs containing unconfigured
packages if IMAGE_FEATURES says that it should be read-only.

p.
Phil Blundell - Sept. 11, 2012, 11:49 a.m.
On Mon, 2012-08-13 at 14:14 -0700, Scott Garman wrote:
> +pkg_postinst_${PN} () {
> +# run this on the target
> +if [ "x$D" == "x" ]; then

By the way, "==" is a bashism; that should just be "=" for portability.
Or you can use '-z "$D"' which is also portable.

p.
McClintock Matthew-B29882 - Sept. 11, 2012, 4:24 p.m.
On Tue, Sep 11, 2012 at 6:49 AM, Phil Blundell <philb@gnu.org> wrote:
> On Mon, 2012-08-13 at 14:14 -0700, Scott Garman wrote:
>> +pkg_postinst_${PN} () {
>> +# run this on the target
>> +if [ "x$D" == "x" ]; then
>
> By the way, "==" is a bashism; that should just be "=" for portability.
> Or you can use '-z "$D"' which is also portable.

Ok - will send a v3 shortly.

-M

>
> p.
>
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
index 9bd087c..1089edb 100644
--- a/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
+++ b/meta/recipes-core/sysvinit/sysvinit-inittab_2.88dsf.bb
@@ -2,7 +2,7 @@  DESCRIPTION = "Inittab for sysvinit"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
 
-PR = "r6"
+PR = "r7"
 
 SRC_URI = "file://inittab"
 
@@ -26,7 +26,8 @@  do_install() {
     for i in $tmp
     do
 	j=`echo ${i} | sed s/\;/\ /g`
-        echo "${idx}:2345:respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
+	echo "${idx}:12345:respawn:${base_sbindir}/getty ${j}" >> ${D}${sysconfdir}/inittab
+
 	idx=`expr $idx + 1`
     done
 
@@ -51,6 +52,23 @@  EOF
     fi
 }
 
+pkg_postinst_${PN} () {
+# run this on the target
+if [ "x$D" == "x" ]; then
+	tmp="${SERIAL_CONSOLES_CHECK}"
+	for i in $tmp
+	do
+		j=`echo ${i} | sed s/^.*\;//g`
+		if [ -z "`cat /proc/consoles | grep ${j}`" ]; then
+			sed -i /^.*${j}$/d /etc/inittab
+		fi
+	done
+	kill -HUP 1
+else
+	exit 1
+fi
+}
+
 # USE_VT and SERIAL_CONSOLE are generally defined by the MACHINE .conf.
 # Set PACKAGE_ARCH appropriately.
 PACKAGE_ARCH = "${MACHINE_ARCH}"