Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] add support for virtual terminal
@ 2011-11-07 11:47 Yegor Yefremov
  2011-11-07 22:39 ` Peter Korsgaard
  0 siblings, 1 reply; 6+ messages in thread
From: Yegor Yefremov @ 2011-11-07 11:47 UTC (permalink / raw)
  To: buildroot

introduces new option "Enable virtual console on tty1"
to enable virtual terminal on tty1

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
Changes:
v2: corrected the patch according to Baruch's comments

 fs/skeleton/etc/inittab    |    3 +++
 target/generic/Config.in   |    3 +++
 target/generic/Makefile.in |   16 ++++++++++++++++
 3 files changed, 22 insertions(+)

Index: b/fs/skeleton/etc/inittab
===================================================================
--- a/fs/skeleton/etc/inittab
+++ b/fs/skeleton/etc/inittab
@@ -23,6 +23,9 @@
 # now run any rc scripts
 ::sysinit:/etc/init.d/rcS
 
+# Put a getty on a virtual terminal
+#tty1::respawn:/sbin/getty tty1 38400 # GENERIC_VT
+
 # Put a getty on the serial port
 #ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
 
Index: b/target/generic/Config.in
===================================================================
--- a/target/generic/Config.in
+++ b/target/generic/Config.in
@@ -116,6 +116,9 @@
 	default "57600"		if BR2_TARGET_GENERIC_GETTY_BAUDRATE_57600
 	default "115200"	if BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200
 
+config BR2_TARGET_GENERIC_TTY_PORT
+	bool "Enable virtual console on tty1"
+
 config BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW
 	bool "remount root filesystem read-write during boot"
 	default y
Index: b/target/generic/Makefile.in
===================================================================
--- a/target/generic/Makefile.in
+++ b/target/generic/Makefile.in
@@ -23,6 +23,16 @@
 	$(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(TARGET_GENERIC_GETTY) | tail -c+4)::respawn:/sbin/getty -L $(TARGET_GENERIC_GETTY) $(TARGET_GENERIC_GETTY_BAUDRATE) vt100 #~' \
 		$(TARGET_DIR)/etc/inittab
 
+# Put a getty on virtual terminal
+target-generic-do-getty-tty1:
+	#$(SED) 's/#tty1/tty1/' $(TARGET_DIR)/etc/inittab
+	$(SED) '/^#.*# GENERIC_VT$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
+
+# Don't put a getty on virtual terminal
+target-generic-dont-getty-tty1:
+	#$(SED) 's/tty1/#tty1/' $(TARGET_DIR)/etc/inittab
+	$(SED) '/^[^#].*# GENERIC_VT$$/s~^~#~' $(TARGET_DIR)/etc/inittab
+
 # Find commented line, if any, and remove leading '#'s
 target-generic-do-remount-rw:
 	$(SED) '/^#.*# REMOUNT_ROOTFS_RW$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
@@ -39,6 +49,12 @@
 TARGETS += target-generic-issue
 endif
 
+ifeq ($(BR2_TARGET_GENERIC_TTY_PORT),y)
+TARGETS += target-generic-do-getty-tty1
+else
+TARGETS += target-generic-dont-getty-tty1
+endif
+
 ifeq ($(BR2_ROOTFS_SKELETON_DEFAULT),y)
 ifeq ($(BR2_PACKAGE_SYSVINIT),y)
 TARGETS += target-generic-getty-sysvinit

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2] add support for virtual terminal
  2011-11-07 11:47 [Buildroot] [PATCH v2] add support for virtual terminal Yegor Yefremov
@ 2011-11-07 22:39 ` Peter Korsgaard
  2011-11-08  7:49   ` Yegor Yefremov
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2011-11-07 22:39 UTC (permalink / raw)
  To: buildroot

>>>>> "Yegor" == Yegor Yefremov <yegor_sub1@visionsystems.de> writes:

 Yegor> introduces new option "Enable virtual console on tty1"
 Yegor> to enable virtual terminal on tty1

I'm not sure I like another option for this - Can't you just use the
existing GENERIC_SERIAL and/or the post-build script for this?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2] add support for virtual terminal
  2011-11-07 22:39 ` Peter Korsgaard
@ 2011-11-08  7:49   ` Yegor Yefremov
  2011-11-08  9:28     ` Thomas Petazzoni
  2011-11-08  9:35     ` Peter Korsgaard
  0 siblings, 2 replies; 6+ messages in thread
From: Yegor Yefremov @ 2011-11-08  7:49 UTC (permalink / raw)
  To: buildroot

Am 07.11.2011 23:39, schrieb Peter Korsgaard:
>>>>>> "Yegor" == Yegor Yefremov <yegor_sub1@visionsystems.de> writes:
>  Yegor> introduces new option "Enable virtual console on tty1"
>  Yegor> to enable virtual terminal on tty1
>
> I'm not sure I like another option for this - Can't you just use the
> existing GENERIC_SERIAL and/or the post-build script for this?

I'd like to have both serial console and virtual one (on tty I experiment with my program and vie serial console I can do other administrative tasks. One could use ssh, but this implies having network connection). Every time I execute make clean or clone BR I loose my inittab. Earlier versions of inittab had some ttys predefined, but they were deleted, so I thought, it would be useful to add this as an option. This way everyone should be satisfied.

Yegor

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2] add support for virtual terminal
  2011-11-08  7:49   ` Yegor Yefremov
@ 2011-11-08  9:28     ` Thomas Petazzoni
  2011-11-08  9:35     ` Peter Korsgaard
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2011-11-08  9:28 UTC (permalink / raw)
  To: buildroot

Le Tue, 08 Nov 2011 08:49:10 +0100,
Yegor Yefremov <yegor_sub1@visionsystems.de> a ?crit :

> I'd like to have both serial console and virtual one (on tty I
> experiment with my program and vie serial console I can do other
> administrative tasks. One could use ssh, but this implies having
> network connection). Every time I execute make clean or clone BR I
> loose my inittab. Earlier versions of inittab had some ttys
> predefined, but they were deleted, so I thought, it would be useful
> to add this as an option. This way everyone should be satisfied.

Just use a post-build script to customize your inittab. Something like:

BR2_ROOTFS_POST_BUILD_SCRIPT="board/yegor_company/yegor_project/post-build.sh"

with board/yegor_company/yegor_project/post-build.sh containing:

---------------8<------------------
#!/bin/sh

TARGET_DIR=$1

grep -q "^tty1::respawn:" $TARGET_DIR/etc/inittab || \
	echo "tty1::respawn:/sbin/getty tty1 38400" >> $TARGET_DIR/etc/inittab
---------------8<------------------

And there you are. If you don't like that, you can also just copy the
fs/skeleton/etc/inittab into board/yegor_company/yegor_project/ and
have the post-build.sh script do something like:

---------------8<------------------
#!/bin/sh

TARGET_DIR=$1
BOARD_DIR=board/yegor_company/yegor_project/

cp $BOARD_DIR/inittab $TARGET_DIR/etc/inittab
---------------8<------------------

And there you are.

Regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2] add support for virtual terminal
  2011-11-08  7:49   ` Yegor Yefremov
  2011-11-08  9:28     ` Thomas Petazzoni
@ 2011-11-08  9:35     ` Peter Korsgaard
  2011-11-08  9:41       ` Yegor Yefremov
  1 sibling, 1 reply; 6+ messages in thread
From: Peter Korsgaard @ 2011-11-08  9:35 UTC (permalink / raw)
  To: buildroot

>>>>> "Yegor" == Yegor Yefremov <yegor_sub1@visionsystems.de> writes:

Hi,

 >> I'm not sure I like another option for this - Can't you just use the
 >> existing GENERIC_SERIAL and/or the post-build script for this?

 Yegor> I'd like to have both serial console and virtual one (on tty I
 Yegor> experiment with my program and vie serial console I can do other
 Yegor> administrative tasks. One could use ssh, but this implies having
 Yegor> network connection). Every time I execute make clean or clone BR
 Yegor> I loose my inittab. Earlier versions of inittab had some ttys
 Yegor> predefined, but they were deleted, so I thought, it would be
 Yegor> useful to add this as an option. This way everyone should be
 Yegor> satisfied.

.. until someone wants a getty on tty2 or tty3 or so on. We need to keep
serial config, as different boards have differnt serial port names, but
I would like to keep the configuration options to a minimum, and just
let people use custom inittab / skeleton or add it with the post-build
script for special stuff.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH v2] add support for virtual terminal
  2011-11-08  9:35     ` Peter Korsgaard
@ 2011-11-08  9:41       ` Yegor Yefremov
  0 siblings, 0 replies; 6+ messages in thread
From: Yegor Yefremov @ 2011-11-08  9:41 UTC (permalink / raw)
  To: buildroot

> Hi,
>
>  >> I'm not sure I like another option for this - Can't you just use the
>  >> existing GENERIC_SERIAL and/or the post-build script for this?
>
>  Yegor> I'd like to have both serial console and virtual one (on tty I
>  Yegor> experiment with my program and vie serial console I can do other
>  Yegor> administrative tasks. One could use ssh, but this implies having
>  Yegor> network connection). Every time I execute make clean or clone BR
>  Yegor> I loose my inittab. Earlier versions of inittab had some ttys
>  Yegor> predefined, but they were deleted, so I thought, it would be
>  Yegor> useful to add this as an option. This way everyone should be
>  Yegor> satisfied.
>
> .. until someone wants a getty on tty2 or tty3 or so on. We need to keep
> serial config, as different boards have differnt serial port names, but
> I would like to keep the configuration options to a minimum, and just
> let people use custom inittab / skeleton or add it with the post-build
> script for special stuff.

O.K. I see your point and will follow Thomas's advice adding tty1 to my custom script.

Yegor

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-08  9:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-07 11:47 [Buildroot] [PATCH v2] add support for virtual terminal Yegor Yefremov
2011-11-07 22:39 ` Peter Korsgaard
2011-11-08  7:49   ` Yegor Yefremov
2011-11-08  9:28     ` Thomas Petazzoni
2011-11-08  9:35     ` Peter Korsgaard
2011-11-08  9:41       ` Yegor Yefremov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox