How to disable serial console(non-kernel) in u-boot

Egor picture Egor · Dec 18, 2015 · Viewed 11.8k times · Source

I am building a Yocto image for Intel Edison.

One of the image's components is u-boot with an Edison-specific patch. By default, Edison's UART port is used for u-boot console. I want to disable this feature, but only on the serial interface(u-boot also listens on USB and that needs to stay).

My main concern is the "Press any key to stop autoboot" feature on the UART port. I need this port to connect an accessory that might send something during the boot process of the main device.

How do I approach this problem? Is there an environment variable for this, or do I need to modify the sources?

Thanks in advance!

Answer

Egor picture Egor · Nov 1, 2016

I'm getting back to this issue almost a year later, now I've managed to find a proper solution.

The board I was working on had a reasonably new u-boot in its BSP. To disable the serial console I had to do the following:

  • Add the following defines to the board's config header(located in include/configs/board.h):

    #define CONFIG_DISABLE_CONSOLE
    #define CONFIG_SILENT_CONSOLE
    #define CONFIG_SYS_DEVICE_NULLDEV
    
  • Check if your board has early_init_f enabled in the same file:

    #define CONFIG_BOARD_EARLY_INIT_F 1
    
  • Find the arch file(Something like arch/x86/cpu/architecture/architecture.c) and add this call to its early_init_f function. It actually modifies board's global data variable to have these flags:

    gd->flags |= (GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE);
    
  • My board did not have one, so I had to add the whole function

     int board_early_init_f(void)
     {
          gd->flags |= (GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE);
          return 0;
     }
    

That's it. Hope this helps someone else!