Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 1 | DESCRIPTION = "Different utilities from Android" |
| 2 | SECTION = "console/utils" |
| 3 | LICENSE = "Apache-2.0 & GPL-2.0 & BSD-2-Clause & BSD-3-Clause" |
| 4 | LIC_FILES_CHKSUM = " \ |
| 5 | file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \ |
| 6 | file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \ |
| 7 | file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=8bef8e6712b1be5aa76af1ebde9d6378 \ |
| 8 | file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \ |
| 9 | " |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 10 | DEPENDS = "libbsd libpcre openssl zlib libcap" |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 11 | |
| 12 | ANDROID_TAG = "android-5.1.1_r37" |
| 13 | ANDROID_MIRROR = "android.googlesource.com" |
| 14 | CORE_REPO = "${ANDROID_MIRROR}/platform/system/core" |
| 15 | EXTRAS_REPO = "${ANDROID_MIRROR}/platform/system/extras" |
| 16 | LIBHARDWARE_REPO = "${ANDROID_MIRROR}/platform/hardware/libhardware" |
| 17 | LIBSELINUX_REPO = "${ANDROID_MIRROR}/platform/external/libselinux" |
| 18 | BUILD_REPO = "${ANDROID_MIRROR}/platform/build" |
| 19 | |
| 20 | SRC_URI = " \ |
| 21 | git://${CORE_REPO};name=core;protocol=https;nobranch=1;destsuffix=git/system/core;tag=${ANDROID_TAG} \ |
| 22 | git://${EXTRAS_REPO};name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras;tag=${ANDROID_TAG} \ |
| 23 | git://${LIBHARDWARE_REPO};name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware;tag=${ANDROID_TAG} \ |
| 24 | git://${LIBSELINUX_REPO};name=libselinux;protocol=https;nobranch=1;destsuffix=git/external/libselinux;tag=${ANDROID_TAG} \ |
| 25 | git://${BUILD_REPO};name=build;protocol=https;nobranch=1;destsuffix=git/build;tag=${ANDROID_TAG} \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 26 | file://remove-selinux-android.patch \ |
| 27 | file://use-capability.patch \ |
| 28 | file://use-local-socket.patch \ |
| 29 | file://preserve-ownership.patch \ |
| 30 | file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch \ |
| 31 | file://remove-bionic-android.patch \ |
| 32 | file://define-shell-command.patch \ |
| 33 | file://implicit-declaration-function-strlcat-strlcopy.patch \ |
| 34 | file://fix-big-endian-build.patch \ |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 35 | file://android-tools-adbd.service \ |
| 36 | file://.gitignore;subdir=git \ |
| 37 | file://adb.mk;subdir=${BPN} \ |
| 38 | file://adbd.mk;subdir=${BPN} \ |
| 39 | file://ext4_utils.mk;subdir=${BPN} \ |
| 40 | file://fastboot.mk;subdir=${BPN} \ |
| 41 | file://mkbootimg.mk;subdir=${BPN} \ |
| 42 | " |
| 43 | |
| 44 | S = "${WORKDIR}/git" |
| 45 | B = "${WORKDIR}/${BPN}" |
| 46 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 47 | # http://errors.yoctoproject.org/Errors/Details/133881/ |
| 48 | ARM_INSTRUCTION_SET_armv4 = "arm" |
| 49 | ARM_INSTRUCTION_SET_armv5 = "arm" |
| 50 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 51 | inherit systemd |
| 52 | |
| 53 | SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service" |
| 54 | |
| 55 | # Get rid of files uneeded to build Android tools |
| 56 | do_unpack_extra() { |
| 57 | cd ${S} |
| 58 | rm -rf \ |
| 59 | system/core/.git \ |
| 60 | system/extras/.git \ |
| 61 | hardware/libhardware/.git \ |
| 62 | external/libselinux/.git \ |
| 63 | build/.git |
| 64 | git init |
| 65 | git add . |
| 66 | git commit -m \ |
| 67 | "Initial import - committed ${ANDROID_TAG}" |
| 68 | git clean -fdx |
| 69 | } |
| 70 | |
| 71 | addtask unpack_extra after do_unpack before do_patch |
| 72 | |
| 73 | # Find libbsd headers during native builds |
| 74 | CC_append_class-native = " -I${STAGING_INCDIR}" |
| 75 | CC_append_class-nativesdk = " -I${STAGING_INCDIR}" |
| 76 | |
| 77 | TOOLS = "adb fastboot ext4_utils mkbootimg adbd" |
| 78 | |
| 79 | # Adb needs sys/capability.h, which is not available for native* |
| 80 | TOOLS_class-native = "fastboot ext4_utils mkbootimg" |
| 81 | TOOLS_class-nativesdk = "fastboot ext4_utils mkbootimg" |
| 82 | |
| 83 | do_compile() { |
| 84 | # Setting both variables below causing our makefiles to not work with |
| 85 | # implicit make rules |
| 86 | unset CFLAGS |
| 87 | unset CPPFLAGS |
| 88 | |
| 89 | export SRCDIR=${S} |
| 90 | |
| 91 | case "${HOST_ARCH}" in |
| 92 | arm) |
| 93 | export android_arch=linux-arm |
| 94 | ;; |
| 95 | aarch64) |
| 96 | export android_arch=linux-arm64 |
| 97 | ;; |
| 98 | mips|mipsel) |
| 99 | export android_arch=linux-mips |
| 100 | ;; |
| 101 | powerpc|powerpc64) |
| 102 | export android_arch=linux-ppc |
| 103 | ;; |
| 104 | i586|x86_64) |
| 105 | export android_arch=linux-x86 |
| 106 | ;; |
| 107 | esac |
| 108 | |
| 109 | for tool in ${TOOLS}; do |
| 110 | mkdir -p ${B}/${tool} |
| 111 | oe_runmake -f ${B}/${tool}.mk -C ${B}/${tool} |
| 112 | done |
| 113 | } |
| 114 | |
| 115 | do_install() { |
| 116 | if echo ${TOOLS} | grep -q "ext4_utils" ; then |
| 117 | install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump |
| 118 | install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg |
| 119 | |
| 120 | install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir} |
| 121 | install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir} |
| 122 | install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir} |
| 123 | install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir} |
| 124 | install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir} |
| 125 | install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir} |
| 126 | fi |
| 127 | |
| 128 | if echo ${TOOLS} | grep -q "adb " ; then |
| 129 | install -d ${D}${bindir} |
| 130 | install -m0755 ${B}/adb/adb ${D}${bindir} |
| 131 | fi |
| 132 | |
| 133 | if echo ${TOOLS} | grep -q "adbd" ; then |
| 134 | install -d ${D}${bindir} |
| 135 | install -m0755 ${B}/adbd/adbd ${D}${bindir} |
| 136 | fi |
| 137 | |
| 138 | # Outside the if statement to avoid errors during do_package |
| 139 | install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \ |
| 140 | ${D}${systemd_unitdir}/system/android-tools-adbd.service |
| 141 | |
| 142 | if echo ${TOOLS} | grep -q "fastboot" ; then |
| 143 | install -d ${D}${bindir} |
| 144 | install -m0755 ${B}/fastboot/fastboot ${D}${bindir} |
| 145 | fi |
| 146 | |
| 147 | if echo ${TOOLS} | grep -q "mkbootimg" ; then |
| 148 | install -d ${D}${bindir} |
| 149 | install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir} |
| 150 | fi |
| 151 | } |
| 152 | |
| 153 | PACKAGES += "${PN}-fstools" |
| 154 | |
| 155 | RDEPENDS_${BPN} = "${BPN}-conf bash" |
| 156 | |
| 157 | FILES_${PN}-fstools = "\ |
| 158 | ${bindir}/ext2simg \ |
| 159 | ${bindir}/ext4fixup \ |
| 160 | ${bindir}/img2simg \ |
| 161 | ${bindir}/make_ext4fs \ |
| 162 | ${bindir}/simg2img \ |
| 163 | ${bindir}/simg2simg \ |
| 164 | ${bindir}/simg_dump \ |
| 165 | ${bindir}/mkuserimg \ |
| 166 | " |
| 167 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 168 | BBCLASSEXTEND = "native" |