aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-devtools/android-tools/android-tools_5.1.1.r37.bb
blob: 2dbddf1575317eda6a3c2be64e8eb30330a251ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
DESCRIPTION = "Different utilities from Android"
SECTION = "console/utils"
LICENSE = "Apache-2.0 & GPL-2.0 & BSD-2-Clause & BSD-3-Clause"
LIC_FILES_CHKSUM = " \
    file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10 \
    file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6 \
    file://${COMMON_LICENSE_DIR}/BSD-2-Clause;md5=8bef8e6712b1be5aa76af1ebde9d6378 \
    file://${COMMON_LICENSE_DIR}/BSD-3-Clause;md5=550794465ba0ec5312d6919e203a55f9 \
"
DEPENDS = "libbsd libpcre openssl zlib"

ANDROID_TAG = "android-5.1.1_r37"
ANDROID_MIRROR = "android.googlesource.com"
CORE_REPO = "${ANDROID_MIRROR}/platform/system/core"
EXTRAS_REPO = "${ANDROID_MIRROR}/platform/system/extras"
LIBHARDWARE_REPO = "${ANDROID_MIRROR}/platform/hardware/libhardware"
LIBSELINUX_REPO = "${ANDROID_MIRROR}/platform/external/libselinux"
BUILD_REPO = "${ANDROID_MIRROR}/platform/build"

SRC_URI = " \
    git://${CORE_REPO};name=core;protocol=https;nobranch=1;destsuffix=git/system/core;tag=${ANDROID_TAG} \
    git://${EXTRAS_REPO};name=extras;protocol=https;nobranch=1;destsuffix=git/system/extras;tag=${ANDROID_TAG} \
    git://${LIBHARDWARE_REPO};name=libhardware;protocol=https;nobranch=1;destsuffix=git/hardware/libhardware;tag=${ANDROID_TAG} \
    git://${LIBSELINUX_REPO};name=libselinux;protocol=https;nobranch=1;destsuffix=git/external/libselinux;tag=${ANDROID_TAG} \
    git://${BUILD_REPO};name=build;protocol=https;nobranch=1;destsuffix=git/build;tag=${ANDROID_TAG} \
    file://remove-selinux-android.patch;apply=yes \
    file://use-capability.patch;apply=yes \
    file://use-local-socket.patch;apply=yes \
    file://preserve-ownership.patch;apply=yes \
    file://mkbootimg-Add-dt-parameter-to-specify-DT-image.patch;apply=yes \
    file://remove-bionic-android.patch;apply=yes \
    file://define-shell-command.patch;apply=yes \
    file://implicit-declaration-function-strlcat-strlcopy.patch;apply=yes \
    file://android-tools-adbd.service \
    file://.gitignore;subdir=git \
    file://adb.mk;subdir=${BPN} \
    file://adbd.mk;subdir=${BPN} \
    file://ext4_utils.mk;subdir=${BPN} \
    file://fastboot.mk;subdir=${BPN} \
    file://mkbootimg.mk;subdir=${BPN} \
"

S = "${WORKDIR}/git"
B = "${WORKDIR}/${BPN}"

inherit systemd

SYSTEMD_SERVICE_${PN} = "android-tools-adbd.service"

# Get rid of files uneeded to build Android tools
do_unpack_extra() {
    cd ${S}
    rm -rf \
      system/core/.git \
      system/extras/.git \
      hardware/libhardware/.git \
      external/libselinux/.git \
      build/.git
    git init
    git add .
    git commit -m \
      "Initial import - committed ${ANDROID_TAG}"
    git clean -fdx
}

addtask unpack_extra after do_unpack before do_patch

do_compile() {
    # Setting both variables below causing our makefiles to not work with
    # implicit make rules
    unset CFLAGS
    unset CPPFLAGS

    export SRCDIR=${S}

    case "${HOST_ARCH}" in
      arm)
        export android_arch=linux-arm
      ;;
      aarch64)
        export android_arch=linux-arm64
      ;;
      mips|mipsel)
        export android_arch=linux-mips
      ;;
      powerpc|powerpc64)
        export android_arch=linux-ppc
      ;;
      i586|x86_64)
        export android_arch=linux-x86
      ;;
    esac

    tools="adb fastboot ext4_utils mkbootimg adbd"
    for tool in ${tools}; do
      mkdir -p ${B}/${tool}
      oe_runmake -f ${B}/${tool}.mk -C ${B}/${tool}
    done
}

do_install() {
    install -D -p -m0755 ${S}/system/core/libsparse/simg_dump.py ${D}${bindir}/simg_dump
    install -D -p -m0755 ${S}/system/extras/ext4_utils/mkuserimg.sh ${D}${bindir}/mkuserimg

    install -m0755 ${B}/ext4_utils/ext2simg ${D}${bindir}
    install -m0755 ${B}/ext4_utils/ext4fixup ${D}${bindir}
    install -m0755 ${B}/ext4_utils/img2simg ${D}${bindir}
    install -m0755 ${B}/ext4_utils/make_ext4fs ${D}${bindir}
    install -m0755 ${B}/ext4_utils/simg2img ${D}${bindir}
    install -m0755 ${B}/ext4_utils/simg2simg ${D}${bindir}

    install -m0755 ${B}/adb/adb ${D}${bindir}
    install -m0755 ${B}/adbd/adbd ${D}${bindir}
    install -m0755 ${B}/fastboot/fastboot ${D}${bindir}
    install -m0755 ${B}/mkbootimg/mkbootimg ${D}${bindir}

    install -D -p -m0644 ${WORKDIR}/android-tools-adbd.service \
      ${D}${systemd_unitdir}/system/android-tools-adbd.service
}

PACKAGES += "${PN}-fstools"

RDEPENDS_${BPN} = "${BPN}-conf bash"

FILES_${PN}-fstools = "\
    ${bindir}/ext2simg \
    ${bindir}/ext4fixup \
    ${bindir}/img2simg \
    ${bindir}/make_ext4fs \
    ${bindir}/simg2img \
    ${bindir}/simg2simg \
    ${bindir}/simg_dump \
    ${bindir}/mkuserimg \
"

BBCLASSEXTEND += "native"