blob: 780ecaa11afd1f39d6c1d0c00ad7630bd52c3339 [file] [log] [blame]
Patrick Williamsddad1a12017-02-23 20:36:32 -06001DESCRIPTION = "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;md5=801f80980d171dd6425610833a22dbe6 \
7 file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=8bef8e6712b1be5aa76af1ebde9d6378 \
8 file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \
9"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010DEPENDS = "libbsd libpcre openssl zlib libcap"
Patrick Williamsddad1a12017-02-23 20:36:32 -060011
Patrick Williamsddad1a12017-02-23 20:36:32 -060012ANDROID_MIRROR = "android.googlesource.com"
13CORE_REPO = "${ANDROID_MIRROR}/platform/system/core"
14EXTRAS_REPO = "${ANDROID_MIRROR}/platform/system/extras"
15LIBHARDWARE_REPO = "${ANDROID_MIRROR}/platform/hardware/libhardware"
16LIBSELINUX_REPO = "${ANDROID_MIRROR}/platform/external/libselinux"
17BUILD_REPO = "${ANDROID_MIRROR}/platform/build"
18
Brad Bishop316dfdd2018-06-25 12:45:53 -040019# matches with android-5.1.1_r37
20SRCREV_core = "2314b110bdebdbfd2d94c502282f9e57c849897e"
21SRCREV_extras = "3ecbe8d841df96127d7855661293e5ab6ba6c205"
22SRCREV_libhardware = "be55eb1f4d840c82ffaf7c47460df17ff5bc4d9b"
23SRCREV_libselinux = "07e9e1339ad1ba608acfba9dce2d0f474b252feb"
24SRCREV_build = "16e987def3d7d8f7d30805eb95cef69e52a87dbc"
25
Patrick Williamsddad1a12017-02-23 20:36:32 -060026SRC_URI = " \
Brad Bishop316dfdd2018-06-25 12:45:53 -040027 git://${CORE_REPO};name=core;protocol=https;nobranch=1;destsuffix=git/system/core \
28 git://${EXTRAS_REPO};name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras \
29 git://${LIBHARDWARE_REPO};name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware \
30 git://${LIBSELINUX_REPO};name=libselinux;protocol=https;nobranch=1;destsuffix=git/external/libselinux \
31 git://${BUILD_REPO};name=build;protocol=https;nobranch=1;destsuffix=git/build \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050032 file://remove-selinux-android.patch \
33 file://use-capability.patch \
34 file://use-local-socket.patch \
Brad Bishop316dfdd2018-06-25 12:45:53 -040035 file://preserve-ownership.patch;patchdir=system/extras \
Brad Bishop6e60e8b2018-02-01 10:27:11 -050036 file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch \
37 file://remove-bionic-android.patch \
38 file://define-shell-command.patch \
39 file://implicit-declaration-function-strlcat-strlcopy.patch \
40 file://fix-big-endian-build.patch \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041 file://0001-add-base64-implementation.patch \
42 file://0002-adb-Musl-fixes.patch \
Patrick Williamsddad1a12017-02-23 20:36:32 -060043 file://android-tools-adbd.service \
44 file://.gitignore;subdir=git \
45 file://adb.mk;subdir=${BPN} \
46 file://adbd.mk;subdir=${BPN} \
47 file://ext4_utils.mk;subdir=${BPN} \
48 file://fastboot.mk;subdir=${BPN} \
49 file://mkbootimg.mk;subdir=${BPN} \
50"
51
52S = "${WORKDIR}/git"
53B = "${WORKDIR}/${BPN}"
54
Brad Bishop6e60e8b2018-02-01 10:27:11 -050055# http://errors.yoctoproject.org/Errors/Details/133881/
56ARM_INSTRUCTION_SET_armv4 = "arm"
57ARM_INSTRUCTION_SET_armv5 = "arm"
58
Patrick Williamsddad1a12017-02-23 20:36:32 -060059inherit systemd
60
61SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service"
62
Patrick Williamsddad1a12017-02-23 20:36:32 -060063# Find libbsd headers during native builds
64CC_append_class-native = " -I${STAGING_INCDIR}"
65CC_append_class-nativesdk = " -I${STAGING_INCDIR}"
66
67TOOLS = "adb fastboot ext4_utils mkbootimg adbd"
68
69# Adb needs sys/capability.h, which is not available for native*
70TOOLS_class-native = "fastboot ext4_utils mkbootimg"
71TOOLS_class-nativesdk = "fastboot ext4_utils mkbootimg"
72
73do_compile() {
74 # Setting both variables below causing our makefiles to not work with
75 # implicit make rules
76 unset CFLAGS
77 unset CPPFLAGS
78
79 export SRCDIR=${S}
80
81 case "${HOST_ARCH}" in
82 arm)
83 export android_arch=linux-arm
84 ;;
85 aarch64)
86 export android_arch=linux-arm64
87 ;;
88 mips|mipsel)
89 export android_arch=linux-mips
90 ;;
91 powerpc|powerpc64)
92 export android_arch=linux-ppc
93 ;;
94 i586|x86_64)
95 export android_arch=linux-x86
96 ;;
97 esac
98
99 for tool in ${TOOLS}; do
100 mkdir -p ${B}/${tool}
101 oe_runmake -f ${B}/${tool}.mk -C ${B}/${tool}
102 done
103}
104
105do_install() {
106 if echo ${TOOLS} | grep -q "ext4_utils" ; then
107 install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump
108 install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg
109
110 install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir}
111 install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir}
112 install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir}
113 install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir}
114 install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir}
115 install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir}
116 fi
117
118 if echo ${TOOLS} | grep -q "adb " ; then
119 install -d ${D}${bindir}
120 install -m0755 ${B}/adb/adb ${D}${bindir}
121 fi
122
123 if echo ${TOOLS} | grep -q "adbd" ; then
124 install -d ${D}${bindir}
125 install -m0755 ${B}/adbd/adbd ${D}${bindir}
126 fi
127
128 # Outside the if statement to avoid errors during do_package
129 install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
130 ${D}${systemd_unitdir}/system/android-tools-adbd.service
131
132 if echo ${TOOLS} | grep -q "fastboot" ; then
133 install -d ${D}${bindir}
134 install -m0755 ${B}/fastboot/fastboot ${D}${bindir}
135 fi
136
137 if echo ${TOOLS} | grep -q "mkbootimg" ; then
138 install -d ${D}${bindir}
139 install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}
140 fi
141}
142
143PACKAGES += "${PN}-fstools"
144
145RDEPENDS_${BPN} = "${BPN}-conf bash"
146
147FILES_${PN}-fstools = "\
148 ${bindir}/ext2simg \
149 ${bindir}/ext4fixup \
150 ${bindir}/img2simg \
151 ${bindir}/make_ext4fs \
152 ${bindir}/simg2img \
153 ${bindir}/simg2simg \
154 ${bindir}/simg_dump \
155 ${bindir}/mkuserimg \
156"
157
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500158BBCLASSEXTEND = "native"