What would be the "right" strategy for this use-case?
- x86_64-platform with UEFI
- 40-Pin GPIO available
- Ubuntu/Debian and Yocto-Custom-Build available (by manufacturer) for that platform/board
- eMMC and SSD available
The goal is to have a working Debian-system on SSD which should be standardized loaded.
At the same time there should be an option to do a "factory reset" by i.e. pressing a GPIO-button during startup process. "factory reset" means that the Debian-system on SSD will be completely wiped and replaced with (new partition? and) "new" prepared Image (saved at eMMC).
The problem is that the GPIO-button-press recognition would need loading a linux with its kernel/drivers.
So my "strategy" would be loading a seperate linux at eMMC by UEFI boot order which could recognize the GPIO-button-state and normally without button press it would change UEFI boot order to boot first the SSD and restart. Then the Debian-system (SSD) would boot at first and at startup would again change the UEFI boot order to boot next time first again the eMMC-Linux (which could recognize the eventual button press or normally load the SSD again).
The problem is that if the Debian-linux on SSD fails of what reason ever, it can not change the boot order back to the eMMC-linux at startup.
So, what would be the "right" way to solve that problem? Am I thinking this too simple or too overcomplicated? What are the options in that case?