site  contact  subhomenews

gui_engine runs in initrd

January 15, 2023 — BarryK

I posted yesterday about compiling 'dialog' statically, enabling text-mode GUIs in the initrd:

https://bkhome.org/news/202301/first-bootup-2-letter-language-asked-in-initrd.html

'dialog' is completely stand-alone, doesn't require any shared libraries, and is 508KB. It supports unicode characters.

All of the utilities in the initrd are statically-linked; 'busybox' is another example.

Over the years I have looked at various ways to run a GUI app in the initrd. For example, these blog posts:

https://bkhome.org/news/201809/fbwhiptail-whiptail-for-the-framebuffer.html

https://bkhome.org/news/201902/agar-gui-toolkit-with-sdl-12-on-linux-framebuffer.html

Being a glutton for punishment, decided to give it another go. Started early yesterday, it has been a marathon session, now 3.30am -- have to be up by 8am, going to a family gathering -- will post this report then sleep.

Here are some of the GUI toolkits that I looked at:

fbwhiptail, guilib, guilite, lcui, libagar, minigui, picogui, tekui, ugfx, lvgl, microwindows, nuklear

...they all have some problem, such as too complicated, too bloated, don't work properly, or even don't work at all. etc.

I need a toolkit that will work with the Linux framebuffer, either directly or via an intermediary library such as sdl 1.2. I found sdl 1.2 to be best for getting keyboard and mouse to work.

For sdl 1.2 to be used, it has to be a .a static library file, without any dependencies, so can be linked to build a statically-linked application. I configured sdl and sdl-gfx as small as possible, for the framebuffer only, see OE project commit:

https://github.com/bkauler/oe-qky-kirkstone/commit/6684ede2285a3b80988f71c355ec046a7cb64104

I found a fascination project, 'GUIslice', that will use sdl 1.2 backend. The docs even claim can use the framebuffer directly; however, I discovered in practice was unable to do certain things claimed in the documentation. For example, it is supposed to be able to disable touch screen requirement, but was unable to do that -- it insisted on needing 'tslib'. Anyway, the project page:

https://github.com/ImpulseAdventure/GUIslice

Also, only one of the examples worked, the rest aborted at startup. It has a fantastic GUI-builder, that does work:

https://github.com/ImpulseAdventure/GUIslice/wiki/GUIslice-Builder

I would like to study GUIslice some more, see if can get it to work. However, right now have another GUI toolkit, 'gui_engine', that works great. Project page:

https://github.com/AlxHnr/gui_engine

The link has a nice GIF animation, but here is my snapshot, running in the initrd:

img1

The example is named 'example' and is 304KB. That is a statically-link standalone application. Most of the size is the linked-in libsdl, so adding more features to the app won't increase the size much.

Very limited widgets, no documentation, but very simple and small C code. So definitely interested in taking it on as a project. Might be of interest to someone else also. First task -- there is no way to exit from the example, had to do a hard power-off.

Anyway, this evening intend to have another look at GUIslice.    

Tags: easy