0

I have an external serial peripheral that needs to be setup on Linux boot, on an embedded system. What I need is sending a short configuration string as early as possible during system boot, so my procedure is simply

  • Set port to 115200 bps
  • Send a string, like "ABCDE\r\n"

I see that recent kernels support an early-on serial console, but what I need is not a console (my peripheral can also send meaningless data in that phase, plus I'll be showing a splash screen in graphic mode), just a fast initialization for the the peripheral.

How can it be done?

LuC
  • 347
  • 2
  • 10
  • You may send as early as you want to. Even from the assembly. That is the magic behind serial port. So, what is the question exactly? P.S. You may check _arch./x86/boot_ folder which prints very very early some messages (`earlyprintk` for x86). – 0andriy Apr 21 '21 at 12:57

1 Answers1

1

The answer to this will be subjective depending on what you mean by as early as possible. I will provide few possibilities I am aware of which might help you

  • In case your embedded platform uses any form of bootloader (ex: U-Boot) then you can do the serial(UART) initialization as part of the bootloader (Usually this will be done for the target platform alone so that we can see how far the boot is happening). You can try initializing your external serial peripheral in bootloader itself. As bootloader will execute before the linux kernel gets loaded you can achieve this easily.

  • If your platform doesn't use any form of bootloader then the possibility of initializing the external serial peripheral is via kernel driver (or) system init process.

I have been using PSplash program which uses the basic frame buffer driver for the boot progress. If interested check the following repo

PSplash

BalaC
  • 85
  • 1
  • 7
  • Let's say my system is embedded at large, more in the application than in the hardware itself: it's a full featured dual core Atom board, where I'm running an amd64 Debian. I just limited the applications installed, but it runs now Plymouth for splash screen theming, and I didn't even recompile standard kernel. Oh well, boot is via grub2 then. – LuC Apr 14 '21 at 12:29