android_packages_modules_Vi.../apex/Android.bp

250 lines
5.9 KiB
Plaintext
Raw Permalink Normal View History

package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
microdroid_filesystem_images = [
"microdroid_super",
"microdroid_vbmeta",
]
soong_config_module_type {
name: "virt_apex",
module_type: "apex",
config_namespace: "ANDROID",
bool_variables: ["avf_enabled"],
properties: ["defaults"],
}
virt_apex {
name: "com.android.virt",
soong_config_variables: {
avf_enabled: {
defaults: ["com.android.virt_avf_enabled"],
conditions_default: {
defaults: ["com.android.virt_avf_disabled"],
},
},
},
}
apex_defaults {
name: "com.android.virt_common",
// TODO(jiyong): make it updatable
updatable: false,
Set future_updatable: false for virt and compos APEXes We don't want to enable future_updatable, as it will prevent our APEXes from using the optimization that symlinks the shared libraries in the non-updatable APEXes to the corresponding libraries on /system. In our case this optimization is quite useful, as all of the shared libraries used by the compos APEX are also used by the virt APEX. This optimization reduces total size of virt and compos APEXes by 6 MBs. Before this optimization: ``` $ adb shell ls -alh /apex/com.android.virt/lib64 total 3.7M drwxr-xr-x 2 root shell 4.0K 1970-01-01 01:00 . drwxr-xr-x 8 system system 4.0K 1970-01-01 01:00 .. -rw-r--r-- 1 system system 10K 1970-01-01 01:00 android.system.virtualizationcommon-ndk.so -rw-r--r-- 1 system system 92K 1970-01-01 01:00 android.system.virtualizationservice-ndk.so -rw-r--r-- 1 system system 269K 1970-01-01 01:00 libbase.so -rw-r--r-- 1 system system 728K 1970-01-01 01:00 libc++.so -rw-r--r-- 1 system system 36K 1970-01-01 01:00 libcap.so -rw-r--r-- 1 system system 1.3M 1970-01-01 01:00 libcrypto.so -rw-r--r-- 1 system system 93K 1970-01-01 01:00 libcutils.so -rw-r--r-- 1 system system 97K 1970-01-01 01:00 libdrm.so -rw-r--r-- 1 system system 171K 1970-01-01 01:00 libminijail.so -rw-r--r-- 1 system system 355K 1970-01-01 01:00 libprocessgroup.so -rw-r--r-- 1 system system 396K 1970-01-01 01:00 libssl.so -rw-r--r-- 1 system system 31K 1970-01-01 01:00 libtombstoned_client.so -rw-r--r-- 1 system system 122K 1970-01-01 01:00 libutils.so -rw-r--r-- 1 system system 11K 1970-01-01 01:00 libvirtualizationservice_jni.so -rw-r--r-- 1 system system 11K 1970-01-01 01:00 libvirtualmachine_jni.so $ adb shell ls -alh /apex/com.android.compos/lib64 total 2.7M drwxr-xr-x 2 root shell 4.0K 1970-01-01 01:00 . drwxr-xr-x 8 system system 4.0K 1970-01-01 01:00 .. -rw-r--r-- 1 system system 269K 1970-01-01 01:00 libbase.so -rw-r--r-- 1 system system 728K 1970-01-01 01:00 libc++.so -rw-r--r-- 1 system system 36K 1970-01-01 01:00 libcap.so -rw-r--r-- 1 system system 1.3M 1970-01-01 01:00 libcrypto.so -rw-r--r-- 1 system system 93K 1970-01-01 01:00 libcutils.so -rw-r--r-- 1 system system 171K 1970-01-01 01:00 libminijail.so -rw-r--r-- 1 system system 122K 1970-01-01 01:00 libutils.so ``` With this optimization: ``` $ adb shell ls -alh /apex/com.android.compos/lib64 total 8.0K drwxr-xr-x 2 root shell 4.0K 1970-01-01 01:00 . drwxr-xr-x 8 system system 4.0K 1970-01-01 01:00 .. lrw-r--r-- 1 system system 24 1970-01-01 01:00 libbase.so -> /system/lib64/libbase.so lrw-r--r-- 1 system system 23 1970-01-01 01:00 libc++.so -> /system/lib64/libc++.so lrw-r--r-- 1 system system 23 1970-01-01 01:00 libcap.so -> /system/lib64/libcap.so lrw-r--r-- 1 system system 26 1970-01-01 01:00 libcrypto.so -> /system/lib64/libcrypto.so lrw-r--r-- 1 system system 26 1970-01-01 01:00 libcutils.so -> /system/lib64/libcutils.so lrw-r--r-- 1 system system 28 1970-01-01 01:00 libminijail.so -> /system/lib64/libminijail.so lrw-r--r-- 1 system system 25 1970-01-01 01:00 libutils.so -> /system/lib64/libutils.so $ adb shell ls -alh /apex/com.android.virt/lib64 total 136K drwxr-xr-x 2 root shell 4.0K 1970-01-01 01:00 . drwxr-xr-x 8 system system 4.0K 1970-01-01 01:00 .. -rw-r--r-- 1 system system 10K 1970-01-01 01:00 android.system.virtualizationcommon-ndk.so -rw-r--r-- 1 system system 92K 1970-01-01 01:00 android.system.virtualizationservice-ndk.so lrw-r--r-- 1 system system 24 1970-01-01 01:00 libbase.so -> /system/lib64/libbase.so lrw-r--r-- 1 system system 23 1970-01-01 01:00 libc++.so -> /system/lib64/libc++.so lrw-r--r-- 1 system system 23 1970-01-01 01:00 libcap.so -> /system/lib64/libcap.so lrw-r--r-- 1 system system 26 1970-01-01 01:00 libcrypto.so -> /system/lib64/libcrypto.so lrw-r--r-- 1 system system 26 1970-01-01 01:00 libcutils.so -> /system/lib64/libcutils.so lrw-r--r-- 1 system system 23 1970-01-01 01:00 libdrm.so -> /system/lib64/libdrm.so lrw-r--r-- 1 system system 28 1970-01-01 01:00 libminijail.so -> /system/lib64/libminijail.so lrw-r--r-- 1 system system 32 1970-01-01 01:00 libprocessgroup.so -> /system/lib64/libprocessgroup.so lrw-r--r-- 1 system system 23 1970-01-01 01:00 libssl.so -> /system/lib64/libssl.so lrw-r--r-- 1 system system 37 1970-01-01 01:00 libtombstoned_client.so -> /system/lib64/libtombstoned_client.so lrw-r--r-- 1 system system 25 1970-01-01 01:00 libutils.so -> /system/lib64/libutils.so -rw-r--r-- 1 system system 11K 1970-01-01 01:00 libvirtualizationservice_jni.so -rw-r--r-- 1 system system 11K 1970-01-01 01:00 libvirtualmachine_jni.so ``` Bug: 265957081 Test: avf-presubmit Change-Id: Ib608fcf216d79d2482fcc72dcc7b70ef6e712e7a
2023-01-27 01:49:39 +00:00
future_updatable: false,
platform_apis: true,
manifest: "manifest.json",
key: "com.android.virt.key",
certificate: ":com.android.virt.certificate",
apps: [
"android.system.virtualmachine.res",
],
file_contexts: ":com.android.virt-file_contexts",
canned_fs_config: "canned_fs_config",
bootclasspath_fragments: [
"com.android.virt-bootclasspath-fragment",
],
jni_libs: [
"libvirtualizationservice_jni",
"libvirtualmachine_jni",
],
}
apex_defaults {
name: "com.android.virt_avf_enabled",
defaults: ["com.android.virt_common"],
custom_sign_tool: "sign_virt_apex",
// crosvm and virtualizationservice are only enabled for 64-bit targets on device
arch: {
arm64: {
binaries: [
"crosvm",
"virtmgr",
"virtualizationservice",
],
filesystems: microdroid_filesystem_images,
},
x86_64: {
binaries: [
"crosvm",
"virtmgr",
"virtualizationservice",
],
filesystems: microdroid_filesystem_images,
},
},
binaries: [
"fd_server",
"vm",
],
prebuilts: [
"com.android.virt.init.rc",
"features_com.android.virt.xml",
"microdroid_initrd_debuggable",
"microdroid_initrd_normal",
"microdroid.json",
"microdroid_kernel",
],
host_required: [
"vm_shell",
],
apps: [
"EmptyPayloadApp",
],
}
apex_defaults {
name: "com.android.virt_avf_disabled",
defaults: ["com.android.virt_common"],
}
apex_key {
name: "com.android.virt.key",
public_key: "com.android.virt.avbpubkey",
private_key: "com.android.virt.pem",
}
android_app_certificate {
name: "com.android.virt.certificate",
certificate: "com.android.virt",
}
prebuilt_etc {
name: "com.android.virt.init.rc",
src: "virtualizationservice.rc",
filename: "init.rc",
installable: false,
}
// Virt apex needs a custom signer for its payload
python_binary_host {
name: "sign_virt_apex",
srcs: [
"sign_virt_apex.py",
],
version: {
py3: {
embedded_launcher: true,
},
},
required: [
// sign_virt_apex should be runnable from outside the source tree,
// therefore, any required tool should be listed in build/make/core/Makefile as well.
"img2simg",
"initrd_bootconfig",
"lpmake",
"lpunpack",
"simg2img",
],
}
sh_test_host {
name: "sign_virt_apex_test",
src: "sign_virt_apex_test.sh",
test_config: "sign_virt_apex_test.xml",
data_bins: [
// deapexer
"deapexer",
"debugfs_static",
"blkid",
"fsck.erofs",
// sign_virt_apex
"avbtool",
"img2simg",
"initrd_bootconfig",
"lpmake",
"lpunpack",
"sign_virt_apex",
"simg2img",
],
data_libs: [
"libbase",
"libc++",
"libcrypto_utils",
"libcrypto",
"libext4_utils",
"liblog",
"liblp",
"libsparse",
"libz",
],
data: [
":com.android.virt",
":test.com.android.virt.pem",
],
test_suites: ["general-tests"],
}
filegroup {
name: "test.com.android.virt.pem",
srcs: ["test.com.android.virt.pem"],
}
filegroup {
name: "test2.com.android.virt.pem",
srcs: ["test2.com.android.virt.pem"],
}
// custom tool to replace bytes in a file
python_binary_host {
name: "replace_bytes",
srcs: [
"replace_bytes.py",
],
version: {
py3: {
embedded_launcher: true,
},
},
}
// Encapsulate the contributions made by the com.android.virt to the bootclasspath.
bootclasspath_fragment {
name: "com.android.virt-bootclasspath-fragment",
contents: ["framework-virtualization"],
apex_available: ["com.android.virt"],
// The bootclasspath_fragments that provide APIs on which this depends.
fragments: [
{
apex: "com.android.art",
module: "art-bootclasspath-fragment",
},
],
// Additional stubs libraries that this fragment's contents use which are
// not provided by another bootclasspath_fragment.
additional_stubs: [
"android-non-updatable",
],
hidden_api: {
// This module does not contain any split packages.
split_packages: [],
// The following packages and all their subpackages currently only
// contain classes from this bootclasspath_fragment. Listing a package
// here won't prevent other bootclasspath modules from adding classes in
// any of those packages but it will prevent them from adding those
// classes into an API surface, e.g. public, system, etc.. Doing so will
// result in a build failure due to inconsistent flags.
package_prefixes: [
"android.system.virtualmachine",
"android.system.virtualizationservice",
// android.sysprop.*, renamed by jarjar
"com.android.system.virtualmachine.sysprop",
],
},
}