android-tools: make usbgadget optional
PATCH 1/1 android-tools: make usbgadget optional
From: Etienne Cordonnier <[email protected]>
adbd can also be used over TCP, so USB gadget support is optional. android-tools-conf only contains the configfs USB gadget setup (scripts and a systemd drop-in), but android-tools depends on it unconditionally. On a machine without a USB device controller, android-gadget-setup fails and adbd does not start, even if it is only meant to be reached over TCP.
Add a "usbgadget" PACKAGECONFIG, and make the dependency on android-tools-conf, and the recommendation for the gadget kernel modules, conditional on it. The dependency moves from android-tools to android-tools-adbd, the package the drop-in belongs to.
Enable usbgadget by default for every machine, as before. Machines without a USB device controller can remove it from PACKAGECONFIG.
AI-Generated: Uses Claude Code
--- .../android-tools/android-tools_35.0.2.bb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
meta-oe/recipes-devtools/android-tools/android-tools_35.0.2.bb +7 -4
@@ -239,9 +239,9 @@ do_install:append:class-native() { } PACKAGES =+ "${PN}-adbd" -RDEPENDS:${PN}:class-target = "android-tools-conf-configfs 7zip android-libboringssl" -RDEPENDS:${PN}-adbd += "${PN}" -RRECOMMENDS:${PN}-adbd += "kernel-module-libcomposite kernel-module-usb-f-fs" +RDEPENDS:${PN}:class-target = "7zip android-libboringssl" +RDEPENDS:${PN}-adbd += "${PN} ${@bb.utils.contains('PACKAGECONFIG', 'usbgadget', 'android-tools-conf', '', d)}" +RRECOMMENDS:${PN}-adbd += "${@bb.utils.contains('PACKAGECONFIG', 'usbgadget', 'kernel-module-libcomposite kernel-module-usb-f-fs', '', d)}" PRIVATE_LIBS:${PN} = "liblog.so.0 libbase.so.0 libcutils.so.0" inherit useradd
@@ -260,9 +260,12 @@ FILES:${PN}-adbd = " \ BBCLASSEXTEND = "native" -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} usbgadget" # Apply Android's fs_config ownership/mode tables to files pushed by adbd to # /system, /vendor and /oem. Off by default: the tables describe Android # partition images and are meaningless on a generic Linux rootfs. PACKAGECONFIG[fs-config] = "" PACKAGECONFIG[systemd] = ",,systemd" +# adbd over a USB gadget. Machines without a USB device controller (UDC) do not need them, +# and can use adbd over TCP. +PACKAGECONFIG[usbgadget] = ""
Signature · 1 line
2.43.0