The native tools include compilation of zip_writter, where it include
gtest/gtest_prod.h. So native build need to depend on gtest-native.
Signed-off-by: Claus Stovgaard <claus@stovgaard.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Two build failures occur with the default clang/lld toolchain (and with
gcc) when compiling android-tools 35.0.2:
1. The bundled fmtlib 10.2.0 validates FMT_STRING() inside a consteval
basic_format_string constructor whose parse path evaluates
"format_str_.remove_prefix(detail::to_unsigned(it - begin()))". Current
C++ frontends reject that iterator subtraction as a non-constant
subexpression:
error: call to consteval function
'fmt::basic_format_string<...>::basic_format_string<FMT_COMPILE_STRING,0>'
is not a constant expression
Define FMT_CONSTEVAL to empty so fmt drops the consteval qualifier and
validates format strings via its runtime path instead.
2. adb's IOVector::coalesce() static_asserts that its Block collection type
is standard-layout. Block holds a std::unique_ptr<char[]>, which is
standard-layout under LLVM libc++ (AOSP's runtime) but not under GNU
libstdc++, so the assertion fails for libstdc++ based toolchains:
packages/modules/adb/types.h:235:27: error: static assertion failed due
to requirement 'std::is_standard_layout<Block>()'
The assertion does not protect the memcpy it guards (which writes into
plain char storage), so drop it.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
The patch was creating the file /run/.adb.root with read-write permission for "other",
so any user was able to write to it.
Make the file owned by user adb, and remove permissions for group and other.
Before:
```
root@raspberrypi4-64:~# ls -l /run/.adb.root
-rw-rw-rw- 1 root root 8 Mar 13 15:42 /run/.adb.root
```
After:
```
root@raspberrypi4-64:~# ls -l /run/adb.root
-rw------- 1 adb adb 8 Mar 13 15:35 /run/adb.root
```
Also rename the file from .adbd.root to adbd.root, since hidden files are
not the convention in /run
AI-Generated: Uses GitHub Copilot (Claude Sonnet 4.6)
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
The android-tools-conf recipe used /sys/class/android_usb/android0/,
an interface exported by the out-of-tree android.c USB gadget driver
that Google carried in Android kernels but never submitted to mainline
Linux. It was never part of any upstream kernel release.
The configfs-based USB gadget framework (CONFIG_USB_CONFIGFS) was
merged into mainline Linux with kernel 3.10 (June 2013) and is the
correct interface for all upstream kernels since then. Additionally,
Google's Generic Kernel Image (GKI) initiative dropped android.c from
Android common kernels starting with kernel 5.10 (Android 12, 2021),
so even custom BSPs targeting modern Android cannot use this interface.
Remove android-tools-conf and rename android-tools-conf-configfs to
android-tools-conf, since the configfs-based implementation is the
only correct one for any modern kernel. Backward compatibility is
preserved via PROVIDES/RPROVIDES retaining the old
android-tools-conf-configfs name.
AI-Generated: Uses GitHub Copilot (Claude Sonnet 4.6)
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Upgrade from 29.0.6.r14 to 35.0.2, switching to the Debian
android-platform-tools source package layout which ships Debian-maintained
make fragments and patch series under debian/system/.
The old recipe carried a hand-maintained patch stack on top of a
custom build system (rules_yocto.mk). The new recipe delegates to
Debian's make fragments and applies only the OE-specific patches needed
on top.
Notable upstream changes between 29.0.6 and 35.0.2 (see release notes at
https://developer.android.com/tools/releases/platform-tools):
- adb: libusb is now the default USB backend on Linux (35.0.0)
- adb: receive windowing for better throughput on high-latency links (33.0.3)
- adb: graceful USB interface release on shutdown (35.0.2)
- adb: wireless pairing and incremental APK installation support (30.0.0)
- adb: adb transport-id for safe scripted device waits (30.0.2)
- adb: fix shell exit code when device disconnects (35.0.0)
- fastboot: download speed improvements up to 980MB/s on SuperSpeed+ (35.0.0)
OE-specific changes:
- adbd now drops privileges to a dedicated "adb" system user (matching
Android's production security model); use "adb root" to escalate
- adbd root/unroot/remount support added for non-Android targets
- android-gadget-setup updated to mount functionfs with uid/gid ownership
so the unprivileged adbd can access the FunctionFS endpoints
- Depends on new android-libboringssl recipe for BoringSSL shared libraries
- android-tools-adbd.service uses Type=notify so systemd waits for adbd's
sd_notify READY=1 before proceeding with ExecStartPost
- android-gadget-start now respects ANDROID_GADGET_UDC_DELAY (default 10s
for non-systemd paths); the configfs drop-in sets it to 0 since adbd has
already signalled readiness before ExecStartPost runs, eliminating the
fixed delay on restart
Tested on Raspberry Pi 4B (MACHINE=raspberrypi4-64) with USB-C OTG port,
openembedded-core main branch, meta-openembedded master-next, kernel 6.12:
- adb devices: device enumerated as 18d1:d002
- adb shell: connection as unprivileged adb user
- adb root / adb unroot: privilege escalation and drop
- adb reboot: device reboot via adb
- adb forward: SSH tunnel through ADB verified
- oe-run-native android-tools-native adb / fastboot: native host tools build
Note: adbd only starts when /etc/usb-debugging-enabled exists on the target
(ConditionPathExists in the service file). This is intentional — ADB is
disabled by default for security. Create the file at image build time or
at runtime to enable it.
Requires kernel config for USB gadget support (e.g. via a .cfg fragment):
CONFIG_USB_DWC2_DUAL_ROLE=y
CONFIG_USB_GADGET=y
CONFIG_USB_CONFIGFS=y
CONFIG_USB_F_FS=y
CONFIG_USB_CONFIGFS_F_FS=y
Requires in local.conf for RPi4:
RPI_EXTRA_CONFIG = "dtoverlay=dwc2,dr_mode=peripheral"
AI-Generated: Uses GitHub Copilot (Claude Sonnet 4.6)
Signed-off-by: Mihajlo Marinkovic <mmarinkovic@snap.com>
Tested-by: Etienne Cordonnier <ecordonnier@snap.com>
Co-authored-by: Etienne Cordonnier <ecordonnier@snap.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
The commit 33c1e33d23 ("android-tools: remove android-tools 5.x from
meta-oe/recipes-devtools") blindly dropped all recipes from the
android-tools dir. Later commits moved the android-tools recipe and
other related recipes from the SELinux dynamic layer, bumping the
version to 29.x, but somehow the author of the patches didn't notice
that the resulting set of packages doesn't work out of box on any
upstream kernels, as the default android-tools-conf setup scripts use
Android-proprietary way of setting up the USB gadget
(/sys/class/android_usb).
Bring back the android-tools-conf-configs recipe, which uses upstream
mechanism (ConfigFS) to setup the USB gadget for ADB.
Fixes: 33c1e33d23 ("android-tools: remove android-tools 5.x from meta-oe/recipes-devtools")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Remove .h header files from the SOURCES compilation list inside adbd.mk
to resolve a Clang warning regarding treating 'c-header' input as 'c++-header'
Moved the header files into a separate HEADERS variable to act purely as a
GNU Make dependency trigger, keeping them off the direct compiler
execution string.
Signed-off-by: AshishKumar Mishra <ashishkumar.mishra@bmwtechworks.in>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
Relocate the recipe from dynamic-layers/selinux/ to the main
meta-oe/recipes-devtools/ directory.
The android-tools recipe (version 29.0.6.r14) was previously restricted
to the selinux dynamic-layer.
Investigation shows that version 29.0.6.r14 does not have a hard dependency
on libselinux for core tool functionality.
(adb, fastboot, and sparse image tools).
- Basic runable test was done for binaries in android-tools-native
- Checked for selinux absense by looking for selinx using $ ldd binary-name
Changes:
- Relocate recipe from dynamic-layers/selinux/ to recipes-devtools/
Signed-off-by: AshishKumar Mishra <ashishkumar.mishra@bmwtechworks.in>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
We plan to upgrade android-tools from the legacy 5.1.1 version to 29.0.6.r14
To achive this we are removing the older version from meta-oe/recipes-devtools/
Signed-off-by: AshishKumar Mishra <ashishkumar.mishra@bmwtechworks.in>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
The android-gadget-setup script currently hardcodes the USB vendor ID,
product ID, and configuration string. This makes it difficult for BSP
layers to customize USB gadget identity with platform specific values.
Introduce variables for the vendor ID, product ID, and configuration
string when populating the configfs attributes. This allows machine
or distro specific overrides via `/etc/android-gadget-setup.machine`,
while preserving the existing default values.
Signed-off-by: Viswanath Kraleti <viswanath.kraleti@oss.qualcomm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
- The build completes successfully without adding the flag. In fact, the flag is never actually added. Because:
If we use the += operator to add flags to the CC variable early in the recipe, changes will be overwritten because BitBake applies class assignments to CC at a later stage, which replaces any previous modifications. We should use :append to ensure that additions are applied to the final value, after all assignments from core classes have been processed.
- Additionally, the standard way to pass compiler flags in C projects is to use CFLAGS.
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Please see
https://git.yoctoproject.org/poky/commit/?id=4dd321f8b83afecd962393101b2a6861275b5265
for what changes are needed, and sed commands that can be used to make them en masse.
I've verified that bitbake -c patch world works with these, but did not run a world
build; the majority of recipes shouldn't need further fixups, but if there are
some that still fall out, they can be fixed in followups.
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This reverts commits 4271cc2827 ("android-tools: Add flag to enable
adbd service (#147)") and b85ae59968 ("android-tools 10: Add flag to
enable adbd service"). These two commits added optional
ROOTFS_POSTPROCESS_COMMAND touching the flag file, however this variable
doesn't make any sense in the package recipe, it is only concerned in
the image context.
Drop useless code from the android-tools recipe.
Fixes: 4271cc2827 ("android-tools: Add flag to enable adbd service (#147)")
Fixes: b85ae59968 ("android-tools 10: Add flag to enable adbd service")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Building of android-tools-native aborted due to
missing dependency with android-tools-conf-native.
Fixed by extending android-tools-conf-configfs_1.0.bb recipe to build native
Signed-off-by: Christos Gavros <gavrosc@yahoo.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
The patches by Raghuvarya changed the location of the file that systemd
uses to check whether to start the adbd or not. However those patches
completely ignored creating those two flag files, as done by the
android-tools recipes.
Make the android-tools create the /etc/usb-debugging-enabled file so
that it's possible to enable the adbd automatically.
Fixes: a29c6386d5 ("android-toold-adbd: Fix inconsistency between selinux configurations")
Fixes: 8106cfe769 ("android-tools-adbd.service: Change /var to /etc in ConditionPathExists")
Cc: Raghuvarya S <quic_raghuvar@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
If android-tools-adbd.service service needs to be up upon boot, then the path assigned to ConditionPathExists must be present at boot time. This means that the path set to ConditionPathExists must be created at build time itself. /etc is a better place to keep files and directories that are created at build time rather than /var. /var is expected to house files that are created at run time.
Hence, change ConditionPathExists=/var/usb-debugging-enabled to ConditionPathExists=/etc/usb-debugging-enabled
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Fix the warning by pointing S to ${WORKDIR}/sources and UNPACKDIR to ${S}. Since recent UNPACKDIR work, default S directory is not created anymore. By setting UNPACKDIR to S, S in indirectly created in do_unpack.
Signed-off-by: alperak <alperyasinak1@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
GCC 14.0 being stricter regarding const pointers pointed out the issue
in the adb_libssl_11.diff. RSA_get0_key returns pointers to internal
data of an RSA key structure. As such, this data should use const
pointers, should not be allocated and, more importantly, should not be
freed. Update the patch to use const pointers, drop allocation and
freeing of the 'n' big number.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
android-tools-configfs doesn't have any checked out source files, which
results in a warning regarding S not existing. Fix the warning by
pointing S to ${WORKDIR}/sources and UNPACKDIR to ${S}.
The warning text:
WARNING: android-tools-conf-configfs-1.0-r0 do_unpack:
android-tools-conf-configfs: the directory ${WORKDIR}/${BP} (<scrubbed>)
pointed to by the S variable doesn't exist - please set S within the
recipe to point to where the source has been unpacked to
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Replace references of WORKDIR with UNPACKDIR where it makes sense to do
so in preparation for changing the default value of UNPACKDIR.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Replace all filenames in the object with "--file-prefix-map"
which is lost when resetting CFLAGS.
Signed-off-by: Christian Hohnstaedt <christian@hohnstaedt.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
There is new patch-status QA check in oe-core:
https://git.openembedded.org/openembedded-core/commit/?id=76a685bfcf927593eac67157762a53259089ea8a
This is temporary work around just to hide _many_ warnings from
optional patch-status (if you add it to WARN_QA).
This just added
Upstream-Status: Pending
everywhere without actually investigating what's the proper status.
This is just to hide current QA warnings and to catch new .patch files being
added without Upstream-Status, but the number of Pending patches is now terrible:
5 (26%) meta-xfce
6 (50%) meta-perl
15 (42%) meta-webserver
21 (36%) meta-gnome
25 (57%) meta-filesystems
26 (43%) meta-initramfs
45 (45%) meta-python
47 (55%) meta-multimedia
312 (63%) meta-networking
756 (61%) meta-oe
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Several Qualcomm platforms support setting two or more (or even all)
UDC controllers in 'peripheral' mode. Modify the android-tools-conf-configfs
scriptware to handle such cases.
Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Increase sleep to 10 seconds otherwise interface is not ready on rpi0w.
Signed-off-by: Devendra Tewari <devendra.tewari@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
By default, img2simg will only generate raw and fill chunks. This adds
support for "don't care" chunks, based on file holes. This is similar to
how bmaptool works. "don't care" chunks do not need to be written,
speeding up flashing time.
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
android-tools-adbd service can be enabled in the image using
USB_DEBUGGING_ENABLED = "1" in local.conf.
Signed-off-by: Devendra Tewari <devendra.tewari@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This is the result of automated script (0.9.1) conversion:
oe-core/scripts/contrib/convert-overrides.py .
converting the metadata to use ":" as the override character instead of "_".
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Overriding TOOLS with 'adb' as the only entry, or with 'adb' as the
final entry in the list fails to match the grep pattern. The current
pattern includes trailing whitespace, likely to distinguish it from
'adbd'. However since `${TOOLS}` is then passed to grep unquoted, any
trailing whitespace would be dropped by the shell.
Fixed by replacing the trailing whitespace with '\>' to mark the end of
the word, which continues to ensure we don't match against 'adbd'.
Signed-off-by: Ben Brown <ben.brown@codethink.co.uk>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Stray newline character causes errors in functionfs setup scripts
used by android-tools-adbd.service, when using musl libc and/or toybox.
Signed-off-by: Devendra Tewari <devendra.tewari@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
The licenses were renamed to match their SPDX names, fix the
references in LIC_FILES_CHKSUM
Correct the checksums where they were wrong
Signed-off-by: Khem Raj <raj.khem@gmail.com>
If PREFERRED_PROVIDER_android-tool-conf is set, build-deps checker will
incorrectly resolve android-tools-conf runtime dependency to
android-tools-conf recipe rather than the selected recipe. To fix the
following warning, make android-tools-conf recipe raise SkipRecipe if it
is not the preferred android-tools-conf provider.
WARNING: android-tools-5.1.1.r37-r0 do_package_qa: QA Issue: android-tools-adbd rdepends on android-tools-conf, but it isn't a build dependency, missing android-tools-conf in DEPENDS or PACKAGECONFIG? [build-deps]
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
The package android-tools-conf depends on presence of
/sys/class/android_usb, which is not present in default (mainline)
kernels. Add a set of scripts that will use ConfigFS to configure USB
gadget rather than using non-standard device class.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Usually one would install adbd on a device, where adb and mkbootimg are
of little use. Split adbd to the separate package.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
"${PN}-fstools" was added to the end of PACKAGES list, so it received no
files. Move the package name to the beginning of PACKAGES list to fix
packages split ending up with non-empty android-tools-fstools package.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Risc-V ADB implementation is based on ARM64 implemtentation.
The core change is leverage fence command to implement memroy barrier
featrue.
Signed-off-by: Khem Raj <raj.khem@gmail.com>