SDK: ti-processor-sdk-linux-am335x-evm-05.03.00.07.

Hello,

SDK: ti-processor-sdk-linux-am335x-evm-05.03.00.07.

Thank you

Marisol

Disclaimer***

The preceding e-mail message (including any attachments) contains

information that may be confidential, be protected by the attorney-client

or other applicable privileges, or constitute non-public information. It

is intended to be conveyed only to the designated recipient(s). If you are

not an intended recipient of this message, please notify the sender by

replying to this message and then delete it from your system. Use,

dissemination, distribution, or reproduction of this message by unintended

recipients is not authorized and may be unlawful.

SDK: ti-processor-sdk-linux-am335x-evm-05.03.00.07.

Hi Marisol! Nice to see a familiar name from my days at Newark. I'm
part of the BeagleBoard.org Foundation so happy to help where I can.

Based on am335x in the Subject, are you working with a BeagleBone Black?

I want to have more debug ouputs in the console window during the Linux kernel booting so that I can trace for example MMC driver loading process.

Added some printk() into the kernel, for example printk("this function is called \n"). After successful compiling and loading the kernel unfortunately I can't see the
expected output message "this function is called" in the console window.

It is generally easier to use the "pr_" helper functions:
https://elinux.org/Debugging_by_printing

pr_err() uses KERN_ERR level should always print regardless of the
printk log level. KERN_ERR is not a good practice for debug output,
but it does eliminate the chance that the log level is filtering out
your print statements.

Try adding this:
pr_err("DEBUG: start name_of_function()");

If you don't see that in dmesg, then it is likely that the function
you put that in is never actually called.

I also tried

     echo 8 > /proc/sys/kernel/printk

     dmesg

after login but the same results.

Is there any configuration missing in .config file?

level 8 should be sufficient but it is easier if you just set the
level in the .config before you compile your kernel.

CONFIG_PRINTK_TIME=y
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_QUIET=7
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=7

You probably also want to make sure dynamic debugging is enabled:
CONFIG_DYNAMIC_DEBUG=y

Dynamic debugging is a neat feature where you can chose to see more
debug information for a particular source code file:
https://linux-kernel-labs.github.io/refs/heads/master/labs/kernel_modules.html?highlight=config_dynamic_debug#dynamic-debugging

Sometimes you don't even need to add in your own debug print
statements, you just need to enable the dynamic debug output that is
already built-in to a driver or subsystem.

I also see brcmf_dbg() in kernel files, how can I activate it?

Are you trying to debug a Broadcom wifi driver?

Taking a look at Elixir to search the kernel code:

It looks like CONFIG_BRCM_TRACING will enable debug output:

Try setting that in your .config:
https://cateee.net/lkddb/web-lkddb/BRCM_TRACING.html

While it is technically to enable function tracing for the driver, it
looks like it will cause brcmf_dbg() to be defined.

Now the individual invocations of brcmf_dbg() will have a log level
associated with them. It appears that level can be set as kernel
module parameter:

This forum post has more information:

It indicates this can be set while the module is loaded via:
echo 6 > /sys/module/brcmfmac/parameters/debug

Let me me now how it goes.

Thanks,
Drew

Hi Drew,

Nice to hear from you! You are super smart - no surprise you are part of the foundation :blush:
Thank you very much for the support, I will try it out and see where it take me. Stay safe!

Best Regards,
Marisol