imx8mp Android disable serial console

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8mp Android disable serial console

1,331 Views
shiva141
Contributor II

Hi 

We are using imx8mp with android-13.0.0_1.2.0.

We wish to disable serial console and use that uart for communicating to external board.

In Uboot ,We tried console = null in boot args  /include/configs/imx8mp-evk.h
In Device , BoardConfig.mk console = null 
it didnt work.


please share steps to disable serial console in Android BSP

 

IMX8MPLUS ANDROID-AUTO  

 

0 Kudos
Reply
10 Replies

1,284 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport
Hello @shiva141 
 
I hope you are doing very well.
 
To fully disable the debug console, you can try:
 
U-boot:
 
include/configs/imx8mp-evk.h
#define CONFIG_SILENT_CONSOLE
#define CONFIG_SYS_DEVICE_NULLDEV
#define CONFIG_SILENT_U_BOOT_ONLY
 
Also ensure CONFIG_CONSOLE_MUX is not enabled.
 
Then, in your bootargs, remove any console=tty...
 
=> setenv bootargs 'console=null'
 
 
Kernel Level:
 
In your Android kernel device tree disable the UART node, as example:
 
&uart2 {
    status = "disabled";
};
 
Also, you can remove the console=tty... of your BoardConfig.mk or remove the:
BOARD_KERNEL_CMDLINE := ...
You can replace with:
 
BOARD_KERNEL_CMDLINE := androidboot.console=null
 
 
 
Android Userspace (Init):
 
In your init.rc remove console services, like:
 
 
#service console /system/bin/sh
#    class core
#    console
#    disabled
#    user shell
#    group shell
 
 
 
Then try to rebuild and test.
 
Best regards,
Salas.
0 Kudos
Reply

1,270 Views
shiva141
Contributor II
Hi ,
Thanks for the reply.

our BSP is based on android-13.0.0_1.2.0

1)init.rc mentioned changes where not preset android_build/device/nxp/imx8m/evk_8mp/init.rc
2) For the above change Serial console was disabled but Android didn't boot ( we didn't get the android log on )

We did small debug by doing the recommended changes one by one
Root cause : => setenv bootargs 'console=null'

in uboot after setenv Android didnt boot up.( no Android logo in HDMI monitor)
=> setenv bootargs 'console=null'

Starting kernel ...

was the last msg in serial console but Android didn't boot up.
0 Kudos
Reply

1,130 Views
jiluo
NXP Employee
NXP Employee

Hi,

You need to apply below changes to silent the console:

In {ANDROID_PROJECT}/vendor/nxp-opensource/uboot-imx:

diff --git a/arch/arm/dts/imx8mp-evk.dts b/arch/arm/dts/imx8mp-evk.dts
index c3228b8ccb9..ee1a03b8a33 100644
--- a/arch/arm/dts/imx8mp-evk.dts
+++ b/arch/arm/dts/imx8mp-evk.dts
@@ -13,7 +13,7 @@
        compatible = "fsl,imx8mp-evk", "fsl,imx8mp";

        chosen {
-               bootargs = "console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200";
+               bootargs = "console=ttynull";
                stdout-path = &uart2;
        };

diff --git a/configs/imx8mp_evk_android_trusty_dual_defconfig b/configs/imx8mp_evk_android_trusty_dual_defconfig
index 33553ca143e..c2f333091b6 100644
--- a/configs/imx8mp_evk_android_trusty_dual_defconfig
+++ b/configs/imx8mp_evk_android_trusty_dual_defconfig
@@ -19,7 +19,7 @@ CONFIG_DM_GPIO=y
 CONFIG_SPL_TEXT_BASE=0x920000
 CONFIG_USB_TCPC=y
 CONFIG_TARGET_IMX8MP_EVK=y
-CONFIG_SPL_SERIAL=y
+CONFIG_SPL_SERIAL=n
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL=y
 CONFIG_SPL_IMX_ROMAPI_LOADADDR=0x48000000
@@ -194,3 +194,7 @@ CONFIG_ATTESTATION_ID_DEVICE="evk_8mp"
 CONFIG_ATTESTATION_ID_PRODUCT="evk_8mp"
 CONFIG_ATTESTATION_ID_MANUFACTURER="nxp"
 CONFIG_ATTESTATION_ID_MODEL="EVK_8MP"
+CONFIG_SILENT_CONSOLE=y
+CONFIG_SYS_DEVICE_NULLDEV=y
+CONFIG_SILENT_CONSOLE_UNTIL_ENV=y
+CONFIG_SILENT_U_BOOT_ONLY=y
diff --git a/include/configs/imx8mp_evk_android.h b/include/configs/imx8mp_evk_android.h
index 09e3841908b..823d40a292a 100644
--- a/include/configs/imx8mp_evk_android.h
+++ b/include/configs/imx8mp_evk_android.h
@@ -17,6 +17,7 @@
        "splashimage=0x50000000\0"              \
        "fdt_high=0xffffffffffffffff\0"         \
        "initrd_high=0xffffffffffffffff\0"      \
+       "silent=1\0"    \

 /* Enable mcu firmware flash */
 #ifdef CONFIG_FLASH_MCUFIRMWARE_SUPPORT

 In {ANDROID_PROJECT}/device/nxp:

diff --git a/imx8m/evk_8mp/BoardConfig.mk b/imx8m/evk_8mp/BoardConfig.mk
index c1e9314d..3f916ddf 100644
--- a/imx8m/evk_8mp/BoardConfig.mk
+++ b/imx8m/evk_8mp/BoardConfig.mk
@@ -132,7 +132,7 @@ BOARD_KERNEL_BASE := 0x40400000
 CMASIZE=1184M
 # NXP default config
 BOARD_KERNEL_CMDLINE := init=/init firmware_class.path=/vendor/firmware loop.max_part=7 bootconfig
-BOARD_BOOTCONFIG += androidboot.console=ttymxc1 androidboot.hardware=nxp
+BOARD_BOOTCONFIG += androidboot.hardware=nxp

 # memory config
 BOARD_KERNEL_CMDLINE += transparent_hugepage=never

In {ANDROID_PROJECT}/vendor/nxp-opensource/arm-trusted-firmware:

diff --git a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
index 348f90045..bb174ca49 100644
--- a/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
+++ b/plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c
@@ -208,7 +208,6 @@ static void bl31_tzc380_setup(void)
 void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
                u_register_t arg2, u_register_t arg3)
 {
-       static console_t console;
        unsigned int val;
        unsigned int i;

@@ -230,10 +229,10 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,

        imx8m_caam_init();

-       console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
-               IMX_CONSOLE_BAUDRATE, &console);
+//     console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
+//             IMX_CONSOLE_BAUDRATE, &console);
        /* This console is only used for boot stage */
-       console_set_scope(&console, CONSOLE_FLAG_BOOT);
+//     console_set_scope(&console, CONSOLE_FLAG_BOOT);

        /*
         * tell BL3-1 where the non-secure software image is located

 

If you are using Trusty OS then you should also silent the uart in trusty os. In {TRUSTY_OS_PROJECT}/trusty/hardware/nxp:

diff --git a/platform/imx/debug.c b/platform/imx/debug.c
index 5670125..dfa8101 100644
--- a/platform/imx/debug.c
+++ b/platform/imx/debug.c
@@ -32,7 +32,7 @@
 #define SMC_SC_SHARED_CONSOLE_CTL SMC_STDCALL_NR(SMC_ENTITY_CONSOLE, 0)
 #define TRUSTY_CONSOLE_DISABLE 0
 #define TRUSTY_CONSOLE_ENABLE 1
-bool no_console = false;
+bool no_console = true;

 static long console_stdcall(struct smc32_args* args) {
     if (args->smc_nr == SMC_SC_SHARED_CONSOLE_CTL) {
@@ -50,7 +50,7 @@ static struct smc32_entity console_entity = {
 };

 void console_smcall_init(uint level) {
-    no_console = false;
+    no_console = true;
     sm_register_entity(SMC_ENTITY_CONSOLE, &console_entity);
 }
 void platform_dputc(char c) {
0 Kudos
Reply

1,051 Views
shivashanka141
Contributor I

Hi, 

Thanks for the changes Kernel logs stopped.

Still getting Uboot-logs

we tried to disable uboot-logs by changing the Board.h : /include/configs/imx8mp_evk.h

+#define CONFIG_DISABLE_CONSOLE

+#define CONFIG_SILENT_CONSOLE

+#define CONFIG_SYS_DEVICE_NULLDEV


IMX8MPLUS ANDROID-AUTO 

0 Kudos
Reply

1,037 Views
jiluo
NXP Employee
NXP Employee

Hi,

Could you confirm you have applied the u-boot changes to the right *-defconfig? imx8mp has multiple *defconfig for android, in the example I applied the changes to "imx8mp_evk_android_trusty_dual_defconfig" but yours could be different, make sure you have applied to the right config file.

0 Kudos
Reply

1,031 Views
shivashanka141
Contributor I

Hi jiluo,

Android BSP version : imx-android-13.0.0_1.2.0.

I am trying on imx8mp-EVK.

Kernel logs stopped and got Android UI
Still getting u-boot logs

I was able to confirm we have made the changes you have suggested

attached all changes for reference.

0 Kudos
Reply

1,001 Views
jiluo
NXP Employee
NXP Employee

Hi,

As far as I can see, you are missing below two configs:

+CONFIG_SILENT_CONSOLE_UNTIL_ENV=y
+CONFIG_SILENT_U_BOOT_ONLY=y

Please make sure you have applied all the changes in the diff file and better double confirm they are functioning by compiling standalone u-boot config and check they are desired in the generated ".config".

0 Kudos
Reply

996 Views
jiluo
NXP Employee
NXP Employee

And in the "uboot.patch", I can see you have changes in the "configs/imx8mp_evk_android_trusty_dual_defconfig". But from the boot logs, this should not be the defconfig you are using. Please make sure these changes have been made to the right config file (imx8mp_evk_android_defconfig?).

0 Kudos
Reply

939 Views
shivashanka141
Contributor I
yes ,Thanks for you for suggesting the changes achieved after updating imx8mp_evk_android_defconfig
0 Kudos
Reply

1,246 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport
Hello, 
 
After of investigate about this issue, it appears Android expects a valid console device.
 
Please try with:
 
setenv bootargs 'console=tty0 androidboot.console=tty0'
saveenv
 
Re-enable your Uart:
 
&uart2 {
    status = "okay";
    // your custom config
};
 
And match the BOARD_KERNEL_CMDLINE in your BoardConfig.mk:
 
BOARD_KERNEL_CMDLINE := console=tty0 androidboot.console=tty0
 
 
Please try those steps and let me know if it worked for you.
 
 
FYI: console=tty0 redirects all kernel messages (printk) to the framebuffer/virtual terminal, not UART.
 
 
I hope this can helps to you.
 
Best regards,
Salas.
0 Kudos
Reply