Redirecting console to UARTC from UARTA

Hello,

I have tried to move both console and u-boot to uartc(/dev/ttymc2) from uarta(/dev/ttymxc0) to be able to use uarta for another purpose. I have applied below patches to my yocto build, now u-boot messages and kernel messages are shown in uartc, and after booting I see a login promt on uartc.

But I see another login promt on usba. In /etc/systemd/system/getty.target.wants/ directory there are two other getty and there is not ttymxc2.

root@colibri-imx6:~# ls /etc/systemd/system/getty.target.wants/
getty@tty1.service            serial-getty@ttymxc0.service

Kernel messages are:

[  OK  ] Started Getty on tty1.
[  OK  ] Started Serial Getty on ttymxc0.
[  OK  ] Started Serial Getty on ttymxc2.    

I disabled it with runnig systemctl disable serial-getty@ttymxc0.service command on colibri and seems its working. But I don’t understand why I needed to run this command and why systemd-getty-generator generate service at ttymxc0.

How can I remove getty on ttymxc0 from yocto without running command on colibri?

u-boot patch:

Index: git/board/toradex/colibri_imx6/colibri_imx6.c
===================================================================
--- git.orig/board/toradex/colibri_imx6/colibri_imx6.c
+++ git/board/toradex/colibri_imx6/colibri_imx6.c
@@ -95,10 +95,10 @@ int dram_init(void)
 	return 0;
 }
 
-/* Colibri UARTA */
-iomux_v3_cfg_t const uart1_pads[] = {
-	MX6_PAD_CSI0_DAT10__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
-	MX6_PAD_CSI0_DAT11__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
+/* Colibri UARTC */
+iomux_v3_cfg_t const uart3_pads[] = {
+	MX6_PAD_SD4_CMD__UART3_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
+	MX6_PAD_SD4_CLK__UART3_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
 #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
@@ -283,7 +283,7 @@ static void setup_dtemode_uart(void)
 static void setup_iomux_uart(void)
 {
 	setup_dtemode_uart();
-	imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
+	imx_iomux_v3_setup_multiple_pads(uart3_pads, ARRAY_SIZE(uart3_pads));
 }
 
 #ifdef CONFIG_USB_EHCI_MX6
@@ -1210,7 +1210,7 @@ int g_dnl_bind_fixup(struct usb_device_d
 #endif
 
 static struct mxc_serial_platdata mxc_serial_plat = {
-	.reg = (struct mxc_uart *)UART1_BASE,
+	.reg = (struct mxc_uart *)UART3_BASE,
 	.use_dte = true,
 };
 
Index: git/include/configs/colibri_imx6.h
===================================================================
--- git.orig/include/configs/colibri_imx6.h
+++ git/include/configs/colibri_imx6.h
@@ -44,7 +44,7 @@
 #define CONFIG_MISC_INIT_R
 
 #define CONFIG_MXC_UART
-#define CONFIG_MXC_UART_BASE		UART1_BASE
+#define CONFIG_MXC_UART_BASE		UART3_BASE
 
 /* Make the HW version stuff available in U-Boot env */
 #define CONFIG_ENV_VARS_UBOOT_CONFIG
@@ -136,7 +136,7 @@
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_CONS_INDEX		1
+#define CONFIG_CONS_INDEX		3
 #define CONFIG_BAUDRATE			115200
 
 /* Command definition */
@@ -239,7 +239,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	BOOTENV \
 	"boot_file=zImage\0" \
-	"console=ttymxc0\0" \
+	"console=ttymxc2\0" \
 	"defargs=galcore.contiguousSize=50331648 user_debug=30\0" \
 	"dfu_alt_info=" DFU_ALT_EMMC_INFO "\0" \
 	EMMC_BOOTCMD \
@@ -255,7 +255,7 @@
 		"${interface} ${drive}:1 ${loadaddr} flash_blk.img && " \
 		"source ${loadaddr}\0" \
 	"setup=setenv setupargs fec_mac=${ethaddr} " \
-		"consoleblank=0 no_console_suspend=1 console=tty1 " \
+		"consoleblank=0 no_console_suspend=1 " \
 		"console=${console},${baudrate}n8\0" \
 	"setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \
 	"setusbupdate=usb start && setenv interface usb; setenv drive 0; " \

kernel patch:

Index: kernel-source/arch/arm/configs/colibri_imx6_defconfig
===================================================================
--- kernel-source.orig/arch/arm/configs/colibri_imx6_defconfig
+++ kernel-source/arch/arm/configs/colibri_imx6_defconfig
@@ -32,7 +32,7 @@ CONFIG_HIGHMEM=y
 CONFIG_CMA=y
 CONFIG_UACCESS_WITH_MEMCPY=y
 CONFIG_SECCOMP=y
-CONFIG_CMDLINE="noinitrd console=ttymxc0,115200"
+CONFIG_CMDLINE="noinitrd console=ttymxc2,115200"
 CONFIG_CPU_FREQ=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y

HI @karaketir16 and Welcome to the Toradex Community!

Could you provide the version of the Software of your module?
Which carrier board are you using?

Regarding your issue, did you already have a look here?

Best regards,
Jaski

Hi,

My carrier board is viola rev 1.2

Linux version is Angstrom v2017.12

printenv command in u-boot give below output and console=ttymxc2 is present.

Colibri iMX6 # printenv 
arch=arm
baudrate=115200
board=colibri_imx6
board_name=colibri_imx6
board_rev=011a
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_file=zImage
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=mmc1 mmc0 usb0 dhcp 
bootcmd=run emmcboot; echo; echo emmcboot failed; run distro_bootcmd; usb start; setenv stdout serial,vga; setenv stdin serial,usbkbd
bootcmd_dhcp=if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_mmc1=setenv devnum 1; run mmc_boot
bootcmd_usb0=setenv devnum 0; run usb_boot
bootdelay=1
bootm_size=0x10000000
console=ttymxc2
cpu=armv7
defargs=galcore.contiguousSize=50331648 user_debug=30
dfu_alt_info=u-boot.imx raw 0x2 0x3ff mmcpart 0;boot part 0 1;rootfs part 0 2;zImage fat 0 1;imx6q-colibri-eval-v3.dtb fat 0 1;imx6q-colibri-cam-eval-v3.dtb fat 0 1
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
emmcargs=ip=off root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
emmcboot=run setup; setenv bootargs ${defargs} ${emmcargs} ${setupargs} ${vidargs}; echo Booting from internal eMMC chip...; run emmcdtbload; load mmc 0:1 ${kernel_addr_r} ${boot_file} && run fdt_fixup && bo}
emmcdtbload=setenv dtbparam; load mmc 0:1 ${fdt_addr_r} ${fdt_file} && setenv dtbparam " - ${fdt_addr_r}" && true
ethact=FEC
ethaddr=00:14:2d:a0:38:c6
ethprime=FEC
fdt_addr_r=0x12100000
fdt_file=imx6dl-colibri-cam-eval-v3.dtb
fdt_fixup=;
initrd_high=0xffffffff
ipaddr=192.168.10.2
kernel_addr_r=0x11000000
loadaddr=0x12000000
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
netmask=255.255.255.0
nfsargs=ip=:::::eth0:on root=/dev/nfs rw
nfsboot=run setup; setenv bootargs ${defargs} ${nfsargs} ${setupargs} ${vidargs}; echo Booting via DHCP/TFTP/NFS...; run nfsdtbload; dhcp ${kernel_addr_r} && run fdt_fixup && bootz ${kernel_addr_r} ${dtbpara}
nfsdtbload=setenv dtbparam; tftp ${fdt_addr_r} ${fdt_file} && setenv dtbparam " - ${fdt_addr_r}" && true
pxefile_addr_r=0x17100000
ramdisk_addr_r=0x12200000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} boe
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing...i
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT e
scriptaddr=0x17000000
sdargs=ip=off root=/dev/mmcblk1p2 ro rootfstype=ext4 rootwait
sdboot=run setup; setenv bootargs ${defargs} ${sdargs} ${setupargs} ${vidargs}; echo Booting from MMC/SD card; run sddtbload; load mmc 1:1 ${kernel_addr_r} ${boot_file} && run fdt_fixup && bootz ${kernel_add}
sddtbload=setenv dtbparam; load mmc 1:1 ${fdt_addr_r} ${fdt_file} && setenv dtbparam " - ${fdt_addr_r}" && true
serial#=10500294
serverip=192.168.10.1
setethupdate=if env exists ethaddr; then; else setenv ethaddr 00:14:2d:00:00:00; fi; tftpboot ${loadaddr} flash_eth.img && source ${loadaddr}
setsdupdate=setenv interface mmc; setenv drive 1; mmc rescan; load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && source ${loadaddr}
setup=setenv setupargs fec_mac=${ethaddr} consoleblank=0 no_console_suspend=1 console=${console},${baudrate}n8
setupdate=run setsdupdate || run setusbupdate || run setethupdate
setusbupdate=usb start && setenv interface usb; setenv drive 0; load ${interface} ${drive}:1 ${loadaddr} flash_blk.img && source ${loadaddr}
soc=mx6
splashpos=m,m
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
vendor=toradex
ver=U-Boot 2016.11-2.8.4+g07edca0 (Nov 28 2019 - 08:26:29 +0000)
vidargs=video=mxcfb0:dev=lcd,640x480M@60,if=RGB666 video=mxcfb1:off fbmem=8M

Environment size: 4675/8188 bytes

hi @karaketir16

I disabled it with runnig systemctl disable serial-getty@ttymxc0.service command on colibri and seems its working. But I don’t understand why I needed to run this command and why systemd-getty-generator generate service at ttymxc0.

As default the serial-getty service is created on the standard serial port for console Output. If you want to change, then you would need to change the openembedded recipe for the serial-getty service.

Best regards,
Jaski

Thanks @jaski.tx ,
I created systemd-serialgetty%.bbappend file and write inside:

do_install_append() {
     rm ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@ttymxc0.service
}

It works, there is console on ttymxc2 and no console on ttymxc0 now.

But When I give power module, it sends Industrial temperature grade DDR3 timings, 64bit bus width. Trying to boot from MMC1 message via ttymxc0. Is it possible to avoid that message?

Perfect that you successfully removed the serial-getty@ttymxc0.service.

The message above is output by U-Boot. Therefore you need to disable this in U-Boot recipe too.

Best regards,
Jaski