From acfd7db900337ccb1cdd4cb727526361c15b8415 Mon Sep 17 00:00:00 2001 From: spl Date: Tue, 23 Feb 2016 14:20:45 +0000 Subject: [PATCH] Mods to support new serial device alias in cmdline.txt. --- raspi-config | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/raspi-config b/raspi-config index 9ab0f82..74acb01 100755 --- a/raspi-config +++ b/raspi-config @@ -677,7 +677,7 @@ do_i2c() { do_serial() { DEFAULT= - if ! grep -q "console=ttyAMA0" /boot/cmdline.txt; then + if ! grep -q "console=ttyAMA0" /boot/cmdline.txt && ! grep -q "console=serial0" /boot/cmdline.txt ; then DEFAULT=--defaultno fi @@ -693,6 +693,7 @@ do_serial() { sed -i /etc/inittab -e "s|^.*:.*:respawn:.*ttyAMA0|#&|" fi sed -i /boot/cmdline.txt -e "s/console=ttyAMA0,[0-9]\+ //" + sed -i /boot/cmdline.txt -e "s/console=serial0,[0-9]\+ //" if [ "$INTERACTIVE" = True ]; then whiptail --msgbox "Serial is now disabled" 20 60 1 fi @@ -703,8 +704,16 @@ do_serial() { printf "T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100\n" >> /etc/inittab fi fi - if ! grep -q "console=ttyAMA0" /boot/cmdline.txt; then + if grep -q "console=ttyAMA0" /boot/cmdline.txt ; then + if [ -e /proc/device-tree/aliases/serial0 ]; then + sed -i /boot/cmdline.txt -e "s/console=ttyAMA0/console=serial0/" + fi + elif ! grep -q "console=ttyAMA0" /boot/cmdline.txt && ! grep -q "console=serial0" /boot/cmdline.txt ; then + if [ -e /proc/device-tree/aliases/serial0 ]; then + sed -i /boot/cmdline.txt -e "s/root=/console=serial0,115200 root=/" + else sed -i /boot/cmdline.txt -e "s/root=/console=ttyAMA0,115200 root=/" + fi fi if [ "$INTERACTIVE" = True ]; then whiptail --msgbox "Serial is now enabled" 20 60 1