Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphical boot selection #80

Merged
merged 38 commits into from Mar 1, 2020

Conversation

samueldr
Copy link
Member

@samueldr samueldr commented Feb 29, 2020

This adds a GUI allowing the user to select a generation.

The current GUI is expected to be run as the "recovery" image.

This is only the most basic implementation. It does not allow kexecing another kernel. It only allows selecting a generation. Though, as basic as it is, it allows further on-device tinkering to be done much more safely.

This even gives a pseudo-AB system for non-AB systems. The user can flash a new boot.img on top of their boot partition, and if it fails to boot, boot to the system using the recovery menu.

Implementation notes

To reduce the footprint of the init, this splits the init "script" from the interpreter, as previously implemented. This means we now unconditionally use the wrapper script to exec the init.

Splitting the interpreter does allow us to add more "applets". Those "applets", in turn, allow us to add more in-depth applications implemented using the same scripting environment.

The GUI is implemented using mruby-lvgui, a set of bindings for LittlevGL.

Other notable changes

The mruby builder infrastructure is a bit sturdier. Rather than rely on a user-provided list of flags, for the final "stub" build, it uses saved information from the actual build. No flags should be missing.

Additionally, the stub now documents ARGV and $PROGRAM_NAME. This, in turn, allows scripts written using mruby to parse arguments. Quite necessary.

To implement later:

  • Async boot selection with multiple agents

  • Define the "agents" spec

  • kexec into another kernel+initrd

  • Keyboard control for Boot GUI

This will be required for pinebook-pro usage (which is a goal). It could also be nice with volume up/down + power for phones with broken digitizers. This can be merged without keyboard control support as it's not causing a regression.

  • Mouse control for Boot GUI

In theory it's supported, in practice it's not. LVGL supports mouse input. It seems the evdev driver only supports touch input, though this is unverified. This would be required for QEMU, and helpful for laptop use.

To implement quickly:

  • Assume "recovery" when some keys are held

This is to be used on e.g. chromeos tablets, or non-android systems (e.g. pinephone, pinebook pro). Holding one of [volume up, volume down, right control, left control] should act as if recovery was requested.

  • Better split init from script loader

Right now they still live in the same folder. A small mark of their past.

  • Fix and make available the "simulator"

There is a "simulator" for the boot GUI. This is how it was developed, not on-device, but in a window. It seems something happened and it doesn't work quite right anymore. This needs to be investigated, and fixed. Then, once fixed, be made available for easier development/testing.

Future somewhat related improvements

lvgui
  • use lvgui exclusively

Remove ply-image dependency, and use lvgui exclusively to show splash, and to show error states.

Benefits:

  • Text on error state
  • SVGs for all images
  • fix the bug with sad phone image background not being transparent

This will be used by `makeBin` so that using mrbgems requiring external
dependencies stays ergonomic.
This ensures no dependencies for a gem end up after `mruby-require`.
This is important since anything after `mruby-require` is implicitly
built as a shared library.
Useful for development purposes, mainly.
This needs the following commits where the init script will now tell the
loader to load init.mrb
@samueldr samueldr marked this pull request as ready for review February 29, 2020 22:40
@samueldr
Copy link
Member Author

👀 https://youtu.be/ZreRpVT9B94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant