-1

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?

Maas
  • 99
  • 3
  • 1
    I wonder if `efibootmgr` on the *eMMC-linux* would help – Jaromanda X Jul 29 '23 at 01:01
  • 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. – Maas Jul 29 '23 at 21:13
  • 1
    Have you actually read the documentation for `efibootmgr` specifically the `--bootnext` option – Jaromanda X Jul 29 '23 at 23:00
  • 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! – Maas Jul 30 '23 at 00:16
  • 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? – Jaromanda X Jul 30 '23 at 00:24
  • 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. – Maas Jul 30 '23 at 00:30

1 Answers1

0

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

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

Maas
  • 99
  • 3