[ just back from vacation ]
Well, assuming the first namespace is the one you want actually boot from. Which I expect is the common case, but who knows how people use their machines ...
IIRC there is some work in progress to add bootorder support for namespaces, where do we stand with that?
IIUC I got the go-ahead to implement this in QEMU, so let's see how that goes. Then we can look at the SeaBIOS patch I suppose.
Once we have this we should be able to extend the skip_nonbootable logic to handle not only controllers but also namespaces. With that we should be able to initialize the correct boot namespaces instead of picking the first namespace.
I would expect that selecting a particular namespace (which will be enabled by the QEMU patch) will be optional. Therefore, we might still have to figure out from which namespace to boot from, so we'll be in the same situation as we are now (an NVMe controller with lots of namespaces). So, I think the patch I propose is still useful?
Yes, when bootorder doesn't specify one (or more) specific namespace(s) picking the first is fine.
The patch seems to do some unneeded / unrelated changes though. Why do you move the boot_add() call? Why the desc changes? Why return the namespace? Just returning a int or bool telling whenever the namespace is active or not should be enough, no?
take care, Gerd