Move vold to Android.bp.

Test: builds, boots
Bug: 67041047
Change-Id: Ife9118d274fc92d30b38d216f815741a060a04b7
This commit is contained in:
Jeff Sharkey 2017-10-23 14:38:55 -06:00
parent 947a57e76d
commit d16dc5089b
5 changed files with 207 additions and 293 deletions

193
Android.bp Normal file
View file

@ -0,0 +1,193 @@
cc_defaults {
name: "vold_default_flags",
cflags: [
"-Wall",
"-Werror",
"-Wextra",
"-Wno-missing-field-initializers",
"-Wno-unused-parameter",
"-Wno-unused-variable",
],
clang: true,
tidy: true,
tidy_checks: [
"-*",
"cert-*",
"clang-analyzer-security*",
"-cert-err58-cpp",
],
tidy_flags: [
"-warnings-as-errors=clang-analyzer-security*,cert-*",
],
}
cc_defaults {
name: "vold_default_libs",
static_libs: [
"libavb",
"libbootloader_message",
"libfec",
"libfec_rs",
"libfs_mgr",
"libscrypt_static",
"libsquashfs_utils",
"libvold_binder",
],
shared_libs: [
"android.hardware.keymaster@3.0",
"libbase",
"libbinder",
"libcrypto",
"libcrypto_utils",
"libcutils",
"libdiskconfig",
"libext4_utils",
"libf2fs_sparseblock",
"libhardware",
"libhardware_legacy",
"libhidlbase",
"libhwbinder",
"libkeystore_binder",
"libkeyutils",
"liblog",
"liblogwrap",
"libselinux",
"libsysutils",
"libutils",
],
}
cc_library_static {
name: "libvold_binder",
defaults: ["vold_default_flags"],
srcs: [
"binder/android/os/IVold.aidl",
"binder/android/os/IVoldListener.aidl",
"binder/android/os/IVoldTaskListener.aidl",
],
shared_libs: [
"libbinder",
"libutils",
],
aidl: {
local_include_dirs: ["binder"],
include_dirs: ["frameworks/native/aidl/binder"],
export_aidl_headers: true,
},
}
// Static library factored out to support testing
cc_library_static {
name: "libvold",
defaults: [
"vold_default_flags",
"vold_default_libs",
],
srcs: [
"Benchmark.cpp",
"Devmapper.cpp",
"EncryptInplace.cpp",
"Ext4Crypt.cpp",
"IdleMaint.cpp",
"KeyBuffer.cpp",
"KeyStorage.cpp",
"KeyUtil.cpp",
"Keymaster.cpp",
"Loop.cpp",
"MetadataCrypt.cpp",
"MoveStorage.cpp",
"NetlinkHandler.cpp",
"NetlinkManager.cpp",
"Process.cpp",
"ScryptParameters.cpp",
"Utils.cpp",
"VoldNativeService.cpp",
"VoldUtil.cpp",
"VolumeManager.cpp",
"cryptfs.cpp",
"fs/Ext4.cpp",
"fs/F2fs.cpp",
"fs/Vfat.cpp",
"model/Disk.cpp",
"model/EmulatedVolume.cpp",
"model/ObbVolume.cpp",
"model/PrivateVolume.cpp",
"model/PublicVolume.cpp",
"model/VolumeBase.cpp",
"secontext.cpp",
],
}
cc_binary {
name: "vold",
defaults: [
"vold_default_flags",
"vold_default_libs",
],
srcs: ["main.cpp"],
static_libs: ["libvold"],
init_rc: ["vold.rc"],
required: [
"mke2fs",
"vold_prepare_subdirs",
],
}
cc_binary {
name: "vdc",
defaults: ["vold_default_flags"],
srcs: ["vdc.cpp"],
shared_libs: [
"libbase",
"libbinder",
"libcutils",
"libutils",
],
static_libs: [
"libvold_binder",
],
init_rc: ["vdc.rc"],
}
cc_binary {
name: "secdiscard",
defaults: ["vold_default_flags"],
srcs: [
"FileDeviceUtils.cpp",
"secdiscard.cpp",
],
shared_libs: ["libbase"],
}
cc_binary {
name: "prepare_dir",
defaults: ["vold_default_flags"],
srcs: ["prepare_dir.cpp"],
shared_libs: [
"libbase",
"libcutils",
"libselinux",
],
}
cc_prebuilt_binary {
name: "vold_prepare_subdirs",
defaults: ["vold_default_flags"],
srcs: ["vold_prepare_subdirs"],
required: ["prepare_dir"],
}
subdirs = ["tests"]

View file

@ -1,210 +0,0 @@
LOCAL_PATH:= $(call my-dir)
common_src_files := \
VolumeManager.cpp \
NetlinkManager.cpp \
NetlinkHandler.cpp \
Process.cpp \
fs/Ext4.cpp \
fs/F2fs.cpp \
fs/Vfat.cpp \
Loop.cpp \
Devmapper.cpp \
Ext4Crypt.cpp \
VoldUtil.cpp \
cryptfs.cpp \
model/Disk.cpp \
model/VolumeBase.cpp \
model/PublicVolume.cpp \
model/PrivateVolume.cpp \
model/EmulatedVolume.cpp \
model/ObbVolume.cpp \
Utils.cpp \
MoveStorage.cpp \
Benchmark.cpp \
IdleMaint.cpp \
KeyBuffer.cpp \
Keymaster.cpp \
KeyStorage.cpp \
KeyUtil.cpp \
ScryptParameters.cpp \
secontext.cpp \
EncryptInplace.cpp \
MetadataCrypt.cpp \
VoldNativeService.cpp \
common_aidl_files := \
binder/android/os/IVold.aidl \
binder/android/os/IVoldListener.aidl \
binder/android/os/IVoldTaskListener.aidl \
common_aidl_includes := \
$(LOCAL_PATH)/binder \
frameworks/native/aidl/binder \
common_c_includes := \
system/extras/f2fs_utils \
external/scrypt/lib/crypto \
external/f2fs-tools/include \
frameworks/native/include \
system/security/keystore \
common_shared_libraries := \
libsysutils \
libbinder \
libcutils \
libkeyutils \
liblog \
libdiskconfig \
libhardware_legacy \
liblogwrap \
libext4_utils \
libf2fs_sparseblock \
libcrypto_utils \
libcrypto \
libselinux \
libutils \
libhardware \
libbase \
libhwbinder \
libhidlbase \
android.hardware.keymaster@3.0 \
libkeystore_binder
common_static_libraries := \
libbootloader_message \
libfs_mgr \
libfec \
libfec_rs \
libsquashfs_utils \
libscrypt_static \
libavb \
# TODO: include "cert-err58-cpp" once 36656327 is fixed
common_local_tidy_enabled := true
common_local_tidy_flags := -warnings-as-errors=clang-analyzer-security*,cert-*
common_local_tidy_checks := -*,clang-analyzer-security*,cert-*,-cert-err58-cpp
vold_conlyflags := -std=c11
vold_cflags := -Werror -Wall -Wno-missing-field-initializers -Wno-unused-variable -Wno-unused-parameter
required_modules := vold_prepare_subdirs
ifeq ($(TARGET_USERIMAGES_USE_EXT4), true)
required_modules += mke2fs
endif
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := libvold
LOCAL_CLANG := true
LOCAL_TIDY := $(common_local_tidy_enabled)
LOCAL_TIDY_FLAGS := $(common_local_tidy_flags)
LOCAL_TIDY_CHECKS := $(common_local_tidy_checks)
LOCAL_SRC_FILES := $(common_src_files) $(common_aidl_files)
LOCAL_C_INCLUDES := $(common_c_includes)
LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
LOCAL_MODULE_TAGS := eng tests
LOCAL_CFLAGS := $(vold_cflags)
LOCAL_CONLYFLAGS := $(vold_conlyflags)
LOCAL_REQUIRED_MODULES := $(required_modules)
LOCAL_AIDL_INCLUDES := $(common_aidl_includes)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_MODULE := vold
LOCAL_CLANG := true
LOCAL_TIDY := $(common_local_tidy_enabled)
LOCAL_TIDY_FLAGS := $(common_local_tidy_flags)
LOCAL_TIDY_CHECKS := $(common_local_tidy_checks)
LOCAL_SRC_FILES := \
main.cpp \
$(common_src_files) \
$(common_aidl_files) \
LOCAL_INIT_RC := vold.rc
LOCAL_C_INCLUDES := $(common_c_includes)
LOCAL_CFLAGS := $(vold_cflags)
LOCAL_CONLYFLAGS := $(vold_conlyflags)
LOCAL_SHARED_LIBRARIES := $(common_shared_libraries)
LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
LOCAL_REQUIRED_MODULES := $(required_modules)
LOCAL_AIDL_INCLUDES := $(common_aidl_includes)
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_CLANG := true
LOCAL_TIDY := $(common_local_tidy_enabled)
LOCAL_TIDY_FLAGS := $(common_local_tidy_flags)
LOCAL_TIDY_CHECKS := $(common_local_tidy_checks)
LOCAL_SRC_FILES := \
vdc.cpp \
$(common_aidl_files) \
LOCAL_MODULE := vdc
LOCAL_SHARED_LIBRARIES := libbase libbinder libcutils libutils
LOCAL_CFLAGS := $(vold_cflags)
LOCAL_CONLYFLAGS := $(vold_conlyflags)
LOCAL_INIT_RC := vdc.rc
LOCAL_AIDL_INCLUDES := $(common_aidl_includes)
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_CLANG := true
LOCAL_TIDY := $(common_local_tidy_enabled)
LOCAL_TIDY_FLAGS := $(common_local_tidy_flags)
LOCAL_TIDY_CHECKS := $(common_local_tidy_checks)
LOCAL_SRC_FILES:= \
FileDeviceUtils.cpp \
secdiscard.cpp \
LOCAL_MODULE:= secdiscard
LOCAL_SHARED_LIBRARIES := libbase
LOCAL_CFLAGS := $(vold_cflags)
LOCAL_CONLYFLAGS := $(vold_conlyflags)
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_CLANG := true
LOCAL_TIDY := $(common_local_tidy_enabled)
LOCAL_TIDY_FLAGS := $(common_local_tidy_flags)
LOCAL_TIDY_CHECKS := $(common_local_tidy_checks)
LOCAL_SRC_FILES:= \
prepare_dir.cpp \
LOCAL_MODULE:= prepare_dir
LOCAL_SHARED_LIBRARIES := libbase libcutils libselinux
LOCAL_CFLAGS := $(vold_cflags)
LOCAL_CONLYFLAGS := $(vold_conlyflags)
include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_MODULE:= vold_prepare_subdirs
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES := vold_prepare_subdirs
LOCAL_REQUIRED_MODULES := prepare_dir
include $(BUILD_PREBUILT)
include $(LOCAL_PATH)/tests/Android.mk

14
tests/Android.bp Normal file
View file

@ -0,0 +1,14 @@
cc_test {
name: "vold_tests",
defaults: [
"vold_default_flags",
"vold_default_libs",
],
srcs: [
"CryptfsScryptHidlizationEquivalence_test.cpp",
"Utils_test.cpp",
"cryptfs_test.cpp",
],
static_libs: ["libvold"],
}

View file

@ -1,46 +0,0 @@
# Build the unit tests.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
LOCAL_C_INCLUDES := \
system/core/fs_mgr/include \
system/vold/
LOCAL_STATIC_LIBRARIES := libbase libselinux libvold liblog libcrypto
LOCAL_SRC_FILES := \
cryptfs_test.cpp \
Utils_test.cpp \
VolumeManager_test.cpp \
LOCAL_MODULE := vold_tests
LOCAL_MODULE_TAGS := eng tests
LOCAL_CFLAGS := -Wall -Werror
include $(BUILD_NATIVE_TEST)
include $(CLEAR_VARS)
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
# LOCAL_C_INCLUDES := \
system/core/fs_mgr/include
LOCAL_STATIC_LIBRARIES := libselinux libvold liblog libcrypto
LOCAL_SHARED_LIBRARIES := \
libutils \
libbase \
libhardware \
libhardware_legacy \
libhwbinder \
libhidlbase \
libkeystore_binder \
android.hardware.keymaster@3.0
LOCAL_SRC_FILES := CryptfsScryptHidlizationEquivalence_test.cpp
LOCAL_MODULE := vold_cryptfs_scrypt_hidlization_equivalence_test
LOCAL_MODULE_TAGS := eng tests
LOCAL_CFLAGS := -Wall -Werror
include $(BUILD_NATIVE_TEST)

View file

@ -1,37 +0,0 @@
/*
* Copyright (C) 2010 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 <errno.h>
#define LOG_TAG "VolumeManager_test"
#include <utils/Log.h>
#include <openssl/md5.h>
#include "../VolumeManager.h"
#include <gtest/gtest.h>
namespace android {
class VolumeManagerTest : public testing::Test {
protected:
virtual void SetUp() {
}
virtual void TearDown() {
}
};
}