IMX BSP imx-4.9.11-1.0.0_ga kernel init printk output deferred

cancel
Showing results for 
Search instead for 
Did you mean: 

IMX BSP imx-4.9.11-1.0.0_ga kernel init printk output deferred

1,019 Views
keestrommel
Contributor IV

Using IMX BSP version imx-4.9.11-1.0.0_ga the output of printk is deferred during the linux initialization to some (unknown) point in the kernel initialization. If the kernel starts normal this is hardly visible but if the kernel init halts for some reason (e.g. in case of a kernel driver initialization failure) before the delayed printk output is flushed to the console then nothing is printed.

This behavior makes it impossible to debug early driver failures using printk.

This behavior did not exist in the previous IMX BSP version (imx-4.1.15_2.1.0_ga).

What is causing this new behavior? Is it possible using a config parameter or a patch to revert back to the imx-4.1.15_2.1.0_ga behavior?

0 Kudos
1 Reply

407 Views
cosmin_stoica
NXP Employee
NXP Employee

Hello keestrommel,

This behaviour is present when earlyprintk is not activated from kernel or/and kernel commands line parameters.

I. If it is not activated from kernel configuration, you will have to start the menuconfig for kernel:

a. directly from a kernel sources already configured:

make ARCH=arm CROSS_COMPILE=<toolchain_prefix>- menuconfig

b. yocto

bitbake virtual/kernel -c menuconfig

Menuconfig indications about activating the earlyprintk:

1. Go to Kernel hacking -->

2. Enable   Kernel low-level debugging functions (read help!) option and you should see the following menu

[*] Kernel low-level debugging functions (read help!) x x
         Kernel low-level debugging port (i.MX31 Debug UART) ---> 
     (1) i.MX Debug UART Port Selection (NEW) 
    [ ] Early printk (NEW)

3.  Select the UART for your SoC from Kernel low-level debugging port

4. Activate Early printk

    [*] Early printk (NEW)

5. Save the configuration

6. Check from .config if you have your early_printk configuration saved:

CONFIG_DEBUG_LL=y

CONFIG_DEBUG_IMX6Q_UART=y #(it should be your SOC:   CONFIG_DEBUG_<SoC>_UART)

CONFIG_EARLY_PRINTK=y

II. kernel already contains the early printk activated (checked in .config if the above CONFIG_* are activated).

In this scenario, the only thing which remains is to activate the earlyprintk from kernel cmdline bootargs:

Depending on your booting media, you should add earlyprintk parameter to kernel booting parameters.

Example for imx6dl using sd card:

U-boot console:

=> edit mmcargs
edit: setenv bootargs console=${console},${baudrate} ${smp} root=${mmcroot} earlyprintk
=> saveenv
Saving Environment to MMC...
Writing to MMC(0)... done

Result: Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk1p2 rootwait rw earlyprintk

You can check in your kernel log (dmesg), if the earlyprintk is activated by finding the following strings:

bootconsole [earlycon0] enabled
[ 0.000000] Kernel command line: console=ttymxc0,115200 root=/dev/mmcblk1p2 rootwait rw earlyprintk
[ 0.920296] bootconsole [earlycon0] disable

The above example is done for imx6dlsabresd.

What board do you use?

Best regards,

Cosmin