[yocto] [meta-raspberrypi][PATCH] Change serial console for Raspberry Pi 3

Martin Bergek martin at spotwise.com
Tue Apr 5 00:08:54 PDT 2016


With the Raspberry Pi 3 the serial ports ttyS0 and ttyAMA0 have been switched around. This causes an issue with the serial console that has previously been set to ttyAMA0, causing the boot process to halt. I have a 100% failure rate when booting a Raspberry Pi 3 image built using the master branch of meta-raspberrypi. After a lot of testing it appears that the system fails to boot whenever the kernel command line specifies a console - regardless of whether it is ttyAMA0 or ttyS0.

This patch changes the serial console and kernel command line to use default values, allowing the raspberrypi3 machine configuration to assign different values and to remove the kernel console. Now I get the console output to the screen but at least it boots. Not sure if this is an acceptable way of doing it but it fixed my problem.

This patch has been verified on both the 4.1 and 4.4 kernel. It has also been tested with the raspberrypi2 machine configuration.

Signed-off-by: Martin Bergek <martin at spotwise.com>
---
conf/machine/include/rpi-base.inc          | 2 +-
conf/machine/raspberrypi3.conf             | 4 ++++
recipes-kernel/linux/linux-raspberrypi.inc | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/conf/machine/include/rpi-base.inc b/conf/machine/include/rpi-base.inc
index 792150e..5d6280b 100644
--- a/conf/machine/include/rpi-base.inc
+++ b/conf/machine/include/rpi-base.inc
@@ -7,7 +7,7 @@ include conf/machine/include/soc-family.inc

IMAGE_FSTYPES ?= "tar.bz2 ext3 rpi-sdimg"

-SERIAL_CONSOLE = "115200 ttyAMA0"
+SERIAL_CONSOLE ?= "115200 ttyAMA0"

XSERVER = " \
    xserver-xorg \
diff --git a/conf/machine/raspberrypi3.conf b/conf/machine/raspberrypi3.conf
index 1b73f2f..2c76dc2 100644
--- a/conf/machine/raspberrypi3.conf
+++ b/conf/machine/raspberrypi3.conf
@@ -6,4 +6,8 @@ MACHINEOVERRIDES = "raspberrypi2:${MACHINE}"

MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-brcm43430"

+# Change serial console due to swapped ttyAMA0 and ttyS0 on the Raspberry Pi 3
+SERIAL_CONSOLE = "115200 ttyS0"
+CMDLINE = "dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
+
include conf/machine/raspberrypi2.conf
diff --git a/recipes-kernel/linux/linux-raspberrypi.inc b/recipes-kernel/linux/linux-raspberrypi.inc
index 24e7fe2..a3fe61a 100644
--- a/recipes-kernel/linux/linux-raspberrypi.inc
+++ b/recipes-kernel/linux/linux-raspberrypi.inc
@@ -20,7 +20,7 @@ KERNEL_DEFCONFIG_raspberrypi ?= "bcmrpi_defconfig"
KERNEL_DEFCONFIG_raspberrypi2 ?= "bcm2709_defconfig"

# CMDLINE for raspberrypi
-CMDLINE = "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"
+CMDLINE ?= "dwc_otg.lpm_enable=0 console=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait"

# Add the kernel debugger over console kernel command line option if enabled
CMDLINE_append = ' ${@base_conditional("ENABLE_KGDB", "1", "kgdboc=ttyAMA0,115200", "", d)}'
-- 
2.5.0






More information about the yocto mailing list