Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ce9fe7fb authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Otapreopt: Move binary to Soong

Add a helper library using ART defaults to expose the image relocation
constants. Then move the otapreopt module to Android.bp.

Bug: 115993344
Test: mmma frameworks/native/cmds/installd
Change-Id: Ia5e114783150273c7806c1f1292ee7d3eff53e7c
parent 4549f39c
Loading
Loading
Loading
Loading
+37 −4
Original line number Diff line number Diff line
@@ -108,10 +108,8 @@ cc_library_static {
        "-Wall",
        "-Werror"
    ],
    clang: true,

    srcs: [
        "otapreopt_parameters.cpp"],
    srcs: ["otapreopt_parameters.cpp"],

    export_include_dirs: ["."],

@@ -123,4 +121,39 @@ cc_library_static {
    ],
}

subdirs = ["tests"]
//
//  OTA Executable
//

cc_binary {
    name: "otapreopt",
    cflags: [
        "-Wall",
        "-Werror"
    ],

    srcs: [
        "dexopt.cpp",
        "globals.cpp",
        "otapreopt.cpp",
        "utils.cpp",
    ],

    header_libs: ["dex2oat_headers"],

    static_libs: [
        "libartimagevalues",
        "libdiskusage",
        "libotapreoptparameters",
    ],

    shared_libs: [
        "libbase",
        "libcrypto",
        "libcutils",
        "liblog",
        "liblogwrap",
        "libselinux",
        "libutils",
    ],
}
+0 −38
Original line number Diff line number Diff line
LOCAL_PATH := $(call my-dir)

#
# OTA Executable
#

include $(CLEAR_VARS)
LOCAL_MODULE := otapreopt
LOCAL_CFLAGS := -Wall -Werror

# Base & ASLR boundaries for boot image creation.
ifndef LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA
  LOCAL_LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA := -0x1000000
else
  LOCAL_LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA := $(LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA)
endif
ifndef LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA
  LOCAL_LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA := 0x1000000
else
  LOCAL_LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA := $(LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA)
endif
LOCAL_CFLAGS += -DART_BASE_ADDRESS=$(LIBART_IMG_HOST_BASE_ADDRESS)
LOCAL_CFLAGS += -DART_BASE_ADDRESS_MIN_DELTA=$(LOCAL_LIBART_IMG_HOST_MIN_BASE_ADDRESS_DELTA)
LOCAL_CFLAGS += -DART_BASE_ADDRESS_MAX_DELTA=$(LOCAL_LIBART_IMG_HOST_MAX_BASE_ADDRESS_DELTA)

LOCAL_SRC_FILES := otapreopt.cpp otapreopt_parameters.cpp globals.cpp utils.cpp dexopt.cpp
LOCAL_HEADER_LIBRARIES := dex2oat_headers
LOCAL_SHARED_LIBRARIES := \
    libbase \
    libcrypto \
    libcutils \
    liblog \
    liblogwrap \
    libselinux \
    libutils \

LOCAL_STATIC_LIBRARIES := libdiskusage
LOCAL_CLANG := true
include $(BUILD_EXECUTABLE)

# OTA slot script

include $(CLEAR_VARS)
+12 −0
Original line number Diff line number Diff line
// Inherit image values.
art_global_defaults {
    name: "libartimagevalues_defaults",
}

cc_library_static {
    name: "libartimagevalues",
    defaults: ["libartimagevalues_defaults"],
    srcs: ["art_image_values.cpp"],
    export_include_dirs: ["."],
    cflags: ["-Wconversion"],
}
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "art_image_values.h"

namespace android {
namespace installd {
namespace art {

uint32_t GetImageBaseAddress() {
    return ART_BASE_ADDRESS;
}
int32_t GetImageMinBaseAddressDelta() {
    return ART_BASE_ADDRESS_MIN_DELTA;
}
int32_t GetImageMaxBaseAddressDelta() {
    return ART_BASE_ADDRESS_MAX_DELTA;
}

static_assert(ART_BASE_ADDRESS_MIN_DELTA < ART_BASE_ADDRESS_MAX_DELTA, "Inconsistent setup");

}  // namespace art
}  // namespace installd
}  // namespace android
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
#define FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H

#include <cstdint>

namespace android {
namespace installd {
namespace art {

uint32_t GetImageBaseAddress();
int32_t GetImageMinBaseAddressDelta();
int32_t GetImageMaxBaseAddressDelta();

}  // namespace art
}  // namespace installd
}  // namespace android

#endif  // FRAMEWORKS_NATIVE_CMDS_INSTALLD_ART_HELPER_ART_IMAGE_VALUES_H
Loading