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