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