FunctionFS on GadgetFS requires this to happen in order:
- (1) preparing the gadget
- (2) preparing the function
- (3) mounting the functionfs
- (4) starting the daemon
- (5) enabling the device
Doing any of these steps in the wrong order *will* fail. You cannot
mount functionfs if the function name hasn't been allocated yet. You
cannot start the daemon without functionfs being mounted. You cannot
enable the device without the daemon running on the USB endpoints.
This is why the GadgetFS stuff here *has* to know about mounting the
filesystem and starting the daemon.
In fact, the generic library to be written to handle USB gadget mode
**will** have to have that knowledge!
The added TODOs are to be done when extracting as a standalone library.
The service and mount points are more of an implementation detail of the
GadgetFS handling library and not an implementation detail of the init
library.
In turn, this means that we are decoupling this from the init, follow-up
on the next commit...
This way on kexec the device is in a better state, and the kernel that
boots next is able to use the controller.
This was verified to fix an issue with kexec+gadget on the Chuwi Hi10
Pro HQ64 tablet.
The update from 29a10085f3 caused the
uncompressed kernel to not be installed anymore into the kernel output.
This meant that building the top-level argument failed as a file assumed
to exist wasn't there anymore.
We now provide the appropriate filename when we know it.
It's being replaced by the generic uefi-x86_64 device.
Basically, replace the QEMU-specific system type by the totally standard
UEFI system type. This way we're dogfooding it way better!
Closes#252.
This uses the `lib.systems.elaborate` function which builds the
complete attrset as preferred by Nixpkgs by using
`lib.systems.elaborate`, rather than building a partial equivalent.
@noneucat originally implemented it the simplest way possible, re-using
parts of the now unneeded custom functions. We can, instead, simply
pass a system name to `elaborate`, which ends up doing the right thing.
Co-authored-by: Andy Chun <andy@lolc.at>
Co-authored-by: Samuel Dionne-Riel <samuel@dionne-riel.com>