1DESCRIPTION = "Different utilities from Android" 2SECTION = "console/utils" 3LICENSE = "Apache-2.0 & GPL-2.0 & 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" 11DEPENDS:append:class-target = " openssl" 12 13ANDROID_MIRROR = "android.googlesource.com" 14 15# matches with android-5.1.1_r37 16SRCREV_core = "2314b110bdebdbfd2d94c502282f9e57c849897e" 17SRCREV_extras = "3ecbe8d841df96127d7855661293e5ab6ba6c205" 18SRCREV_libhardware = "be55eb1f4d840c82ffaf7c47460df17ff5bc4d9b" 19SRCREV_libselinux = "07e9e1339ad1ba608acfba9dce2d0f474b252feb" 20SRCREV_build = "16e987def3d7d8f7d30805eb95cef69e52a87dbc" 21 22SRC_URI = " \ 23 git://${ANDROID_MIRROR}/platform/system/core;name=core;protocol=https;nobranch=1;destsuffix=git/system/core \ 24 git://${ANDROID_MIRROR}/platform/system/extras;name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras \ 25 git://${ANDROID_MIRROR}/platform/hardware/libhardware;name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \ 26 git://${ANDROID_MIRROR}/platform/external/libselinux;name=libselinux;protocol=https;nobranch=1;destsuffix=git/external/libselinux \ 27 git://${ANDROID_MIRROR}/platform/build;name=build;protocol=https;nobranch=1;destsuffix=git/build \ 28 file://core/0001-adb-remove-selinux-extensions.patch;patchdir=system/core \ 29 file://core/0002-adb-Use-local-sockets-where-appropriate.patch;patchdir=system/core \ 30 file://core/0003-adb-define-shell-command.patch;patchdir=system/core \ 31 file://core/0004-adb-Fix-build-on-big-endian-systems.patch;patchdir=system/core \ 32 file://core/0005-adb-add-base64-implementation.patch;patchdir=system/core \ 33 file://core/0006-adb-Musl-fixes.patch;patchdir=system/core \ 34 file://core/0007-adb-usb_linux.c-fix-build-with-glibc-2.28.patch;patchdir=system/core \ 35 file://core/0008-adb-Allow-adbd-to-be-ran-as-root.patch;patchdir=system/core \ 36 file://core/0009-mkbootimg-Add-dt-parameter-to-specify-DT-image.patch;patchdir=system/core \ 37 file://core/0010-Use-linux-capability.h-on-linux-systems-too.patch;patchdir=system/core \ 38 file://core/0011-Remove-bionic-specific-calls.patch;patchdir=system/core \ 39 file://core/0012-Fix-implicit-declaration-of-stlcat-strlcopy-function.patch;patchdir=system/core \ 40 file://core/adb_libssl_11.diff;patchdir=system/core \ 41 file://core/0013-adb-Support-riscv64.patch;patchdir=system/core \ 42 file://extras/0001-ext4_utils-remove-selinux-extensions.patch;patchdir=system/extras \ 43 file://extras/0002-ext4_utils-add-o-argument-to-preserve-ownership.patch;patchdir=system/extras \ 44 file://libselinux/0001-Remove-bionic-specific-calls.patch;patchdir=external/libselinux \ 45 file://libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch;patchdir=external/libselinux \ 46 file://android-tools-adbd.service \ 47 file://build/0001-Riscv-Add-risc-v-Android-config-header.patch;patchdir=build \ 48 file://gitignore \ 49 file://adb.mk;subdir=${BPN} \ 50 file://adbd.mk;subdir=${BPN} \ 51 file://ext4_utils.mk;subdir=${BPN} \ 52 file://fastboot.mk;subdir=${BPN} \ 53 file://mkbootimg.mk;subdir=${BPN} \ 54" 55 56 57S = "${WORKDIR}/git" 58B = "${WORKDIR}/${BPN}" 59 60# http://errors.yoctoproject.org/Errors/Details/133881/ 61ARM_INSTRUCTION_SET:armv4 = "arm" 62ARM_INSTRUCTION_SET:armv5 = "arm" 63 64COMPATIBLE_HOST:powerpc = "(null)" 65COMPATIBLE_HOST:powerpc64 = "(null)" 66COMPATIBLE_HOST:powerpc64le = "(null)" 67 68inherit systemd 69 70SYSTEMD_PACKAGES = "${PN}-adbd" 71SYSTEMD_SERVICE:${PN}-adbd = "android-tools-adbd.service" 72 73# Find libbsd headers during native builds 74CC:append:class-native = " -I${STAGING_INCDIR}" 75CC:append:class-nativesdk = " -I${STAGING_INCDIR}" 76 77TOOLS = "adb fastboot ext4_utils mkbootimg adbd" 78 79# Adb needs sys/capability.h, which is not available for native* 80TOOLS:class-native = "fastboot ext4_utils mkbootimg" 81TOOLS:class-nativesdk = "fastboot ext4_utils mkbootimg" 82 83do_compile() { 84 cp ${WORKDIR}/gitignore ${S}/.gitignore 85 86 # Setting both variables below causing our makefiles to not work with 87 # implicit make rules 88 unset CFLAGS 89 unset CPPFLAGS 90 91 export SRCDIR=${S} 92 93 case "${HOST_ARCH}" in 94 arm) 95 export android_arch=linux-arm 96 ;; 97 aarch64) 98 export android_arch=linux-arm64 99 ;; 100 riscv64) 101 export android_arch=linux-riscv64 102 ;; 103 mips|mipsel) 104 export android_arch=linux-mips 105 ;; 106 mips64|mips64el) 107 export android_arch=linux-mips64 108 ;; 109 powerpc|powerpc64) 110 export android_arch=linux-ppc 111 ;; 112 i586|i686|x86_64) 113 export android_arch=linux-x86 114 ;; 115 esac 116 117 for tool in ${TOOLS}; do 118 mkdir -p ${B}/${tool} 119 oe_runmake -f ${B}/${tool}.mk -C ${B}/${tool} 120 done 121} 122 123do_install() { 124 if echo ${TOOLS} | grep -q "ext4_utils" ; then 125 install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump 126 install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg 127 128 install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir} 129 install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir} 130 install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir} 131 install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir} 132 install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir} 133 install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir} 134 fi 135 136 if echo ${TOOLS} | grep -q "adb\>" ; then 137 install -d ${D}${bindir} 138 install -m0755 ${B}/adb/adb ${D}${bindir} 139 fi 140 141 if echo ${TOOLS} | grep -q "adbd" ; then 142 install -d ${D}${bindir} 143 install -m0755 ${B}/adbd/adbd ${D}${bindir} 144 fi 145 146 # Outside the if statement to avoid errors during do_package 147 install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ 148 ${D}${systemd_unitdir}/system/android-tools-adbd.service 149 150 if echo ${TOOLS} | grep -q "fastboot" ; then 151 install -d ${D}${bindir} 152 install -m0755 ${B}/fastboot/fastboot ${D}${bindir} 153 fi 154 155 if echo ${TOOLS} | grep -q "mkbootimg" ; then 156 install -d ${D}${bindir} 157 install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} 158 fi 159} 160 161PACKAGES =+ "${PN}-fstools ${PN}-adbd" 162 163RDEPENDS:${PN}-adbd = "${PN}-conf" 164RDEPENDS:${PN}-fstools = "bash" 165 166FILES:${PN}-adbd = "\ 167 ${bindir}/adbd \ 168 ${systemd_unitdir}/system/android-tools-adbd.service \ 169" 170 171FILES:${PN}-fstools = "\ 172 ${bindir}/ext2simg \ 173 ${bindir}/ext4fixup \ 174 ${bindir}/img2simg \ 175 ${bindir}/make_ext4fs \ 176 ${bindir}/simg2img \ 177 ${bindir}/simg2simg \ 178 ${bindir}/simg_dump \ 179 ${bindir}/mkuserimg \ 180" 181 182BBCLASSEXTEND = "native" 183