Your Location is: Home > Linux-kernel

What is the best way to toggle gpios to indicate the kernel boot progress?

From: Monaco View: 1261 Reggie 


I have an small embedded system board (much like a RasPi) running a Yocto Linux distro (from a third party vendor, not the open-embbeded original repo). On that electronic board there are a bunch of LEDs in a row, each with a specific GPIO assigned. I can toggle them easily using sysfs (ex: echo 1 >/sys/class/gpio/gpio123/value).

I would like to indicate the progress of the kernel boot sequence (not during u-boot, not during systemd, really during the various steps in loading the drivers, etc. which last roughly 2 or 3 seconds on my board) much like a splash screen, but instead using the physical LEDs as a progress bar "splashscreen-like" indicator.

Is there a pre-defined best-way or "recommended" method/place/script/anything to do so? It is most likely a very common thing, I just can't seem to find any other people doing so (I know, I know, I am most likely just not searching/googling for the right words).


Best answer

Modify the device tree of your machine board. There is a compatible = "gpio-led" tag using for the nodes to toggle these pins for the LED. You need to see how to toggle the GPIOs in the RasPi. Maybe in the Pin Funciton Controller, you can find a list of GPIOs or in the internet you canf ind it easily.

Here the link: