diff options
author | Matthew Maurer <mmaurer@google.com> | 2019-01-29 09:16:28 -0800 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-01-29 09:16:28 -0800 |
commit | f947f19d358b2ee5c31889cdcd8b03a7fae788a9 (patch) | |
tree | 966f2f6b8990d208ee56c53a8f6507a4d7c8b9ae | |
parent | a8c9e875ba447bfc09ab1c760edafd78caab7f27 (diff) | |
parent | 553d0571d703704f2a81aaa8e2be3b47e73f1fcb (diff) | |
download | device_generic_trusty-f947f19d358b2ee5c31889cdcd8b03a7fae788a9.tar.gz device_generic_trusty-f947f19d358b2ee5c31889cdcd8b03a7fae788a9.tar.bz2 device_generic_trusty-f947f19d358b2ee5c31889cdcd8b03a7fae788a9.zip |
Add trusty emulator target am: fd68d47acd am: c08aa23b95
am: 553d0571d7
Change-Id: I2c0812b46d187dc7c930114411924cddadb95fc4
-rw-r--r-- | AndroidProducts.mk | 17 | ||||
-rw-r--r-- | BoardConfig.mk | 53 | ||||
-rw-r--r-- | init.qemu_trusty.rc | 106 | ||||
-rw-r--r-- | qemu_trusty_arm64.mk | 22 | ||||
-rw-r--r-- | qemu_trusty_base.mk | 73 | ||||
-rw-r--r-- | sepolicy/dhcpclient.te | 18 | ||||
-rw-r--r-- | sepolicy/file.te | 1 | ||||
-rw-r--r-- | sepolicy/file_contexts | 3 | ||||
-rw-r--r-- | sepolicy/trusty_test.te | 3 | ||||
-rw-r--r-- | vendor.mk | 23 | ||||
-rw-r--r-- | vendorsetup.sh | 22 |
11 files changed, 341 insertions, 0 deletions
diff --git a/AndroidProducts.mk b/AndroidProducts.mk new file mode 100644 index 0000000..431511e --- /dev/null +++ b/AndroidProducts.mk @@ -0,0 +1,17 @@ +# Copyright (C) 2018-2019 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. +# + +PRODUCT_MAKEFILES := \ + $(LOCAL_DIR)/qemu_trusty_arm64.mk diff --git a/BoardConfig.mk b/BoardConfig.mk new file mode 100644 index 0000000..508645b --- /dev/null +++ b/BoardConfig.mk @@ -0,0 +1,53 @@ +# Copyright (C) 2019 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. +# + +# The generic product target doesn't have any hardware-specific pieces. +TARGET_NO_BOOTLOADER := true +TARGET_NO_KERNEL := true +TARGET_ARCH := arm64 +TARGET_ARCH_VARIANT := armv8-a +TARGET_CPU_VARIANT := generic +TARGET_CPU_ABI := arm64-v8a +TARGET_BOOTLOADER_BOARD_NAME := trusty_$(TARGET_ARCH) + +TARGET_2ND_ARCH := arm +TARGET_2ND_ARCH_VARIANT := armv7-a +TARGET_2ND_CPU_ABI := armeabi-v7a +TARGET_2ND_CPU_ABI2 := armeabi + +BOARD_SEPOLICY_DIRS += device/generic/trusty/sepolicy + +TARGET_USES_64_BIT_BINDER := true + +BUILD_QEMU_IMAGES := true + +TARGET_USERIMAGES_USE_EXT4 := true +BOARD_SYSTEMIMAGE_PARTITION_SIZE := 33554432 # 32M +BOARD_USERDATAIMAGE_PARTITION_SIZE := 4194304 # 4M +TARGET_COPY_OUT_VENDOR := vendor +# ~100 MB vendor image. Please adjust system image / vendor image sizes +# when finalizing them. +BOARD_VENDORIMAGE_PARTITION_SIZE := 4194304 # 4M +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_FLASH_BLOCK_SIZE := 512 +TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true +DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml + +BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true +BOARD_SEPOLICY_DIRS += build/target/board/generic/sepolicy + +# Enable A/B update +TARGET_NO_RECOVERY := true +BOARD_BUILD_SYSTEM_ROOT_IMAGE := true diff --git a/init.qemu_trusty.rc b/init.qemu_trusty.rc new file mode 100644 index 0000000..a67cf48 --- /dev/null +++ b/init.qemu_trusty.rc @@ -0,0 +1,106 @@ +on fs + mount_all /fstab.qemu_trusty + +on early-init + mount debugfs debugfs /sys/kernel/debug mode=755 + +on post-fs-data + setprop vold.post_fs_data_done 1 + +on boot + chown root system /sys/power/wake_lock + chown root system /sys/power/wake_unlock + setprop ro.radio.use-ppp no + setprop ro.build.product generic + setprop ro.product.device generic + setprop ro.hardware.audio.primary goldfish + setprop ro.setupwizard.mode EMULATOR + +# fake some battery state + setprop status.battery.state Slow + setprop status.battery.level 5 + setprop status.battery.level_raw 50 + setprop status.battery.level_scale 9 + +# set up the GPU caching + setprop ro.hwui.texture_cache_size 72 + setprop ro.hwui.layer_cache_size 48 + setprop ro.hwui.r_buffer_cache_size 8 + setprop ro.hwui.path_cache_size 32 + setprop ro.hwui.gradient_cache_size 1 + setprop ro.hwui.drop_shadow_cache_size 6 + setprop ro.hwui.texture_cache_flushrate 0.4 + setprop ro.hwui.text_small_cache_width 1024 + setprop ro.hwui.text_small_cache_height 1024 + setprop ro.hwui.text_large_cache_width 2048 + setprop ro.hwui.text_large_cache_height 1024 + +# disable some daemons the emulator doesn't want + stop dund + stop akmd + +# start essential services +# These were written for the classic emulator, but are applicable to ranchu + start goldfish-logcat +# start goldfish-setup + + +# enable Google-specific location features, +# like NetworkLocationProvider and LocationCollector + setprop ro.com.google.locationfeatures 1 + +#emulator is not much useful before boot complete +#start it later +on property:sys.boot_completed=1 + setprop sys.usb.config adb + start adbd + start goldfish-logcat + start qemu_trusty-net + +on property:qemu.adbd=start + setprop sys.usb.config adb + start adbd + start goldfish-logcat + +service qemu_trusty-net /vendor/bin/dhcpclient -i eth0 + class late_start + user root + group root wakelock + +# The qemu-props program is used to set various system +# properties on boot. It must be run early during the boot +# process to avoid race conditions with other daemons that +# might read them (e.g. surface flinger), so define it in +# class 'core' +# +service qemu-props /vendor/bin/qemu-props + class core + user root + group root + oneshot + +on property:qemu.logcat=start + start goldfish-logcat + +# -Q is a special logcat option that forces the +# program to check wether it runs on the emulator +# if it does, it redirects its output to the device +# named by the androidboot.console kernel option +# if not, is simply exits immediately +# logd user added to prevent logcat from logging content. +# log group added to support access to read logs socket. +service goldfish-logcat /system/bin/logcat -Q + user logd + group log + oneshot + +service fingerprintd /system/bin/fingerprintd + class late_start + user system + +service bugreport /system/bin/dumpstate -d -p -B \ + -o /data/user_de/0/com.android.shell/files/bugreports/bugreport + class main + disabled + oneshot + keycodes 114 115 116 diff --git a/qemu_trusty_arm64.mk b/qemu_trusty_arm64.mk new file mode 100644 index 0000000..a643328 --- /dev/null +++ b/qemu_trusty_arm64.mk @@ -0,0 +1,22 @@ +# 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. + +$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk) +$(call inherit-product, $(LOCAL_PATH)/qemu_trusty_base.mk) + +PRODUCT_NAME := qemu_trusty_arm64 +PRODUCT_DEVICE := trusty +PRODUCT_BRAND := Android +PRODUCT_MODEL := qemu-trusty-arm64 + diff --git a/qemu_trusty_base.mk b/qemu_trusty_base.mk new file mode 100644 index 0000000..256a20d --- /dev/null +++ b/qemu_trusty_base.mk @@ -0,0 +1,73 @@ +# +# Copyright (C) 2018-2019 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. + +# This file contains the definitions needed for a _really_ minimal system +# image to be run under emulation under upstream QEMU (www.qemu.org), once +# it supports a few Android virtual devices. Note that this is _not_ the +# same as running under the Android emulator. + +PRODUCT_PACKAGES += \ + android.hidl.allocator@1.0-service \ + init \ + init_system \ + init_vendor \ + init.environ.rc \ + init.rc \ + linker \ + linker64 \ + logcat \ + logd \ + logwrapper \ + servicemanager \ + hwservicemanager \ + vndservicemanager \ + sh \ + toolbox \ + toybox \ + vold \ + reboot \ + adbd \ + dhcpclient \ + mdnsd \ + +# SELinux packages are added as dependencies of the selinux_policy +# phony package. +PRODUCT_PACKAGES += \ + selinux_policy \ + +PRODUCT_COPY_FILES += \ + system/core/rootdir/init.usb.rc:root/init.usb.rc \ + system/core/rootdir/init.usb.configfs.rc:root/init.usb.configfs.rc \ + system/core/rootdir/ueventd.rc:root/ueventd.rc \ + system/core/rootdir/etc/hosts:system/etc/hosts \ + +PRODUCT_FULL_TREBLE_OVERRIDE := true + +PRODUCT_COPY_FILES += \ + device/generic/qemu/fstab.ranchu:root/fstab.qemu_trusty \ + device/generic/trusty/init.qemu_trusty.rc:root/init.qemu_trusty.rc \ + +PRODUCT_COPY_FILES += \ + device/generic/goldfish/data/etc/config.ini:config.ini \ + device/generic/qemu/advancedFeatures.ini:advancedFeatures.ini \ + +# for Trusty +$(call inherit-product, system/core/trusty/trusty-base.mk) +$(call inherit-product, system/core/trusty/trusty-storage.mk) + +PRODUCT_PACKAGES += \ + tipc-test \ + trusty-ut-ctrl \ + diff --git a/sepolicy/dhcpclient.te b/sepolicy/dhcpclient.te new file mode 100644 index 0000000..7aeb2f4 --- /dev/null +++ b/sepolicy/dhcpclient.te @@ -0,0 +1,18 @@ +# DHCP client +type dhcpclient, domain; +type dhcpclient_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(dhcpclient) +net_domain(dhcpclient) + +dontaudit dhcpclient kernel:system module_request; +allow dhcpclient self:capability { net_admin net_raw }; +allow dhcpclient self:udp_socket create; +allow dhcpclient self:netlink_route_socket { write nlmsg_write }; +allow dhcpclient varrun_file:dir search; +allow dhcpclient self:packet_socket { create bind write read }; +allowxperm dhcpclient self:udp_socket ioctl { SIOCSIFFLAGS + SIOCSIFADDR + SIOCSIFNETMASK + SIOCSIFMTU + SIOCGIFHWADDR }; diff --git a/sepolicy/file.te b/sepolicy/file.te new file mode 100644 index 0000000..b3bd582 --- /dev/null +++ b/sepolicy/file.te @@ -0,0 +1 @@ +type varrun_file, file_type, data_file_type, mlstrustedobject; diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts new file mode 100644 index 0000000..6e7e8c6 --- /dev/null +++ b/sepolicy/file_contexts @@ -0,0 +1,3 @@ +/dev/trusty-ipc-dev0 u:object_r:trusty_ipc_device:s0 +/vendor/bin/dhcpclient u:object_r:dhcpclient_exec:s0 +/data/vendor/var/run(/.*)? u:object_r:varrun_file:s0 diff --git a/sepolicy/trusty_test.te b/sepolicy/trusty_test.te new file mode 100644 index 0000000..08d347a --- /dev/null +++ b/sepolicy/trusty_test.te @@ -0,0 +1,3 @@ +type trusty_ipc_device, dev_type; + +allow shell trusty_ipc_device:chr_file { open read write ioctl }; diff --git a/vendor.mk b/vendor.mk new file mode 100644 index 0000000..4cc62d2 --- /dev/null +++ b/vendor.mk @@ -0,0 +1,23 @@ +# +# Copyright (C) 2019 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. + +# This file contains the definitions needed for a _really_ minimal system +# image to be run under emulation under upstream QEMU (www.qemu.org), once +# it supports a few Android virtual devices. Note that this is _not_ the +# same as running under the Android emulator. + +PRODUCT_PACKAGES += + dhcpclient \ + diff --git a/vendorsetup.sh b/vendorsetup.sh new file mode 100644 index 0000000..350b3ce --- /dev/null +++ b/vendorsetup.sh @@ -0,0 +1,22 @@ +# Copyright (C) 2018-2019 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. +# + +# This file is executed by build/envsetup.sh, and can use anything +# defined in envsetup.sh. +# +# In particular, you can add lunch options with the add_lunch_combo +# function: add_lunch_combo generic-eng + +add_lunch_combo qemu_trusty_arm64-userdebug |