aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorGravatar Luca Ceresoli <luca@lucaceresoli.net>2016-04-17 23:45:46 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-04-18 13:36:11 +0200
commit20878a1017e2bf7eb8c5f870dc6d2641493cb0f9 (patch)
tree7880ef3240573c38d005e3aab7f63515b16a1efa /board
parent85f2e13c637bbc05a428436ef000b5531505b756 (diff)
downloadbuildroot-20878a1017e2bf7eb8c5f870dc6d2641493cb0f9.tar.gz
buildroot-20878a1017e2bf7eb8c5f870dc6d2641493cb0f9.tar.bz2
raspberrypi, raspberrypi2: add a serial console
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 three changes: 1. have two 'console=' entries in the kernel command line: tty1, then ttyAMA0; 2. change BR2_TARGET_GENERIC_GETTY_PORT to "console", so it starts a getty on the last console= passed to the kernel, ttyAMA0; 3. add a new getty on tty1 to the generated inittab. Step 2 is actually obtained by removing BR2_TARGET_GENERIC_GETTY_PORT entirely from the defconfigs, since "console" is the default value. Step 3 requires a post-build script since the Buildroot makefiles can configure only one console. Note: instead of simply adding a new getty on ttyAMA0 (which would work) this patch actually changes BR2_TARGET_GENERIC_GETTY_PORT to instantiate a console on UART, 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: console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL tty1::respawn:/sbin/getty -L tty1 0 vt100 # HDMI console Cc: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Arnout Vandecappelle <arnout@mind.be> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'board')
-rwxr-xr-xboard/raspberrypi/post-build.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/board/raspberrypi/post-build.sh b/board/raspberrypi/post-build.sh
new file mode 100755
index 0000000000..7eae14a885
--- /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