linaro_swr: A generic build target using software rendering am: b2534ba966 am: c627a70ca5 am: 118f9394db am: a3166e1c98 am: 597f6e59bf
Original change: https://android-review.googlesource.com/c/device/linaro/dragonboard/+/2606600
Change-Id: Ib363f22eae0de166e98b6af4e96e0dea8ae3ebe1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/Android.mk b/Android.mk
index d1957d6..c2b86c7 100644
--- a/Android.mk
+++ b/Android.mk
@@ -20,7 +20,7 @@
# to only building on ARM if they include assembly. Individual makefiles
# are responsible for having their own logic, for fine-grained control.
-ifneq ($(filter db845c rb5, $(TARGET_BOARD_PLATFORM)),)
+ifneq ($(filter db845c rb5 linaro_swr, $(TARGET_BOARD_PLATFORM)),)
LOCAL_PATH := $(call my-dir)
diff --git a/AndroidProducts.mk b/AndroidProducts.mk
index 3492246..b0d92fb 100644
--- a/AndroidProducts.mk
+++ b/AndroidProducts.mk
@@ -15,6 +15,7 @@
$(LOCAL_DIR)/rb5.mk \
$(LOCAL_DIR)/rb5_mini.mk \
$(LOCAL_DIR)/sm8450_mini.mk \
+ $(LOCAL_DIR)/linaro_swr.mk \
COMMON_LUNCH_CHOICES := \
db845c-userdebug \
diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index 7723dc3..ed747b7 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
@@ -1,4 +1,4 @@
-ifneq ($(filter db845c db845c_mini, $(TARGET_DEVICE)),)
+ifneq ($(filter db845c db845c_mini linaro_swr, $(TARGET_DEVICE)),)
$(PRODUCT_OUT)/dtb.img: $(TARGET_KERNEL_DIR)/sdm845-db845c.dtb $(wildcard $(TARGET_KERNEL_DIR)/qrb5165-rb5.dtb)
cat $^ > $@
diff --git a/linaro_swr.mk b/linaro_swr.mk
new file mode 100644
index 0000000..fead873
--- /dev/null
+++ b/linaro_swr.mk
@@ -0,0 +1,13 @@
+$(call inherit-product, device/linaro/dragonboard/full.mk)
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/drm_hwcomposer/device.mk)
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/minigbm_msm/device.mk)
+$(call inherit-product, device/linaro/dragonboard/shared/graphics/swangle/device.mk)
+$(call inherit-product, device/linaro/dragonboard/linaro_swr/device.mk)
+
+# Target is using software rendering
+TARGET_USES_SWR := true
+
+# Product overrides
+PRODUCT_NAME := linaro_swr
+PRODUCT_DEVICE := linaro_swr
+PRODUCT_BRAND := Android
diff --git a/linaro_swr/Android.mk b/linaro_swr/Android.mk
new file mode 100644
index 0000000..6f725c0
--- /dev/null
+++ b/linaro_swr/Android.mk
@@ -0,0 +1,6 @@
+LOCAL_PATH := $(call my-dir)
+
+# If some modules are built directly from this directory (not subdirectories),
+# their rules should be written here.
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/linaro_swr/BoardConfig.mk b/linaro_swr/BoardConfig.mk
new file mode 100644
index 0000000..615bf03
--- /dev/null
+++ b/linaro_swr/BoardConfig.mk
@@ -0,0 +1,54 @@
+include device/linaro/dragonboard/BoardConfigCommon.mk
+
+# Primary Arch
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-2a
+TARGET_CPU_VARIANT := kryo385
+TARGET_CPU_ABI := arm64-v8a
+
+# Secondary Arch
+TARGET_2ND_ARCH := arm
+TARGET_2ND_ARCH_VARIANT := armv8-2a
+TARGET_2ND_CPU_VARIANT := kryo385
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+
+# Board Information
+TARGET_BOOTLOADER_BOARD_NAME := linaro_swr
+TARGET_BOARD_PLATFORM := linaro_swr
+
+TARGET_NO_KERNEL := false
+BOARD_INCLUDE_DTB_IN_BOOTIMG := true
+BOARD_BOOT_HEADER_VERSION := 4
+BOARD_MKBOOTIMG_ARGS := --header_version $(BOARD_BOOT_HEADER_VERSION)
+
+BOARD_KERNEL_BASE := 0x80000000
+BOARD_KERNEL_PAGESIZE := 4096
+BOARD_KERNEL_CMDLINE += earlycon firmware_class.path=/vendor/firmware/
+BOARD_KERNEL_CMDLINE += init=/init printk.devkmsg=on
+BOARD_KERNEL_CMDLINE += deferred_probe_timeout=30
+BOARD_KERNEL_CMDLINE += pcie_pme=nomsi #For WiFi to work on rb5
+BOARD_KERNEL_CMDLINE += qcom_geni_serial.con_enabled=1
+BOARD_KERNEL_CMDLINE += console=ttyMSM0,115200n8
+BOARD_BOOTCONFIG := androidboot.hardware=linaro_swr androidboot.boot_devices=soc@0/1d84000.ufshc
+BOARD_BOOTCONFIG += androidboot.verifiedbootstate=orange
+
+# Image Configuration
+BOARD_BOOTIMAGE_PARTITION_SIZE := 103079215104 #96M
+BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 103079215104 #96M
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 21474836480 #20G
+BOARD_FLASH_BLOCK_SIZE := 4096
+# Super partition
+BOARD_SUPER_PARTITION_SIZE := 12437225472
+BOARD_DB_DYNAMIC_PARTITIONS_SIZE := 12433031168 # Reserve 4M for DAP metadata
+BOARD_SUPER_PARTITION_METADATA_DEVICE := super
+BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE := true
+# dlkm partition
+include device/linaro/dragonboard/shared/utils/dlkm_loader/BoardConfig.mk
+BOARD_SEPOLICY_DIRS += device/linaro/dragonboard/shared/utils/dlkm_loader/sepolicy/
+
+# Graphics
+include device/linaro/dragonboard/shared/graphics/drm_hwcomposer/BoardConfig.mk
+BOARD_SEPOLICY_DIRS += \
+ device/linaro/dragonboard/shared/graphics/minigbm_msm/sepolicy \
+ device/linaro/dragonboard/shared/graphics/swangle/sepolicy
diff --git a/linaro_swr/device.mk b/linaro_swr/device.mk
new file mode 100644
index 0000000..df9a79c
--- /dev/null
+++ b/linaro_swr/device.mk
@@ -0,0 +1,68 @@
+#
+# Copyright (C) 2011 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.
+#
+
+# setup dalvik vm configs
+$(call inherit-product, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-heap.mk)
+
+include $(LOCAL_PATH)/../vendor-package-ver.mk
+$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota.mk)
+
+# dlkm_loader
+include device/linaro/dragonboard/shared/utils/dlkm_loader/device.mk
+PRODUCT_COPY_FILES += \
+ device/linaro/dragonboard/shared/utils/dlkm_loader/dlkm_loader.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/dlkm_loader.rc
+
+# Build generic Audio HAL
+PRODUCT_PACKAGES += audio.primary.linaro_swr
+
+# BootControl HAL
+PRODUCT_PACKAGES += \
+ android.hardware.boot@1.2-impl \
+ android.hardware.boot@1.2-impl.recovery \
+ android.hardware.boot@1.2-service
+
+# Set BT address
+PRODUCT_PACKAGES += bdaddr
+
+# Install bdaddr script
+PRODUCT_COPY_FILES += \
+ device/linaro/dragonboard/shared/utils/bdaddr/set_bdaddr.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_bdaddr.sh
+
+# Install scripts to set vendor.* properties
+PRODUCT_COPY_FILES += \
+ device/linaro/dragonboard/shared/utils/set_hw.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_hw.sh \
+ device/linaro/dragonboard/shared/utils/set_udc.sh:$(TARGET_COPY_OUT_VENDOR)/bin/set_udc.sh
+
+# Install scripts to set Ethernet MAC address
+PRODUCT_COPY_FILES += \
+ device/linaro/dragonboard/shared/utils/ethaddr/ethaddr.rc:/system/etc/init/ethaddr.rc \
+ device/linaro/dragonboard/shared/utils/ethaddr/set_ethaddr.sh:/system/bin/set_ethaddr.sh
+
+PRODUCT_VENDOR_PROPERTIES += \
+ ro.soc.manufacturer=Generic Qcom arm64 arch \
+ ro.soc.model=linaro_swr
+
+PRODUCT_VENDOR_PROPERTIES += \
+ vendor.minigbm.debug=nocompression
+
+# Copy firmware files
+$(call inherit-product-if-exists, vendor/linaro/db845c/$(EXPECTED_LINARO_VENDOR_VERSION)/device.mk)
+$(call inherit-product-if-exists, vendor/linaro/rb5/$(EXPECTED_LINARO_VENDOR_VERSION)/device.mk)
+
+TARGET_HARDWARE := linaro_swr
+TARGET_KERNEL_USE ?= 6.1
+
+include device/linaro/dragonboard/device-common.mk
diff --git a/shared/graphics/swangle/device.mk b/shared/graphics/swangle/device.mk
new file mode 100644
index 0000000..0eebc66
--- /dev/null
+++ b/shared/graphics/swangle/device.mk
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2014 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.
+#
+
+# TODO(b/65201432): Swiftshader needs to create executable memory.
+PRODUCT_REQUIRES_INSECURE_EXECMEM_FOR_SWIFTSHADER := true
+
+# ANGLE provides an OpenGL implementation built on top of Vulkan.
+PRODUCT_PACKAGES := \
+ libEGL_angle \
+ libGLESv1_CM_angle \
+ libGLESv2_angle
+
+PRODUCT_VENDOR_PROPERTIES := \
+ ro.hardware.egl=angle \
+
+PRODUCT_PROPERTY_OVERRIDES := \
+ ro.sf.lcd_density=160 \
+ ro.opengles.version=196608 \
+ persist.demo.rotationlock=1
+
+PRODUCT_COPY_FILES := \
+ frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.xml \
+ frameworks/native/data/etc/android.software.opengles.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
+
+# Vulkan
+TARGET_VULKAN_SUPPORT := true
+TARGET_USES_VULKAN := true
+
+PRODUCT_PACKAGES += vulkan.pastel
+
+PRODUCT_COPY_FILES += \
+ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \
+ frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \
+ frameworks/native/data/etc/android.hardware.vulkan.version-1_1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \
+ frameworks/native/data/etc/android.software.vulkan.deqp.level-2021-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml
+
+PRODUCT_VENDOR_PROPERTIES += \
+ ro.hardware.vulkan=pastel
diff --git a/shared/graphics/swangle/sepolicy/file_contexts b/shared/graphics/swangle/sepolicy/file_contexts
new file mode 100644
index 0000000..472f013
--- /dev/null
+++ b/shared/graphics/swangle/sepolicy/file_contexts
@@ -0,0 +1,5 @@
+/vendor/lib(64)?/hw/vulkan.pastel.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libEGL_angle\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv1_CM_angle\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libGLESv2_angle\.so u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libfeature_support_angle\.so u:object_r:same_process_hal_file:s0
diff --git a/shared/graphics/swangle/sepolicy/sw_execmem.te b/shared/graphics/swangle/sepolicy/sw_execmem.te
new file mode 100644
index 0000000..0844c3c
--- /dev/null
+++ b/shared/graphics/swangle/sepolicy/sw_execmem.te
@@ -0,0 +1,5 @@
+# TODO(b/65201432): Swiftshader needs to create executable memory.
+allow bootanim self:process execmem;
+allow surfaceflinger self:process execmem;
+allow system_server self:process execmem;
+allow zygote self:process execmem;