boot/init: Tear down usb gadget on kexec
Yikes, specialized code in the kexec codepath... though this is okay for
now. Let's not over-generalize when we don't know what will be required
in the future for abstraction.
@@ -189,6 +189,12 @@ class Tasks::SwitchRoot < SingletonTask
log("")
if will_kexec?
+ if Tasks.constants.include?(:SetupGadgetMode)
+ Progress.exec_with_message("Tearing down USB Gadget mode") do
+ Tasks::SetupGadgetMode.instance.teardown()
+ end
+ end
+
System.run(
"kexec", "--load",
generation_file("kernel"),
