blob: fb6125e2a5dfe3e8969540e2422398b6de2c97da [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 \
Brad Bishop0f291cc2019-09-01 15:16:57 -04007 file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=cb641bc04cda31daea161b1bc15da69f \
Patrick Williamsddad1a12017-02-23 20:36:32 -06008 file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \
9"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080010DEPENDS = "libbsd libpcre zlib libcap"
Brad Bishop19323692019-04-05 15:28:33 -040011DEPENDS_append_class-target = " openssl"
Patrick Williamsddad1a12017-02-23 20:36:32 -060012
Patrick Williamsddad1a12017-02-23 20:36:32 -060013ANDROID_MIRROR = "android.googlesource.com"
Patrick Williamsddad1a12017-02-23 20:36:32 -060014
Brad Bishop316dfdd2018-06-25 12:45:53 -040015# matches with android-5.1.1_r37
16SRCREV_core = "2314b110bdebdbfd2d94c502282f9e57c849897e"
17SRCREV_extras = "3ecbe8d841df96127d7855661293e5ab6ba6c205"
18SRCREV_libhardware = "be55eb1f4d840c82ffaf7c47460df17ff5bc4d9b"
19SRCREV_libselinux = "07e9e1339ad1ba608acfba9dce2d0f474b252feb"
20SRCREV_build = "16e987def3d7d8f7d30805eb95cef69e52a87dbc"
21
Patrick Williamsddad1a12017-02-23 20:36:32 -060022SRC_URI = " \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080023 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 \
Brad Bishop19323692019-04-05 15:28:33 -040040 file://core/adb_libssl_11.diff;patchdir=system/core \
Andrew Geissler82c905d2020-04-13 13:39:40 -050041 file://core/0013-adb-Support-riscv64.patch;patchdir=system/core \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080042 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 \
Brad Bishop26bdd442019-08-16 17:08:17 -040045 file://libselinux/0001-libselinux-Do-not-define-gettid-if-glibc-2.30-is-use.patch;patchdir=external/libselinux \
Patrick Williamsddad1a12017-02-23 20:36:32 -060046 file://android-tools-adbd.service \
Andrew Geissler82c905d2020-04-13 13:39:40 -050047 file://build/0001-Riscv-Add-risc-v-Android-config-header.patch;patchdir=build \
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080048 file://gitignore \
Patrick Williamsddad1a12017-02-23 20:36:32 -060049 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
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080056
Patrick Williamsddad1a12017-02-23 20:36:32 -060057S = "${WORKDIR}/git"
58B = "${WORKDIR}/${BPN}"
59
Brad Bishop6e60e8b2018-02-01 10:27:11 -050060# http://errors.yoctoproject.org/Errors/Details/133881/
61ARM_INSTRUCTION_SET_armv4 = "arm"
62ARM_INSTRUCTION_SET_armv5 = "arm"
63
Brad Bishop19323692019-04-05 15:28:33 -040064COMPATIBLE_HOST_powerpc = "(null)"
65COMPATIBLE_HOST_powerpc64 = "(null)"
Andrew Geissler82c905d2020-04-13 13:39:40 -050066COMPATIBLE_HOST_powerpc64le = "(null)"
Brad Bishop19323692019-04-05 15:28:33 -040067
Patrick Williamsddad1a12017-02-23 20:36:32 -060068inherit systemd
69
70SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service"
71
Patrick Williamsddad1a12017-02-23 20:36:32 -060072# Find libbsd headers during native builds
73CC_append_class-native = " -I${STAGING_INCDIR}"
74CC_append_class-nativesdk = " -I${STAGING_INCDIR}"
75
76TOOLS = "adb fastboot ext4_utils mkbootimg adbd"
77
78# Adb needs sys/capability.h, which is not available for native*
79TOOLS_class-native = "fastboot ext4_utils mkbootimg"
80TOOLS_class-nativesdk = "fastboot ext4_utils mkbootimg"
81
82do_compile() {
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080083 cp ${WORKDIR}/gitignore ${S}/.gitignore
84
Patrick Williamsddad1a12017-02-23 20:36:32 -060085 # Setting both variables below causing our makefiles to not work with
86 # implicit make rules
87 unset CFLAGS
88 unset CPPFLAGS
89
90 export SRCDIR=${S}
91
92 case "${HOST_ARCH}" in
93 arm)
94 export android_arch=linux-arm
95 ;;
96 aarch64)
97 export android_arch=linux-arm64
98 ;;
Andrew Geissler82c905d2020-04-13 13:39:40 -050099 riscv64)
100 export android_arch=linux-riscv64
101 ;;
Patrick Williamsddad1a12017-02-23 20:36:32 -0600102 mips|mipsel)
103 export android_arch=linux-mips
104 ;;
Brad Bishop19323692019-04-05 15:28:33 -0400105 mips64|mips64el)
106 export android_arch=linux-mips64
107 ;;
Patrick Williamsddad1a12017-02-23 20:36:32 -0600108 powerpc|powerpc64)
109 export android_arch=linux-ppc
110 ;;
Brad Bishopa891d152019-09-13 06:17:45 -0400111 i586|i686|x86_64)
Patrick Williamsddad1a12017-02-23 20:36:32 -0600112 export android_arch=linux-x86
113 ;;
114 esac
115
116 for tool in ${TOOLS}; do
117 mkdir -p ${B}/${tool}
118 oe_runmake -f ${B}/${tool}.mk -C ${B}/${tool}
119 done
120}
121
122do_install() {
123 if echo ${TOOLS} | grep -q "ext4_utils" ; then
124 install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump
125 install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg
126
127 install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir}
128 install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir}
129 install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir}
130 install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir}
131 install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir}
132 install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir}
133 fi
134
135 if echo ${TOOLS} | grep -q "adb " ; then
136 install -d ${D}${bindir}
137 install -m0755 ${B}/adb/adb ${D}${bindir}
138 fi
139
140 if echo ${TOOLS} | grep -q "adbd" ; then
141 install -d ${D}${bindir}
142 install -m0755 ${B}/adbd/adbd ${D}${bindir}
143 fi
144
145 # Outside the if statement to avoid errors during do_package
146 install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
147 ${D}${systemd_unitdir}/system/android-tools-adbd.service
148
149 if echo ${TOOLS} | grep -q "fastboot" ; then
150 install -d ${D}${bindir}
151 install -m0755 ${B}/fastboot/fastboot ${D}${bindir}
152 fi
153
154 if echo ${TOOLS} | grep -q "mkbootimg" ; then
155 install -d ${D}${bindir}
156 install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}
157 fi
158}
159
160PACKAGES += "${PN}-fstools"
161
162RDEPENDS_${BPN} = "${BPN}-conf bash"
163
164FILES_${PN}-fstools = "\
165 ${bindir}/ext2simg \
166 ${bindir}/ext4fixup \
167 ${bindir}/img2simg \
168 ${bindir}/make_ext4fs \
169 ${bindir}/simg2img \
170 ${bindir}/simg2simg \
171 ${bindir}/simg_dump \
172 ${bindir}/mkuserimg \
173"
174
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500175BBCLASSEXTEND = "native"