From: Luca Ceresoli <luca@lucaceresoli.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] raspberrypi, raspberrypi2: add a serial console
Date: Tue, 29 Mar 2016 23:56:41 +0200 [thread overview]
Message-ID: <56FAFA19.9090406@lucaceresoli.net> (raw)
In-Reply-To: <56FAE674.6080004@mind.be>
Dear Arnout,
On 29/03/2016 22:32, Arnout Vandecappelle wrote:
> On 03/29/16 00:08, Luca Ceresoli wrote:
>> The current Buildroot defconfigs for Raspberry Pi and Raspberry Pi 2
>> instantiate a console on tty1, which appears on HDMI. Add a console on
>> the serial port (ttyAMA0) to be more consistent with other defconfigs
>> and provide a better out-of-the-box experience to users used to have a
>> serial console from Buildroot defconfigs.
>>
>> This requires two changes:
>> 1. have two 'console=' entries in the kernel command line;
>> 2. add a new getty process to the generated inittab.
>>
>> Step 2 requires a post-build script since the Buildroot makefiles can
>> configure only one console. But instead of simply adding a new getty
>> on ttyAMA0 (which would work) this patch actually changes
>> BR2_TARGET_GENERIC_GETTY_PORT from tty1 to ttyAMA0, then adds back
>> tty1 via post-build.sh. This is done only to avoid the
>> "GENERIC_SERIAL" comment where we instantiate an HDMI console, then
>> instantiate a really-serial console on another line.
>>
>> The result is these two inittab lines:
>>
>> ttyAMA0::respawn:/sbin/getty -L ttyAMA0 0 vt100 # GENERIC_SERIAL
>> tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console
>>
>> Cc: Yann E. MORIN <yann.morin.1998@free.fr>
>> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
>>
>> ---
>>
>> Tested on both Raspberry Pi B and Raspberry Pi 2, each on serial and
>> HDMI console.
>> ---
>> board/raspberrypi/post-build.sh | 9 +++++++++
>> configs/raspberrypi2_defconfig | 3 ++-
>> configs/raspberrypi_defconfig | 3 ++-
>> package/rpi-firmware/cmdline.txt | 2 +-
>> 4 files changed, 14 insertions(+), 3 deletions(-)
>> create mode 100755 board/raspberrypi/post-build.sh
>>
>> diff --git a/board/raspberrypi/post-build.sh
>> b/board/raspberrypi/post-build.sh
>> new file mode 100755
>> index 000000000000..7eae14a88569
>> --- /dev/null
>> +++ b/board/raspberrypi/post-build.sh
>> @@ -0,0 +1,9 @@
>> +#!/bin/sh
>> +
>> +set -u
>> +set -e
>> +
>> +# Add a console on tty1
>> +grep -qE '^tty1::' ${TARGET_DIR}/etc/inittab || \
>> +sed -i '/GENERIC_SERIAL/a\
>> +tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console'
>> ${TARGET_DIR}/etc/inittab
>> diff --git a/configs/raspberrypi2_defconfig
>> b/configs/raspberrypi2_defconfig
>> index ce41ee31adba..0ffc6cdaf158 100644
>> --- a/configs/raspberrypi2_defconfig
>> +++ b/configs/raspberrypi2_defconfig
>> @@ -5,7 +5,7 @@ BR2_ARM_FPU_NEON_VFPV4=y
>>
>> BR2_TOOLCHAIN_BUILDROOT_CXX=y
>>
>> -BR2_TARGET_GENERIC_GETTY_PORT="tty1"
>> +BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
>
> Why not keep the default "console"? That should work, no? Or doesn't
> that work if there are two consoles?
What improvement you expect from using "console" instead of "ttyAMA0"?
OTOH I think ttyAMA0 or tty1 is explicit about the device to use. And as
Yann pointed out on IRC, "console is not a controlling tty, so no Ctrl-C
for example".
--
Luca
next prev parent reply other threads:[~2016-03-29 21:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-28 22:08 [Buildroot] [PATCH] raspberrypi, raspberrypi2: add a serial console Luca Ceresoli
2016-03-29 11:30 ` Alexander Dahl
2016-03-29 14:12 ` Luca Ceresoli
2016-03-29 21:04 ` Alexander Dahl
2016-03-29 22:33 ` Arnout Vandecappelle
2016-03-29 20:32 ` Arnout Vandecappelle
2016-03-29 21:56 ` Luca Ceresoli [this message]
2016-03-29 22:46 ` Arnout Vandecappelle
2016-03-30 12:04 ` Luca Ceresoli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56FAFA19.9090406@lucaceresoli.net \
--to=luca@lucaceresoli.net \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.