1DESCRIPTION = "Different utilities from Android" 2SECTION = "console/utils" 3LICENSE = "Apache-2.0 & GPL-2.0-only & BSD-2-Clause & BSD-3-Clause" 4LIC_FILES_CHKSUM = " \ 5 file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ 6 file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \ 7 file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f \ 8 file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ 9" 10DEPENDS = "libbsd libpcre zlib libcap libusb squashfs-tools p7zip libselinux" 11 12ANDROID_MIRROR = "android.googlesource.com" 13 14# matches with 10.0.0+r36 15SRCREV_boringssl = "ae2dd49c7cb74d04bdba7c1c9bd62c1e9cdf98f6" 16SRCREV_core = "5aa13b053182b758d7a19db0c83e1b9b5bf1ec2e" 17SRCREV_extras = "d31740f9d0399f8b938e88e58843d966e1cccab6" 18SRCREV_libhardware = "c6925520342a7d37758f85eb1cf3baa20a7b7a18" 19SRCREV_build = "28768b3120f751583a2743101b892f210d4715cf" 20SRCREV_libunwind = "03a963ecf6ea836b38b3537cbcda0ecfd7a77393" 21 22SRC_URI = " \ 23 git://salsa.debian.org/android-tools-team/android-platform-external-boringssl;name=boringssl;protocol=https;nobranch=1;destsuffix=git/external/boringssl \ 24 git://salsa.debian.org/android-tools-team/android-platform-system-core;name=core;protocol=https;nobranch=1;destsuffix=git/system/core \ 25 git://salsa.debian.org/android-tools-team/android-platform-system-extras;name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras \ 26 git://${ANDROID_MIRROR}/platform/hardware/libhardware;name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \ 27 git://salsa.debian.org/android-tools-team/android-platform-build.git;name=build;protocol=https;nobranch=1;destsuffix=git/build \ 28 git://salsa.debian.org/android-tools-team/android-platform-external-libunwind.git;protocol=https;name=libunwind;nobranch=1;destsuffix=git/external/libunwind \ 29" 30 31# Patches copied from android-platform-system-core/debian/patches 32# and applied in the order defined by the "series" file 33SRC_URI += " \ 34 file://core-debian/move-log-file-to-proper-dir.patch;patchdir=system/core \ 35 file://core-debian/Added-missing-headers.patch;patchdir=system/core \ 36 file://core-debian/libusb-header-path.patch;patchdir=system/core \ 37 file://core-debian/stdatomic.patch;patchdir=system/core \ 38 file://core-debian/Nonnull.patch;patchdir=system/core \ 39 file://core-debian/Vector-cast.patch;patchdir=system/core \ 40 file://core-debian/use-Python-3-for-mkbootimg.patch;patchdir=system/core \ 41 file://core-debian/throw-exception-on-unknown-os.patch;patchdir=system/core \ 42 file://core-debian/simg_dump-python3.patch;patchdir=system/core \ 43 file://core-debian/fix-attribute-issue-with-gcc.patch;patchdir=system/core \ 44 file://core-debian/workaround-error-expected-primary-expression-before-.-token.patch;patchdir=system/core \ 45 file://core-debian/fix-gettid-exception-declaration.patch;patchdir=system/core \ 46 file://core-debian/fix-build-on-non-x86.patch;patchdir=system/core \ 47 file://core-debian/add-missing-headers.patch;patchdir=system/core \ 48 file://core-debian/hard-code-build-number.patch;patchdir=system/core \ 49 file://core-debian/fix-gcc-11-ftbfs.patch;patchdir=system/core \ 50 file://core-debian/fix-gnu-hurd.patch;patchdir=system/core \ 51" 52 53# Patches copied from android-platform-external-libunwind/debian/patches 54# and applied in the order defined by the "series" file 55SRC_URI += " \ 56 file://libunwind-debian/user_pt_regs.patch;patchdir=external/libunwind \ 57 file://libunwind-debian/legacy_built-in_sync_functions.patch;patchdir=external/libunwind \ 58 file://libunwind-debian/20150704-CVE-2015-3239_dwarf_i.h.patch;patchdir=external/libunwind \ 59" 60 61# meta-clang specific patches + files: 62SRC_URI += " \ 63 file://core/0001-patching-adb.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ 64 file://core/0002-libadb.mk-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \ 65 file://core/0003-socket.h-removing-dependency-of-gtest.patch;patchdir=system/core \ 66 file://core/0004-patching-fastboot.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ 67 file://core/0005-fastboot-don-t-use-sparse_file_import_auto-in-load_b.patch;patchdir=system/core \ 68 file://core/0006-libbase.mk-modifications-to-make-it-build-in-yocto-e.patch;patchdir=system/core \ 69 file://core/0007-libcrypto_utils.mk-modifications-to-make-it-build-in.patch;patchdir=system/core \ 70 file://core/0008-libcutils-modifications-to-make-it-build-in-yocto-en.patch;patchdir=system/core \ 71 file://core/0009-patching-img2simg.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ 72 file://core/0010-patching-simg2img.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ 73 file://core/0011-patching-liblog.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ 74 file://core/0012-patching-libsparse.mk-to-build-in-yocto-environment.patch;patchdir=system/core \ 75 file://core/0013-patching-libziparchive.mk-to-build-in-yocto-environm.patch;patchdir=system/core \ 76 file://core/0014-patching-libbacktrace.mk-to-build-in-yocto-environme.patch;patchdir=system/core \ 77 file://core/0015-Use-namespace-std-to-compile-libbacktrace.patch;patchdir=system/core \ 78 file://0001-libcrypto.mk-modifications-to-make-it-build-in-yocto.patch;patchdir=external/boringssl \ 79 file://0001-patching-libundwind-to-build-in-yocto-environment.patch;patchdir=external/libunwind \ 80 file://0001-libext4_utils.mk-modifications-to-make-it-build-in-y.patch;patchdir=system/extras \ 81 file://0002-libfec-change-out_dir-in-makefile.patch;patchdir=system/extras \ 82 file://rules_yocto.mk;subdir=git \ 83 file://android-tools-adbd.service \ 84" 85 86S = "${WORKDIR}/git" 87B = "${WORKDIR}/${BPN}" 88 89# http://errors.yoctoproject.org/Errors/Details/1debian881/ 90ARM_INSTRUCTION_SET:armv4 = "arm" 91ARM_INSTRUCTION_SET:armv5 = "arm" 92 93COMPATIBLE_HOST:powerpc = "(null)" 94COMPATIBLE_HOST:powerpc64 = "(null)" 95COMPATIBLE_HOST:powerpc64le = "(null)" 96 97inherit systemd clang 98 99TOOLCHAIN = "clang" 100TOOLCHAIN:class-native = "clang" 101DEPENDS:append:class-target = "\ 102 clang-cross-${TARGET_ARCH} \ 103" 104DEPENDS:append:class-native = " clang-native" 105 106SYSTEMD_SERVICE:${PN} = "android-tools-adbd.service" 107 108# Find libbsd headers during native builds 109CC:append:class-native = " -I${STAGING_INCDIR}" 110CC:append:class-nativesdk = " -I${STAGING_INCDIR}" 111 112PREREQUISITE_core = "libbase libsparse liblog libcutils" 113TOOLS_TO_BUILD = "libcrypto_utils libadb libziparchive fastboot adb img2simg simg2img libbacktrace" 114 115# Adb needs sys/capability.h, which is not available for native* 116TOOLS:class-native = "boringssl fastboot ext4_utils mkbootimg" 117TOOLS:class-nativesdk = "boringssl fastboot ext4_utils mkbootimg" 118 119do_compile() { 120 121 case "${HOST_ARCH}" in 122 arm) 123 export android_arch=linux-arm 124 cpu=arm 125 deb_host_arch=arm 126 ;; 127 aarch64) 128 export android_arch=linux-arm64 129 cpu=arm64 130 deb_host_arch=arm64 131 ;; 132 riscv64) 133 export android_arch=linux-riscv64 134 ;; 135 mips|mipsel) 136 export android_arch=linux-mips 137 cpu=mips 138 deb_host_arch=mips 139 ;; 140 mips64|mips64el) 141 export android_arch=linux-mips64 142 cpu=mips64 143 deb_host_arch=mips64 144 ;; 145 powerpc|powerpc64) 146 export android_arch=linux-ppc 147 ;; 148 i586|i686|x86_64) 149 export android_arch=linux-x86 150 cpu=x86_64 151 deb_host_arch=amd64 152 ;; 153 esac 154 155 export SRCDIR=${S} 156 157 oe_runmake -f ${S}/external/boringssl/debian/libcrypto.mk -C ${S}/external/boringssl 158 oe_runmake -f ${S}/external/libunwind/debian/libunwind.mk -C ${S}/external/libunwind CPU=${cpu} 159 160 for tool in ${PREREQUISITE_core}; do 161 oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core 162 done 163 164 for i in `find ${S}/system/extras/debian/ -name "*.mk"`; do 165 oe_runmake -f $i -C ${S}/system/extras 166 done 167 168 for tool in ${TOOLS_TO_BUILD}; do 169 if [ "$tool" == "libbacktrace" ]; then 170 oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core DEB_HOST_ARCH=${deb_host_arch} 171 else 172 oe_runmake -f ${S}/system/core/debian/${tool}.mk -C ${S}/system/core 173 fi 174 done 175 176} 177 178do_install() { 179 if echo ${TOOLS_TO_BUILD} | grep -q "ext4_utils" ; then 180 install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump 181 fi 182 183 if echo ${TOOLS_TO_BUILD} | grep -q "adb " ; then 184 install -d ${D}${bindir} 185 install -m0755 ${S}/debian/out/usr/lib/android/adb/adb ${D}${bindir} 186 fi 187 188 if echo ${TOOLS_TO_BUILD} | grep -q "adbd" ; then 189 install -d ${D}${bindir} 190 install -m0755 ${B}/adbd/adbd ${D}${bindir} 191 fi 192 193 # Outside the if statement to avoid errors during do_package 194 install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ 195 ${D}${systemd_unitdir}/system/android-tools-adbd.service 196 197 if echo ${TOOLS_TO_BUILD} | grep -q "fastboot" ; then 198 install -d ${D}${bindir} 199 install -m0755 ${S}/debian/out/usr/bin/fastboot/fastboot ${D}${bindir} 200 fi 201 202 install -d ${D}${libdir}/android/ 203 install -m0755 ${S}/debian/out/usr/lib/android/*.so.* ${D}${libdir}/android/ 204 if echo ${TOOLS_TO_BUILD} | grep -q "mkbootimg" ; then 205 install -d ${D}${bindir} 206 install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} 207 fi 208} 209 210PACKAGES += "${PN}-fstools" 211 212RDEPENDS:${BPN} = "${BPN}-conf p7zip" 213 214FILES:${PN}-fstools = "\ 215 ${bindir}/ext2simg \ 216 ${bindir}/ext4fixup \ 217 ${bindir}/img2simg \ 218 ${bindir}/make_ext4fs \ 219 ${bindir}/simg2img \ 220 ${bindir}/simg2simg \ 221 ${bindir}/simg_dump \ 222 ${bindir}/mkuserimg \ 223" 224FILES:${PN} += "${libdir}/android ${libdir}/android/*" 225 226BBCLASSEXTEND = "native" 227