Score:-1

"Factory Reset"-Strategy with an UEFI-x86-GPIO-Board

no flag

What would be the "right" strategy for this use-case?

  1. x86_64-platform with UEFI
  2. 40-Pin GPIO available
  3. Ubuntu/Debian and Yocto-Custom-Build available (by manufacturer) for that platform/board
  4. 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?

Jaromanda X avatar
ru flag
I wonder if `efibootmgr` on the *eMMC-linux* would help
Maas avatar
no flag
Yes, that is the solution for the eMMC-linux. There would the boot order changed to boot the SSD-linux. But the problem is what happens then. While/after booting the SSD-linux the boot order would need to change back to boot the eMMC-linux (at next startup). The SSD-linux could use efibootmgr to do that. But the SSD-linux could possibly fail. Actually I'm exploring UEFI-Shell. But I'm new to that.
Jaromanda X avatar
ru flag
Have you actually read the documentation for `efibootmgr` specifically the `--bootnext` option
Maas avatar
no flag
I thought I read the docs but obviously I didn't read it thoroughly. That is indeed the answer! Thank you so much for your hint!
Jaromanda X avatar
ru flag
To be honest, I'm not 100% sure that is what you wanted. I assume that while the condition is to boot the SSD (GPIO button not pressed?), you will boot eMMC which reboots to SSD, every time?
Maas avatar
no flag
It is what I wanted. By standard: first booting the eMMC-linux. This will check for button-press. If there is no button-press "bootnext the SSD-linux" and reboot. So the SSD-linux will be started then. At next startup/reboot (after booting the SSD-linux) the same procedure because of restored default boot order (eMMC-linux first). And so on.
Score:0
no flag

From the comments above I've got the answer from Jaromanda X.

efibootmgr option --bootnext exactly does what I wanted to achieve.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.