Factor out the sdm845 device configuration

Moved files around in a new shared/ folder. Renamed relevant
files and updated relative path. No feature changes.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
[caleb: rebased on 734404a]
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
diff --git a/shared/Android.mk b/shared/Android.mk
new file mode 100644
index 0000000..1648f44
--- /dev/null
+++ b/shared/Android.mk
@@ -0,0 +1,28 @@
+#
+# Copyright (C) 2015 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.
+#
+
+# WARNING: Everything listed here will be built on ALL platforms,
+# including x86, the emulator, and the SDK.  Modules must be uniquely
+# named (liblights.panda), and must build everywhere, or limit themselves
+# to only building on ARM if they include assembly. Individual makefiles
+# are responsible for having their own logic, for fine-grained control.
+
+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/shared/BoardConfig.mk b/shared/BoardConfig.mk
new file mode 100644
index 0000000..24fc2b0
--- /dev/null
+++ b/shared/BoardConfig.mk
@@ -0,0 +1,91 @@
+# Copyright (C) 2013 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.
+#
+
+# 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
+
+TARGET_USES_64_BIT_BINDER := true
+
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := false
+TARGET_NO_RECOVERY := true
+
+# Kernel/boot.img Configuration
+BOARD_KERNEL_BASE        := 0x00000000
+BOARD_KERNEL_PAGESIZE    := 4096
+BOARD_KERNEL_TAGS_OFFSET := 0x00000100
+BOARD_RAMDISK_OFFSET     := 0x01000000
+BOARD_KERNEL_CMDLINE     := console=ttyMSM0,115200n8 earlycon earlyprintk console=tty0 androidboot.console=ttyMSM0
+BOARD_KERNEL_CMDLINE     += androidboot.boot_devices=soc@0/1d84000.ufshc
+BOARD_KERNEL_CMDLINE     += firmware_class.path=/vendor/firmware/ init=/init printk.devkmsg=on
+BOARD_KERNEL_CMDLINE     += deferred_probe_timeout=30 androidboot.selinux=permissive
+
+# Image Configuration
+BOARD_FLASH_BLOCK_SIZE := 262144
+BOARD_BOOTIMAGE_PARTITION_SIZE     := 67108864 #64M
+BOARD_VENDORIMAGE_PARTITION_SIZE   := 536870912
+
+BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := ext4
+TARGET_USERIMAGES_USE_EXT4 := true
+TARGET_USERIMAGES_USE_F2FS := true
+TARGET_COPY_OUT_VENDOR := vendor
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
+
+# Enable Treble
+PRODUCT_FULL_TREBLE := true
+BOARD_VNDK_VERSION := current
+
+# Mesa DRM hwcomposer
+BOARD_USES_DRM_HWCOMPOSER := true
+BOARD_GPU_DRIVERS := freedreno virgl
+TARGET_USES_HWC2 := true
+
+# WiFi
+WPA_SUPPLICANT_VERSION := VER_0_8_X
+BOARD_WPA_SUPPLICANT_DRIVER := NL80211
+BOARD_HOSTAPD_DRIVER := NL80211
+BOARD_WLAN_DEVICE := qcwcn
+BOARD_HOSTAPD_PRIVATE_LIB := lib_driver_cmd_$(BOARD_WLAN_DEVICE)
+
+# BT
+BOARD_HAVE_BLUETOOTH := true
+
+# TinyHAL
+BOARD_USES_TINYHAL_AUDIO := true
+
+BOARD_SEPOLICY_DIRS += \
+    device/generic/sdm845/shared/sepolicy \
+    system/bt/vendor_libs/linux/sepolicy
+
+DEVICE_MANIFEST_FILE := device/generic/sdm845/shared/manifest.xml
+DEVICE_MATRIX_FILE := device/generic/sdm845/shared/compatibility_matrix.xml
+
+# Enable dex pre-opt to speed up initial boot
+ifeq ($(HOST_OS),linux)
+  ifeq ($(WITH_DEXPREOPT),)
+    WITH_DEXPREOPT := true
+    WITH_DEXPREOPT_PIC := true
+  endif
+endif
diff --git a/shared/compatibility_matrix.xml b/shared/compatibility_matrix.xml
new file mode 100644
index 0000000..3082485
--- /dev/null
+++ b/shared/compatibility_matrix.xml
@@ -0,0 +1,59 @@
+<compatibility-matrix version="1.0" type="device">
+    <hal format="hidl" optional="false">
+        <name>android.frameworks.schedulerservice</name>
+        <version>1.0</version>
+        <interface>
+            <name>ISchedulingPolicyService</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="false">
+        <name>android.frameworks.sensorservice</name>
+        <version>1.0</version>
+        <interface>
+            <name>ISensorManager</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="false">
+        <name>android.hidl.allocator</name>
+        <version>1.0</version>
+        <interface>
+            <name>IAllocator</name>
+            <instance>ashmem</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="false">
+        <name>android.hidl.manager</name>
+        <version>1.0</version>
+        <interface>
+            <name>IServiceManager</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="false">
+        <name>android.hidl.memory</name>
+        <version>1.0</version>
+        <interface>
+            <name>IMapper</name>
+            <instance>ashmem</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="false">
+        <name>android.hidl.token</name>
+        <version>1.0</version>
+        <interface>
+            <name>ITokenManager</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl" optional="false">
+        <name>android.system.wifi.keystore</name>
+        <version>1.0</version>
+        <interface>
+            <name>IKeystore</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+
+</compatibility-matrix>
diff --git a/shared/device.mk b/shared/device.mk
new file mode 100644
index 0000000..015419e
--- /dev/null
+++ b/shared/device.mk
@@ -0,0 +1,223 @@
+#
+# 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.
+#
+
+# copied from crosshatch
+# setup dalvik vm configs
+$(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk)
+
+# Enable updating of APEXes
+$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
+
+# Device overlay
+DEVICE_PACKAGE_OVERLAYS := $(LOCAL_PATH)/overlay
+
+# Build and run only ART
+PRODUCT_RUNTIMES := runtime_libart_default
+
+PRODUCT_SHIPPING_API_LEVEL := 29
+PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := false
+
+# Enable Scoped Storage related
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
+
+# vndk
+PRODUCT_PACKAGES := vndk-sp
+
+# HACK: Avoid usb crash
+PRODUCT_PRODUCT_PROPERTIES := \
+    persist.adb.nonblocking_ffs=0 \
+    ro.adb.nonblocking_ffs=0
+
+# Display
+PRODUCT_PACKAGES += \
+    android.hardware.drm@1.0-impl \
+    android.hardware.drm@1.0-service \
+    libGLES_mesa
+
+PRODUCT_PROPERTY_OVERRIDES += \
+    ro.hardware.gralloc=minigbm_msm \
+    ro.hardware.hwcomposer=drm \
+    debug.sf.no_hw_vsync=1 \
+    ro.sf.lcd_density=400 \
+    ro.opengles.version=196609
+
+#
+# Hardware Composer HAL
+#
+PRODUCT_PACKAGES += \
+    hwcomposer.drm \
+    android.hardware.graphics.composer@2.3-impl \
+    android.hardware.graphics.composer@2.3-service
+
+#
+# Gralloc HAL
+#
+PRODUCT_PACKAGES += \
+    gralloc.minigbm_msm \
+    android.hardware.graphics.allocator@4.0-service.minigbm_msm \
+    android.hardware.graphics.mapper@4.0-impl.minigbm_msm
+
+# Use Launcher3QuickStep
+PRODUCT_PACKAGES += Launcher3QuickStep
+
+# Enable WiFi
+PRODUCT_PACKAGES += \
+    hostapd \
+    libwpa_client \
+    wpa_supplicant \
+    wpa_supplicant.conf \
+    wificond
+
+PRODUCT_PACKAGES += \
+    pd-mapper \
+    qrtr-ns \
+    qrtr-cfg \
+    qrtr-lookup \
+    rmtfs \
+    tqftpserv
+
+PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/vendor/init.vendor.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.vendor.rc
+
+# Install scripts to set consistent Wifi MAC address
+PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/bin/set_wlan_mac.rc:/system/etc/init/set_wlan_mac.rc \
+    $(LOCAL_PATH)/bin/set_wlan_mac.sh:/system/bin/set_wlan_mac.sh
+
+PRODUCT_PROPERTY_OVERRIDES += \
+    wifi.interface=wlan0 \
+    wifi.supplicant_scan_interval=15
+
+PRODUCT_COPY_FILES += \
+    frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \
+    frameworks/native/data/etc/android.hardware.wifi.direct.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.direct.xml \
+    $(LOCAL_PATH)/etc/wifi/wpa_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/wpa_supplicant_overlay.conf \
+    $(LOCAL_PATH)/etc/wifi/p2p_supplicant_overlay.conf:$(TARGET_COPY_OUT_VENDOR)/etc/wifi/p2p_supplicant_overlay.conf
+
+# Enable BT
+PRODUCT_PACKAGES += \
+    android.hardware.bluetooth@1.1-service.btlinux
+
+PRODUCT_COPY_FILES += \
+    frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
+    frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml
+
+# Audio
+PRODUCT_PACKAGES += \
+    android.hardware.audio.service \
+    android.hardware.audio@7.0-impl \
+    android.hardware.audio.effect@7.0-impl \
+    android.hardware.soundtrigger@2.2-impl \
+    android.hardware.bluetooth.audio@2.0-impl
+
+# Build default bluetooth a2dp and usb audio HALs
+PRODUCT_PACKAGES += \
+    audio.a2dp.default \
+    audio.bluetooth.default \
+    audio.usb.default \
+    audio.r_submix.default
+
+# Build tinyalsa cli tools for debugging
+PRODUCT_PACKAGES += \
+    tinyplay2 \
+    tinycap2 \
+    tinymix2 \
+    tinypcminfo2
+
+# audio policy configuration
+USE_XML_AUDIO_POLICY_CONF := 1
+PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/etc/audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration.xml \
+    $(LOCAL_PATH)/etc/audio_policy_configuration_bluetooth_legacy_hal.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_configuration_bluetooth_legacy_hal.xml \
+    $(LOCAL_PATH)/etc/public.libraries.txt:$(TARGET_COPY_OUT_VENDOR)/etc/public.libraries.txt \
+    frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/a2dp_in_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_in_audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/primary_audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/usb_audio_policy_configuration.xml \
+    frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
+    frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml
+
+# Copy media codecs config file
+PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/etc/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
+    frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
+    frameworks/av/media/libstagefright/data/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
+    frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml
+
+PRODUCT_COPY_FILES += \
+    $(LOCAL_PATH)/seccomp_policy/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediacodec.policy \
+    $(LOCAL_PATH)/seccomp_policy/mediaswcodec.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaswcodec.policy \
+    $(LOCAL_PATH)/seccomp_policy/mediaextractor.policy:$(TARGET_COPY_OUT_VENDOR)/etc/seccomp_policy/mediaextractor.policy \
+
+# Copy hardware config file(s)
+PRODUCT_COPY_FILES +=  \
+        device/linaro/dragonboard/etc/permissions/android.software.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.xml
+
+# Memtrack
+# PRODUCT_PACKAGES += \
+#     memtrack.default \
+#     android.hardware.memtrack@1.0-service \
+#     android.hardware.memtrack@1.0-impl
+
+# Keymaster
+PRODUCT_PACKAGES += \
+    android.hardware.keymaster@3.0-impl \
+    android.hardware.keymaster@3.0-service
+
+# Gatekeeper
+PRODUCT_PACKAGES += \
+    android.hardware.gatekeeper@1.0-service.software
+
+# Health
+PRODUCT_PACKAGES += \
+    android.hardware.health@2.1-service \
+    android.hardware.health@2.1-impl-sdm845
+
+
+# mkbootimg host tool to build boot.img separately
+PRODUCT_HOST_PACKAGES := \
+    mkbootimg
+
+# Lights
+PRODUCT_PACKAGES += \
+    android.hardware.light@2.0-impl \
+    android.hardware.light@2.0-service
+
+# Haptics
+PRODUCT_PACKAGES += \
+    android.hardware.vibrator@1.1-service.ff
+
+# Copy standard platform config files
+PRODUCT_COPY_FILES +=  \
+    $(LOCAL_PATH)/ueventd.common.rc:$(TARGET_COPY_OUT_VENDOR)/ueventd.rc \
+    frameworks/native/data/etc/android.software.cts.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.cts.xml \
+    frameworks/native/data/etc/android.software.app_widgets.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.app_widgets.xml \
+    frameworks/native/data/etc/android.software.backup.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.backup.xml \
+    frameworks/native/data/etc/android.software.voice_recognizers.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.voice_recognizers.xml \
+    frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \
+    frameworks/native/data/etc/android.software.print.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.print.xml \
+    frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
+    frameworks/native/data/etc/android.hardware.usb.host.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.host.xml \
+    frameworks/native/data/etc/android.software.device_admin.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.device_admin.xml
+
+# Copy firmware files
+$(call inherit-product-if-exists, $(LOCAL_PATH)/firmware/device.mk)
+
+PRODUCT_SOONG_NAMESPACES += \
+    device/generic/sdm845 \
+    external/mesa3d
diff --git a/shared/etc/audio.sdm845.xml b/shared/etc/audio.sdm845.xml
new file mode 100644
index 0000000..bb8937e
--- /dev/null
+++ b/shared/etc/audio.sdm845.xml
@@ -0,0 +1,357 @@
+<!-- This file is provided as a reference for writing config files
+It does NOT represent any particular device and will NOT work on
+real hardware. You must create a file with the correct settings for
+your hardware, and the comments here will explain the layout of this
+file and expected content.
+On the target device this file must be located in /system/etc and named
+audio.<device>.xml, where <device> is the string returned by the system
+property ro.product.device
+-->
+
+<audiohal>
+
+    <!-- mixer element _must_ appear before any of the other definitions.
+    The ALSA card can be identified either by card number or by name.
+    Connect to ALSA card 0:
+        <mixer card="0">
+    Connect to ALSA card called "FooSound"
+        <mixer name="FooSound">
+    When the card is given by name, TinyHAL searches all /proc/asound/card*/id
+    files for a matching name.
+    -->
+        <mixer card="0"> <!-- <mixer name="sdm845" > -->
+
+        <!-- A pre_init element lists control settings that will cause new ALSA
+        controls to be added. Typically this is used to load firmware into a
+        DSP, causing new ALSA controls to be added for controls exported by the
+        firmware. After processing a pre_init element the ALSA controls are
+        reloaded to pick up any new controls. Other elements in the
+        configuration can then use those controls.
+        Multiple pre_init elements can be used, so that a pre_init can depend
+        on controls populated by a previous pre_init.
+        All pre_init elements must appear before the init element.
+        -->
+
+        <pre_init>
+            <!-- A list of ctl elements - see description of init element -->
+            <!-- <ctl name="DSP1 Preload Switch" val="1" /> -->
+        </pre_init>
+
+        <!-- An init element lists control settings required to initialize the
+        hardware and driver. These settings are applied only once when the
+        library is first loaded during boot.
+        -->
+
+        <init>
+
+            <!-- A sequence of ctl elements. Each entry sets a mixer
+            control to a given value. The entries are applied in the
+            order they are listed here.
+            Each entry _must_ have these attributes
+                name - name of the ALSA mixer control
+                val  - value to set it to
+            It can also have an index attribute giving the numeric index
+            of the control value to set. This is used where a control
+            has multiple value slots (for example a volume control
+            with two values, one for left channel and one for right), If
+            an index attribute is not given the content of the val attribute
+            will be applied to all value slots of the control.
+            The numbers in val and index attributes can be given in either
+            decimal, or hex (hex is prefixed with 0x). For a control with
+            enumerated values the val attribute must be a string
+            BYTE ARRAYS: for controls that are a byte array val must be
+            a string of comma-separated byte values. This can be shorter
+            than the total size of the control, combined with the
+            optional index attribute this allows any subset of the byte
+            array to be changed. Alternatively, a file attribute can be given
+            instead of the val attribute, and the raw byte content of the file
+            will be copied into the control. Note that the bytes in the file
+            must already be correctly formatted for writing into the ALSA
+            control. The file is read once when TinyHAL starts and this
+            cached content is used every time this <ctl> element is invoked.
+            -->
+
+            <ctl name="QUAT_MI2S_RX Audio Mixer MultiMedia1" val="1" />
+            <ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia2" val="1" />
+            <ctl name="MultiMedia3 Mixer SLIMBUS_0_TX" val="1" />
+            <ctl name="AIF1_CAP Mixer SLIM TX7" val="1" />
+            <ctl name="CDC_IF TX7 MUX" val="DEC7" />
+            <ctl name="SLIM RX0 MUX" val="AIF1_PB" />
+            <ctl name="SLIM RX1 MUX" val="AIF1_PB" />
+            <ctl name="SLIM RX2 MUX" val="AIF1_PB" />
+            <ctl name="SLIM RX3 MUX" val="AIF1_PB" />
+            <ctl name="SLIM RX4 MUX" val="ZERO" />
+            <ctl name="SLIM RX5 MUX" val="ZERO" />
+            <ctl name="SLIM RX6 MUX" val="ZERO" />
+            <ctl name="SLIM RX7 MUX" val="ZERO" />
+            <ctl name="RX INT7_1 MIX1 INP0" val="RX0" />
+            <ctl name="RX INT8_1 MIX1 INP0" val="RX1" />
+            <ctl name="RX INT1_2 MUX" val="RX0" />
+            <ctl name="RX INT2_2 MUX" val="RX1" />
+
+
+        </init>
+        </mixer>
+
+<!-- Next you must list all the devices supported by the hardware. The
+name attribute of the <device> element identifies the device. These names are
+recognized:
+    "global"        dummy global device - see explanation below
+    "speaker"       AUDIO_DEVICE_OUT_SPEAKER
+    "earpiece"      AUDIO_DEVICE_OUT_EARPIECE
+    "headset"       AUDIO_DEVICE_OUT_WIRED_HEADSET
+    "headset_in"    AUDIO_DEVICE_IN_WIRED_HEADSET
+    "headphone"     AUDIO_DEVICE_OUT_WIRED_HEADPHONE
+    "sco"           AUDIO_DEVICE_OUT_ALL_SCO
+    "sco_in"        AUDIO_DEVICE_IN_ALL_SCO
+    "a2dp"          AUDIO_DEVICE_OUT_ALL_A2DP
+    "usb"           AUDIO_DEVICE_OUT_ALL_USB
+    "mic"           AUDIO_DEVICE_IN_BUILTIN_MIC
+    "back mic"      AUDIO_DEVICE_IN_BACK_MIC
+    "voice"         AUDIO_DEVICE_IN_VOICE_CALL
+    "aux"           AUDIO_DEVICE_IN_AUX_DIGITAL
+Within the <device> element you can declare a number of "paths", each path
+defines a group of control settings to be applied. Each path is identified by
+a name. The "on" and "off" paths are special and list a global enable and
+disable setting for the device. Use of devices is reference-counted, when
+routing of a stream is changed to use a device that is currently disabled its
+"on" path will be applied. When no streams are using a device its "off"
+path will be applied.
+Other paths are user-defined and you can give them any name you choose.
+They are used to apply custom paths when required by a stream and will
+be used only when a stream is connected to or disconnected from a
+device if the <stream> element has an <enable> or <disable> element requesting
+that path.
+It is not mandatory to provide paths. You only need to define paths
+if there are specific control settings that must be applied. So for example
+if no controls need be applied to enable or disable a device then you
+do not need to define the "on" and "off" paths.
+The <ctl> elements within each path have the same format and behaviour
+as described under <mixer><init>.
+The "global" device is a special device the represents the audio system as a
+whole and is used to invoke mixer settings that are independent of any real
+device and which apply globally to the audio system. A stream is automatically
+connected to "global" when it is opened and disconnected when it is closed.
+The behaviour is identical to the way paths are invoked in any other <device>
+entry so the effect is
+    - the "on" path will be applied when a stream is opened and there are
+        no other streams already open. As an example this could be used to
+        bring the audio hardware out of a standby state
+    - the "off" path will be applied when the last open stream is closed.
+        As an example this could be used to put the audio hardware into a
+        standby state
+    - the custom paths will be applied when the stream that requests them
+        is opened or closed.
+-->
+
+        <device name="speaker">
+            <path name="on">
+                <!-- List of ctl element for control values to apply
+                when this device is enabled -->
+                <!-- <ctl name="Amp DSP Switch" val="1"/> -->
+            </path>
+
+            <path name="off">
+                <!-- List of ctl element for control values to apply
+                when this device is disabled -->
+                <!-- <ctl name="Amp DSP Switch" val="0"/> -->
+            </path>
+
+            <!-- Following paths are user-defined and are applied when a
+            <stream> elements' routing is changed to add or remove this
+            device. If the path name matches the name given in the <stream>
+            element it will be applied. A stream could be routed to multiple
+            inputs or outputs - the paths for connecting and disconnecting
+            a stream to a device must therefore have the same name in each
+            <device>.
+            It is not mandatory to declare custom paths - depending on your
+            hardware there may not be any specific action required to route
+            a stream to a particular device. Also you do not have to define
+            the path in every device, only the devices where some action must
+            be taken to connect or disconnect a stream.
+            For this example four custom paths are defined:
+                pcm_out_en = control setting to connect PCM output to this device
+                pcm_out_dis = control setting to disconnect PCM output from this device
+            -->
+
+            <path name="pcm_out_en">
+                <ctl name="I2S RX0 MUX" val="AIF1_PB" />
+                <ctl name="MI2S_RX Channels" val="One" />
+                <ctl name="CDC_IF RX0 MUX" val="I2S RX0" />
+                <ctl name="RX INT8_1 MIX1 INP0" val="RX0" />
+                <ctl name="COMP8 Switch" val="1" />
+                <ctl name="SpkrRight COMP Switch" val="1" />
+                <ctl name="SpkrRight BOOST Switch" val="1" />
+                <ctl name="SpkrRight VISENSE Switch" val="1" />
+                <ctl name="SpkrRight SWR DAC_Port Switch" val="1" />
+            </path>
+            <path name="pcm_out_dis">
+            </path>
+        </device>
+
+        <device name="headset">
+            <!-- <path name="on">
+                <ctl name="SLIM RX2 MUX" val="AIF1_PB"/>
+                <ctl name="SLIM RX3 MUX" val="AIF1_PB"/>
+                <ctl name="RX INT1 DEM MUX" val="CLSH_DSM_OUT"/>
+                <ctl name="RX INT2 DEM MUX" val="CLSH_DSM_OUT"/>
+                <ctl name="RX INT1_1 MIX1 INP0" val="RX2"/>
+                <ctl name="RX INT2_1 MIX1 INP0" val="RX3"/>
+                <ctl name="RX INT1_1 INTERP" val="RX INT1_1 MI"/>
+                <ctl name="RX INT2_1 INTERP" val="RX INT2_1 MI"/>
+                <ctl name="RX0 Digital Volume" val="0"/>
+                <ctl name="RX1 Digital Volume" val="80"/>
+                <ctl name="RX2 Digital Volume" val="80"/>
+            </path>
+
+            <path name="off">
+                <ctl name="SLIM RX2 MUX" val="ZERO"/>
+                <ctl name="SLIM RX3 MUX" val="ZERO"/>
+                <ctl name="RX INT1 DEM MUX" val="ZERO"/>
+                <ctl name="RX INT2 DEM MUX" val="ZERO"/>
+                <ctl name="RX INT1_1 MIX1 INP0" val="ZERO"/>
+                <ctl name="RX INT2_1 MIX1 INP0" val="ZERO"/>
+                <ctl name="RX INT1_1 INTERP" val="ZERO"/>
+                <ctl name="RX INT2_1 INTERP" val="ZERO"/>
+                <ctl name="RX1 Digital Volume" val="0"/>
+                <ctl name="RX2 Digital Volume" val="0"/>
+            </path> -->
+
+
+            <path name="pcm_out_en">
+                <!-- <ctl name="SLIM RX2 MUX" val="AIF4_PB" />
+                <ctl name="SLIM RX3 MUX" val="AIF4_PB" />
+                <ctl name="RX INT1_2 MUX" val="RX2" />
+                <ctl name="RX INT2_2 MUX" val="RX3" /> -->
+            </path>
+
+            <path name="pcm_out_dis">
+                <ctl name="SLIM RX2 MUX" val="ZERO" />
+                <ctl name="SLIM RX3 MUX" val="ZERO" />
+                <ctl name="RX INT1_2 MUX" val="ZERO" />
+                <ctl name="RX INT2_2 MUX" val="ZERO" />
+            </path>
+        </device>
+
+<!-- Following the device definitions there must be a <stream> entry
+for every output and input stream supported by the hardware. It is also
+possible to define a 'global' stream that is not associated with any particular
+audio input or output but instead can be used to handle actions that are
+global to the audio hardware.
+There are two types of stream that can be declared here:
+- anonymous streams, these will be used to supply playback and record
+    streams for AudioFlinger
+- named streams, which are mainly used to declare custom streams to handle
+    special routing use-cases that are external to the normal Android audio
+    path - typically where the audio is routed entirely in hardware without
+    being passed through Android, for example the baseband audio link or
+    FM radio.
+    The global stream is a special case of a named stream and must have the
+    name "global"
+For standard anonymous streams there are two that would normally be on
+any device: PCM input and PCM output. It is also possible to declare a stream
+as "compress" - this is intended for cases where a playback stream is
+decompressed in hardware, or a record stream provides raw compressed data that
+must be decompressed in software.
+Named streams can be declared as type "hw", to represent a hardware-hardware
+link.
+The "global" named stream can be used to handle events that are not specific
+to any particular stream. Typically this is used to implement usecase handlers
+(see below) to handle set_parameter messages sent to the HAL's global
+(struct audio_device*)->hw_device.set_parameters function (for example, the
+"orientation" parameter that is sent by Android.)
+Mandatory attributes for PCM and compressed streams:
+    type    must be "pcm" or "compress"
+    dir     direction of stream, either "in" (recording) or "out" (playback)
+Mandatory for named streams:
+    type    must be "pcm", "compress" or "hw"
+    dir     direction of stream, either "in" (recording) or "out" (playback)
+    name    a custom name for a named stream. The name you choose here must
+                match the name your HAL will use to request this stream
+Mandatory for hw streams:
+    type    must be "hw"
+    dir     direction of stream, either "in" (recording) or "out" (playback)
+    name    a custom name for the stream (hw streams must be named streams)
+Mandatory for the global stream:
+    type    must be "hw"
+    name    must be "global"
+Optional attributes:
+    card    ALSA card number. If not given this defaults to 0
+    device  ALSA device number. If not given this defaults to 0
+    instances   limits the maximum number of instances of this stream, if not
+                specified the number of instances is unlimited
+    name    a custom name for a named stream. The name you choose here must
+                match the name your HAL will use to request this stream
+Anonymous PCM streams should not normally have an instance limit.
+TinyHAL defines a specific named stream:
+"voice recognition" - a PCM or compressed stream for voice recognition input.
+                      If a stream with this name is not defined TinyHAL will
+                      use the normal PCM input stream for voice recognition audio.
+-->
+
+    <stream type="pcm" dir="out" card="0" device="0">
+        <!-- The <enable> and <disable> tags give the name of a path
+        to apply for each connected device when the stream is either connected
+        to (enable) or disconnected from (disable) that device.
+        The way this works is that when stream routing changes, the HAL will
+        look through the paths of each device this stream is connected to,
+            - for each device the stream is being disconnected from, if it
+                contains a path matching the path name in <disable>, that path
+                will be applied.
+            - for each device the stream is being connected to, if it
+                contains a path matching the path name in <enable>, that path
+                will be applied.
+        -->
+        <enable path="pcm_out_en"/>
+        <disable path="pcm_out_dis"/>
+
+        <!-- The optional usecase block allows you to define custom use-cases that
+        are triggered by set_parameter() calls to the HAL. The set_parameter()
+        is a string of the form <setting>=<value>. The HAL will search for a
+        usecase block whose name attribute matches <setting> and within that
+        a case block whose name attribute matches <value>. If a matching case
+        block is found the enclosed <ctl> blocks will be applied.
+        The example below defines a use case for switching a codec algorithm
+        between wideband and narrowband response. The two cases will be
+        triggered by a set_parameter() of "bandwidth=narrow" or "bandwidth=wide".
+        -->
+        <!-- <usecase name="bandwidth">
+            <case name="narrow">
+                <ctl name="Codec Wideband" val="0" />
+            </case>
+            <case name="wide">
+                <ctl name="Codec Wideband" val="1" />
+            </case>
+        </usecase> -->
+
+        <!-- Constant values. These allow setting named values that can
+        be read by the audio HAL at runtime. Values are 32-bit unsigned.
+        This is useful for setting HAL-specific or hardware-specific
+        information.
+        The names have no meaning to the config manager, and are
+        entirely defined by the audio HAL.
+        If you want to set constants that are global, rather than part
+        of a stream, define a hw stream called "global".
+        to hold the values.
+        -->
+        <!-- <set name="foo" val="42"/> -->
+
+    </stream>
+
+    <!-- <stream type="pcm" dir="out" card="0" device="1">
+        <enable path="pcm_out_en"/>
+        <disable path="pcm_out_dis"/>
+    </stream> -->
+
+    <!-- Example named stream, in this case for an FM radio path . This will not
+    be available for standard AudioFlinger playback and record paths. It must
+    be explicitly requested by the audio HAL when FM radio is enabled
+    -->
+    <!-- control paths to be enabled when this stream is enabled or disabled -->
+    <!-- <stream name="FM radio" type="pcm" dir="in" card="0" device="0">
+        
+        <enable path="fm_radio_en"/>
+        <disable path="fm_radio_dis"/>
+    </stream> -->
+
+</audiohal>
diff --git a/shared/etc/audio_policy_configuration.xml b/shared/etc/audio_policy_configuration.xml
new file mode 100644
index 0000000..a068541
--- /dev/null
+++ b/shared/etc/audio_policy_configuration.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- 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.
+-->
+
+<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
+    <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
+
+    <!-- Global configuration Decalaration -->
+    <globalConfiguration speaker_drc_enabled="true"/>
+
+
+    <!-- Modules section:
+        There is one section per audio HW module present on the platform.
+        Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
+        The module names are the same as in current .conf file:
+                “primary”, “A2DP”, “remote_submix”, “USB”
+        Each module will contain the following sections:
+        “devicePorts”: a list of device descriptors for all input and output devices accessible via this
+        module.
+        This contains both permanently attached devices and removable devices.
+        “mixPorts”: listing all output and input streams exposed by the audio HAL
+        “routes”: list of possible connections between input and output devices or between stream and
+        devices.
+            "route": is defined by an attribute:
+                -"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
+                -"sink": the sink involved in this route
+                -"sources": all the sources than can be connected to the sink via vis route
+        “attachedDevices”: permanently attached devices.
+        The attachedDevices section is a list of devices names. The names correspond to device names
+        defined in <devicePorts> section.
+        “defaultOutputDevice”: device to be used by default when no policy rule applies
+    -->
+    <modules>
+        <!-- Primary Audio HAL -->
+        <module name="primary" halVersion="3.0">
+            <attachedDevices>
+                <item>Speaker</item>
+                <item>Built-In Mic</item>
+                <item>Echo Reference</item>
+            </attachedDevices>
+            <defaultOutputDevice>Speaker</defaultOutputDevice>
+            <mixPorts>
+                <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </mixPort>
+                <mixPort name="primary input" role="sink">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+                </mixPort>
+                <mixPort name="echo reference" role="sink">
+                    <profile name="echo_reference" format="AUDIO_FORMAT_PCM_32_BIT"
+                             samplingRates="48000"
+                             channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
+                </mixPort>
+            </mixPorts>
+            <devicePorts>
+                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->
+                <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address="">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </devicePort>
+                <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink" >
+                </devicePort>
+                <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
+                </devicePort>
+                <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
+                </devicePort>
+                <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
+                </devicePort>
+
+                <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
+                </devicePort>
+                <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
+                </devicePort>
+                <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
+                </devicePort>
+                <devicePort tagName="Echo Reference" type="AUDIO_DEVICE_IN_ECHO_REFERENCE" role="source">
+                    <profile name="echo_reference" format="AUDIO_FORMAT_PCM_32_BIT"
+                             samplingRates="48000"
+                             channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
+                </devicePort>
+            </devicePorts>
+            <!-- route declaration, i.e. list all available sources for a given sink -->
+            <routes>
+                <route type="mix" sink="Speaker"
+                       sources="primary output"/>
+                <route type="mix" sink="Wired Headset"
+                       sources="primary output"/>
+                <route type="mix" sink="Wired Headphones"
+                       sources="primary output"/>
+                <route type="mix" sink="BT SCO"
+                       sources="primary output"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output"/>
+                <route type="mix" sink="primary input"
+                       sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic"/>
+                <route type="mix" sink="echo reference"
+                       sources="Echo Reference"/>
+            </routes>
+
+        </module>
+
+        <!-- Usb Audio HAL -->
+        <xi:include href="usb_audio_policy_configuration.xml"/>
+
+        <!-- Remote Submix Audio HAL -->
+        <xi:include href="r_submix_audio_policy_configuration.xml"/>
+
+        <!-- Bluetooth Audio HAL -->
+        <xi:include href="bluetooth_audio_policy_configuration.xml"/>
+
+    </modules>
+    <!-- End of Modules section -->
+
+    <!-- Volume section -->
+
+    <xi:include href="audio_policy_volumes.xml"/>
+    <xi:include href="default_volume_tables.xml"/>
+
+    <!-- End of Volume section -->
+
+</audioPolicyConfiguration>
diff --git a/shared/etc/audio_policy_configuration_bluetooth_legacy_hal.xml b/shared/etc/audio_policy_configuration_bluetooth_legacy_hal.xml
new file mode 100644
index 0000000..2d2eca8
--- /dev/null
+++ b/shared/etc/audio_policy_configuration_bluetooth_legacy_hal.xml
@@ -0,0 +1,108 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- Copyright (C) 2015 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.
+-->
+
+<audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+    <globalConfiguration speaker_drc_enabled="false"/>
+
+    <modules>
+        <!-- Primary Audio HAL -->
+        <module name="primary" halVersion="2.0">
+            <attachedDevices>
+                <item>Speaker</item>
+                <item>Built-In Mic</item>
+            </attachedDevices>
+            <defaultOutputDevice>Speaker</defaultOutputDevice>
+            <mixPorts>
+                <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_PRIMARY">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
+                </mixPort>
+                <mixPort name="primary input" role="sink">
+                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
+                             samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
+                             channelMasks="AUDIO_CHANNEL_IN_MONO"/>
+                </mixPort>
+            </mixPorts>
+            <devicePorts>
+                <!-- Output devices declaration, i.e. Sink DEVICE PORT -->
+                <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER">
+                </devicePort>
+                <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
+                </devicePort>
+                <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
+                </devicePort>
+                <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
+                </devicePort>
+                <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
+                </devicePort>
+                <devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
+                </devicePort>
+                <devicePort tagName="Aux Digital" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
+                </devicePort>
+
+                <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
+                </devicePort>
+                <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
+                </devicePort>
+                <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
+                </devicePort>
+            </devicePorts>
+            <!-- route declaration, i.e. list all available sources for a given sink -->
+            <routes>
+                <route type="mix" sink="Speaker"
+                       sources="primary output"/>
+                <route type="mix" sink="Wired Headset"
+                       sources="primary output"/>
+                <route type="mix" sink="Wired Headphones"
+                       sources="primary output"/>
+                <route type="mix" sink="Aux Digital"
+                       sources="primary output"/>
+                <route type="mix" sink="BT SCO"
+                       sources="primary output"/>
+                <route type="mix" sink="BT SCO Headset"
+                       sources="primary output"/>
+                <route type="mix" sink="BT SCO Car Kit"
+                       sources="primary output"/>
+                <route type="mix" sink="primary input"
+                       sources="Built-In Mic,Wired Headset Mic,BT SCO Headset Mic"/>
+            </routes>
+
+        </module>
+
+        <!-- A2dp Audio HAL -->
+        <xi:include href="a2dp_audio_policy_configuration.xml"/>
+
+        <!-- A2dp Input Audio HAL -->
+        <xi:include href="a2dp_in_audio_policy_configuration.xml"/>
+
+        <!-- Usb Audio HAL -->
+        <xi:include href="usb_audio_policy_configuration.xml"/>
+
+        <!-- Remote Submix Audio HAL -->
+        <xi:include href="r_submix_audio_policy_configuration.xml"/>
+
+    </modules>
+    <!-- End of Modules section -->
+
+    <!-- Volume section -->
+
+    <xi:include href="audio_policy_volumes.xml"/>
+    <xi:include href="default_volume_tables.xml"/>
+
+    <!-- End of Volume section -->
+
+</audioPolicyConfiguration>
diff --git a/shared/etc/media_codecs.xml b/shared/etc/media_codecs.xml
new file mode 100644
index 0000000..2b00568
--- /dev/null
+++ b/shared/etc/media_codecs.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- Copyright (C) 2012 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.
+-->
+
+<!--
+<!DOCTYPE MediaCodecs [
+<!ELEMENT MediaCodecs (Decoders,Encoders)>
+<!ELEMENT Decoders (MediaCodec*)>
+<!ELEMENT Encoders (MediaCodec*)>
+<!ELEMENT MediaCodec (Type*,Quirk*)>
+<!ATTLIST MediaCodec name CDATA #REQUIRED>
+<!ATTLIST MediaCodec type CDATA>
+<!ELEMENT Type EMPTY>
+<!ATTLIST Type name CDATA #REQUIRED>
+<!ELEMENT Quirk EMPTY>
+<!ATTLIST Quirk name CDATA #REQUIRED>
+]>
+
+There's a simple and a complex syntax to declare the availability of a
+media codec:
+
+A codec that properly follows the OpenMax spec and therefore doesn't have any
+quirks and that only supports a single content type can be declared like so:
+
+    <MediaCodec name="OMX.foo.bar" type="something/interesting" />
+
+If a codec has quirks OR supports multiple content types, the following syntax
+can be used:
+
+    <MediaCodec name="OMX.foo.bar" >
+        <Type name="something/interesting" />
+        <Type name="something/else" />
+        ...
+        <Quirk name="requires-allocate-on-input-ports" />
+        <Quirk name="requires-allocate-on-output-ports" />
+        <Quirk name="output-buffers-are-unreadable" />
+    </MediaCodec>
+
+Only the three quirks included above are recognized at this point:
+
+"requires-allocate-on-input-ports"
+    must be advertised if the component does not properly support specification
+    of input buffers using the OMX_UseBuffer(...) API but instead requires
+    OMX_AllocateBuffer to be used.
+
+"requires-allocate-on-output-ports"
+    must be advertised if the component does not properly support specification
+    of output buffers using the OMX_UseBuffer(...) API but instead requires
+    OMX_AllocateBuffer to be used.
+
+"output-buffers-are-unreadable"
+    must be advertised if the emitted output buffers of a decoder component
+    are not readable, i.e. use a custom format even though abusing one of
+    the official OMX colorspace constants.
+    Clients of such decoders will not be able to access the decoded data,
+    naturally making the component much less useful. The only use for
+    a component with this quirk is to render the output to the screen.
+    Audio decoders MUST NOT advertise this quirk.
+    Video decoders that advertise this quirk must be accompanied by a
+    corresponding color space converter for thumbnail extraction,
+    matching surfaceflinger support that can render the custom format to
+    a texture and possibly other code, so just DON'T USE THIS QUIRK.
+
+-->
+
+<MediaCodecs>
+    <Include href="media_codecs_google_audio.xml" />
+    <Include href="media_codecs_google_video.xml" />
+</MediaCodecs>
diff --git a/shared/etc/mixer_paths.xml b/shared/etc/mixer_paths.xml
new file mode 100644
index 0000000..ea54606
--- /dev/null
+++ b/shared/etc/mixer_paths.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<mixer>
+	<!-- Enable Internal speaker -->
+	<ctl name="QUAT_MI2S_RX Audio Mixer MultiMedia1" value="1" />
+	<ctl name="SLIMBUS_0_RX Audio Mixer MultiMedia2' 1" />
+	<ctl name="MultiMedia3 Mixer SLIMBUS_0_TX" value="1" />
+	<ctl name="AIF1_CAP Mixer SLIM TX7" value="1" />
+	<ctl name="SLIM RX0 MUX" value="AIF1_PB" />
+	<ctl name="SLIM RX1 MUX" value="AIF1_PB" />
+	<ctl name="SLIM RX2 MUX" value="ZERO" />
+	<ctl name="SLIM RX3 MUX" value="ZERO" />
+	<ctl name="SLIM RX4 MUX" value="ZERO" />
+	<ctl name="SLIM RX5 MUX" value="ZERO" />
+	<ctl name="SLIM RX6 MUX" value="ZERO" />
+	<ctl name="SLIM RX7 MUX" value="ZERO" />
+	<ctl name="RX INT7_1 MIX1 INP0" value="RX0" />
+	<ctl name="RX INT8_1 MIX1 INP0" value="RX1" />
+	<ctl name="RX INT1_2 MUX" value="RX0" />
+	<ctl name="RX INT2_2 MUX" value="RX1" />
+	<ctl name="CDC_IF TX7 MUX" value="DEC7" />
+
+	<ctl name="COMP1 Switch" value="1" />
+    <ctl name="COMP2 Switch" value="1" />
+    <ctl name="COMP7 Switch" value="0" />
+    <ctl name="COMP8 Switch" value="0" />
+
+	<!-- Default speaker -->
+	<ctl name="Amp DSP Switch" value="0" />
+
+	<!-- Default headphones -->
+	<ctl name="RX INT1_1 MIX1 INP0" value="ZERO" />
+	<ctl name="RX INT2_1 MIX1 INP0" value="ZERO" />
+	<ctl name="RX INT1_1 INTERP" value="ZERO" />
+	<ctl name="RX INT2_1 INTERP" value="ZERO" />
+	<ctl name="RX INT1 DEM MUX" value="NORMAL_DSM_OUT" />
+	<ctl name="RX INT2 DEM MUX" value="NORMAL_DSM_OUT" />
+	<ctl name="COMP1 Switch" value="0" />
+	<ctl name="COMP2 Switch" value="0" />
+	<ctl name="RX1 Digital Volume" value="0" />
+	<ctl name="RX2 Digital Volume" value="0" />
+
+	<path name="speaker">
+		<ctl name="Amp DSP Switch" value="1" />
+	</path>
+
+	<path name="headset">
+		<!-- <ctl name="SLIM RX2 MUX" value="AIF4_PB" />
+        <ctl name="SLIM RX3 MUX" value="AIF4_PB" />
+        <ctl name="SLIM_6_RX Channels" value="Two" />
+        <ctl name="RX INT1_2 MUX" value="RX2" />
+        <ctl name="RX INT2_2 MUX" value="RX3" /> -->
+
+		<ctl name="RX INT1_1 MIX1 INP0" value="RX0" />
+		<ctl name="RX INT2_1 MIX1 INP0" value="RX1" />
+		<ctl name="RX INT1_1 INTERP" value="RX INT1_1 MIX1" />
+		<ctl name="RX INT2_1 INTERP" value="RX INT2_1 MIX1" />
+		<ctl name="RX INT1 DEM MUX" value="CLSH_DSM_OUT" />
+		<ctl name="RX INT2 DEM MUX" value="CLSH_DSM_OUT" />
+		<ctl name="COMP1 Switch" value="1" />
+		<ctl name="COMP2 Switch" value="1" />
+		<ctl name="RX1 Digital Volume" value="84" />
+		<ctl name="RX2 Digital Volume" value="84" />
+	</path>
+</mixer>
+
+
+<!-- tinymix "QUAT_MI2S_RX Audio Mixer MultiMedia1" 1
+tinymix2 set "SLIMBUS_0_RX Audio Mixer MultiMedia2" 1
+tinymix2 set "MultiMedia3 Mixer SLIMBUS_0_TX" 1
+tinymix2 set "AIF1_CAP Mixer SLIM TX7" 1
+tinymix2 set "CDC_IF TX7 MUX" "DEC7"
+tinymix2 set "SLIM RX0 MUX" "AIF1_PB"
+tinymix2 set "SLIM RX1 MUX" "AIF1_PB"
+tinymix2 set "SLIM RX2 MUX" "AIF1_PB"
+tinymix2 set "SLIM RX3 MUX" "AIF1_PB"
+tinymix2 set "SLIM RX4 MUX" "ZERO"
+tinymix2 set "SLIM RX5 MUX" "ZERO"
+tinymix2 set "SLIM RX6 MUX" "ZERO"
+tinymix2 set "SLIM RX7 MUX" "ZERO"
+tinymix2 set "RX INT7_1 MIX1 INP0" "RX0"
+tinymix2 set "RX INT8_1 MIX1 INP0" "RX1"
+tinymix2 set "RX INT1_2 MUX" "RX0"
+tinymix2 set "RX INT2_2 MUX" "RX1"
+
+tinymix "Amp DSP Switch" 1 
+
+
+
+# headphones
+tinymix2 set "RX INT1_1 MIX1 INP0" "RX0"
+tinymix2 set "RX INT2_1 MIX1 INP0" "RX1"
+tinymix2 set "RX INT1_1 INTERP" "RX INT1_1 MIX1"
+tinymix2 set "RX INT2_1 INTERP" "RX INT2_1 MIX1"
+tinymix2 set "RX INT1 DEM MUX" "CLSH_DSM_OUT"
+tinymix2 set "RX INT2 DEM MUX" "CLSH_DSM_OUT"
+tinymix2 set "COMP1 Switch" 1
+tinymix2 set "COMP2 Switch" 1
+tinymix2 set "RX1 Digital Volume" 84
+tinymix2 set "RX2 Digital Volume" 84
+
+tinymix2 set "SLIM RX2 MUX" "AIF4_PB"
+tinymix2 set "SLIM RX3 MUX" "AIF4_PB"
+tinymix2 set "RX INT1_2 MUX" "RX2"
+tinymix2 set "RX INT2_2 MUX" "RX3"
+tinyplay2 -D 0 -d 1 /data/file_example_WAV_1MG.wav
+
+-->
\ No newline at end of file
diff --git a/shared/etc/permissions/android.software.xml b/shared/etc/permissions/android.software.xml
new file mode 100644
index 0000000..742a086
--- /dev/null
+++ b/shared/etc/permissions/android.software.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<!-- These are the hardware components that all handheld devices
+     must include. Devices with optional hardware must also include extra
+     hardware files, per the comments below.
+
+     Handheld devices include phones, mobile Internet devices (MIDs),
+     Personal Media Players (PMPs), small tablets (7" or less), and similar
+     devices.
+-->
+<permissions>
+    <!-- following features are said to be "basic system services"
+         in frameworks/native/data/etc/tablet_core_hardware.xml,
+    -->
+    <feature name="android.software.activities_on_secondary_displays" />
+    <feature name="android.software.autofill" />
+    <feature name="android.software.companion_device_setup" />
+    <feature name="android.software.home_screen" />
+    <feature name="android.software.input_methods" />
+    <feature name="android.software.picture_in_picture" />
+    <feature name="android.software.print" />
+
+    <!-- need by following cts test
+        android.app.cts.ActivityManagerProcessStateTest#testCantSaveStateLaunchAndBackground
+        android.app.cts.ActivityManagerProcessStateTest#testCantSaveStateLaunchAndSwitch
+    -->
+    <feature name="android.software.cant_save_state" />
+
+</permissions>
diff --git a/shared/etc/public.libraries.txt b/shared/etc/public.libraries.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/shared/etc/public.libraries.txt
diff --git a/shared/etc/wifi/p2p_supplicant_overlay.conf b/shared/etc/wifi/p2p_supplicant_overlay.conf
new file mode 100644
index 0000000..acbace2
--- /dev/null
+++ b/shared/etc/wifi/p2p_supplicant_overlay.conf
@@ -0,0 +1 @@
+disable_scan_offload=1
diff --git a/shared/etc/wifi/wpa_supplicant_overlay.conf b/shared/etc/wifi/wpa_supplicant_overlay.conf
new file mode 100644
index 0000000..e1f530d
--- /dev/null
+++ b/shared/etc/wifi/wpa_supplicant_overlay.conf
@@ -0,0 +1,3 @@
+disable_scan_offload=1
+p2p_disabled=1
+tdls_external_control=1
diff --git a/shared/hals/Android.mk b/shared/hals/Android.mk
new file mode 100644
index 0000000..1648f44
--- /dev/null
+++ b/shared/hals/Android.mk
@@ -0,0 +1,28 @@
+#
+# Copyright (C) 2015 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.
+#
+
+# WARNING: Everything listed here will be built on ALL platforms,
+# including x86, the emulator, and the SDK.  Modules must be uniquely
+# named (liblights.panda), and must build everywhere, or limit themselves
+# to only building on ARM if they include assembly. Individual makefiles
+# are responsible for having their own logic, for fine-grained control.
+
+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/shared/hals/gralloc/Android.mk b/shared/hals/gralloc/Android.mk
new file mode 100644
index 0000000..ec1c38e
--- /dev/null
+++ b/shared/hals/gralloc/Android.mk
@@ -0,0 +1,57 @@
+# Copyright (C) 2016 Linaro, Ltd., Rob Herring <robh@kernel.org>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := \
+	gralloc_gbm.cpp \
+	gralloc.cpp
+
+LOCAL_SHARED_LIBRARIES := \
+	libdrm \
+	libgbm_mesa \
+	liblog \
+	libcutils
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+	$(LOCAL_PATH)
+
+LOCAL_C_INCLUDES += system/core/include hardware/libhardware/include
+LOCAL_C_INCLUDES += system/core/libsystem/include system/core
+
+LOCAL_MODULE := gralloc.gbm
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
+
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+	$(LOCAL_PATH)
+
+LOCAL_MODULE := libgralloc_drm
+LOCAL_MODULE_TAGS := optional
+LOCAL_PROPRIETARY_MODULE := true
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/shared/hals/gralloc/gralloc.cpp b/shared/hals/gralloc/gralloc.cpp
new file mode 100644
index 0000000..1cc9f55
--- /dev/null
+++ b/shared/hals/gralloc/gralloc.cpp
@@ -0,0 +1,273 @@
+/*
+ * Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
+ * Copyright (C) 2010-2011 LunarG Inc.
+ * Copyright (C) 2016 Linaro, Ltd., Rob Herring <robh@kernel.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#define LOG_TAG "GRALLOC-GBM"
+
+#include <log/log.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <pthread.h>
+#include <errno.h>
+
+#include <hardware/gralloc.h>
+#include <system/graphics.h>
+
+#include <gbm.h>
+
+#include "gralloc_drm.h"
+#include "gralloc_gbm_priv.h"
+
+struct gbm_module_t {
+	gralloc_module_t base;
+
+	pthread_mutex_t mutex;
+	struct gbm_device *gbm;
+};
+
+/*
+ * Initialize the DRM device object
+ */
+static int gbm_init(struct gbm_module_t *dmod)
+{
+	int err = 0;
+
+	pthread_mutex_lock(&dmod->mutex);
+	if (!dmod->gbm) {
+		dmod->gbm = gbm_dev_create();
+		if (!dmod->gbm)
+			err = -EINVAL;
+	}
+	pthread_mutex_unlock(&dmod->mutex);
+
+	return err;
+}
+
+static int gbm_mod_perform(const struct gralloc_module_t *mod, int op, ...)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) mod;
+	va_list args;
+	int err;
+	uint32_t uop = static_cast<uint32_t>(op);
+
+	err = gbm_init(dmod);
+	if (err)
+		return err;
+
+	va_start(args, op);
+	switch (uop) {
+	case GRALLOC_MODULE_PERFORM_GET_DRM_FD:
+		{
+			int *fd = va_arg(args, int *);
+			*fd = gbm_device_get_fd(dmod->gbm);
+			err = 0;
+		}
+		break;
+	default:
+		err = -EINVAL;
+		break;
+	}
+	va_end(args);
+
+	return err;
+}
+
+static int gbm_mod_register_buffer(const gralloc_module_t *mod,
+		buffer_handle_t handle)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) mod;
+	int err;
+
+	err = gbm_init(dmod);
+	if (err)
+		return err;
+
+	pthread_mutex_lock(&dmod->mutex);
+	err = gralloc_gbm_handle_register(handle, dmod->gbm);
+	pthread_mutex_unlock(&dmod->mutex);
+
+	return err;
+}
+
+static int gbm_mod_unregister_buffer(const gralloc_module_t *mod,
+		buffer_handle_t handle)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) mod;
+	int err;
+
+	pthread_mutex_lock(&dmod->mutex);
+	err = gralloc_gbm_handle_unregister(handle);
+	pthread_mutex_unlock(&dmod->mutex);
+
+	return err;
+}
+
+static int gbm_mod_lock(const gralloc_module_t *mod, buffer_handle_t handle,
+		int usage, int x, int y, int w, int h, void **ptr)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) mod;
+	int err;
+
+	pthread_mutex_lock(&dmod->mutex);
+
+	err = gralloc_gbm_bo_lock(handle, usage, x, y, w, h, ptr);
+	ALOGV("buffer %p lock usage = %08x", handle, usage);
+
+	pthread_mutex_unlock(&dmod->mutex);
+	return err;
+}
+
+static int gbm_mod_unlock(const gralloc_module_t *mod, buffer_handle_t handle)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) mod;
+	int err;
+
+	pthread_mutex_lock(&dmod->mutex);
+	err = gralloc_gbm_bo_unlock(handle);
+	pthread_mutex_unlock(&dmod->mutex);
+
+	return err;
+}
+
+static int gbm_mod_lock_ycbcr(gralloc_module_t const *mod, buffer_handle_t handle,
+		int usage, int x, int y, int w, int h, struct android_ycbcr *ycbcr)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) mod;
+	int err;
+
+	pthread_mutex_lock(&dmod->mutex);
+	err = gralloc_gbm_bo_lock_ycbcr(handle, usage, x, y, w, h, ycbcr);
+	pthread_mutex_unlock(&dmod->mutex);
+
+	return err;
+}
+
+static int gbm_mod_close_gpu0(struct hw_device_t *dev)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *)dev->module;
+	struct alloc_device_t *alloc = (struct alloc_device_t *) dev;
+
+	gbm_dev_destroy(dmod->gbm);
+	delete alloc;
+
+	return 0;
+}
+
+static int gbm_mod_free_gpu0(alloc_device_t *dev, buffer_handle_t handle)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) dev->common.module;
+
+	pthread_mutex_lock(&dmod->mutex);
+	gbm_free(handle);
+	native_handle_close(handle);
+	delete handle;
+
+	pthread_mutex_unlock(&dmod->mutex);
+	return 0;
+}
+
+static int gbm_mod_alloc_gpu0(alloc_device_t *dev,
+		int w, int h, int format, int usage,
+		buffer_handle_t *handle, int *stride)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) dev->common.module;
+	int err = 0;
+
+	pthread_mutex_lock(&dmod->mutex);
+
+	*handle = gralloc_gbm_bo_create(dmod->gbm, w, h, format, usage, stride);
+	if (!*handle)
+		err = -errno;
+
+	ALOGV("buffer %p usage = %08x", *handle, usage);
+	pthread_mutex_unlock(&dmod->mutex);
+	return err;
+}
+
+static int gbm_mod_open_gpu0(struct gbm_module_t *dmod, hw_device_t **dev)
+{
+	struct alloc_device_t *alloc;
+	int err;
+
+	err = gbm_init(dmod);
+	if (err)
+		return err;
+
+	alloc = new alloc_device_t();
+	if (!alloc)
+		return -EINVAL;
+
+	alloc->common.tag = HARDWARE_DEVICE_TAG;
+	alloc->common.version = 0;
+	alloc->common.module = &dmod->base.common;
+	alloc->common.close = gbm_mod_close_gpu0;
+
+	alloc->alloc = gbm_mod_alloc_gpu0;
+	alloc->free = gbm_mod_free_gpu0;
+
+	*dev = &alloc->common;
+
+	return 0;
+}
+
+static int gbm_mod_open(const struct hw_module_t *mod,
+		const char *name, struct hw_device_t **dev)
+{
+	struct gbm_module_t *dmod = (struct gbm_module_t *) mod;
+	int err;
+
+	if (strcmp(name, GRALLOC_HARDWARE_GPU0) == 0)
+		err = gbm_mod_open_gpu0(dmod, dev);
+	else
+		err = -EINVAL;
+
+	return err;
+}
+
+static struct hw_module_methods_t gbm_mod_methods = {
+	.open = gbm_mod_open
+};
+
+struct gbm_module_t HAL_MODULE_INFO_SYM = {
+	.base = {
+		.common = {
+			.tag = HARDWARE_MODULE_TAG,
+			.version_major = 1,
+			.version_minor = 0,
+			.id = GRALLOC_HARDWARE_MODULE_ID,
+			.name = "GBM Memory Allocator",
+			.author = "Rob Herring - Linaro",
+			.methods = &gbm_mod_methods
+		},
+		.registerBuffer = gbm_mod_register_buffer,
+		.unregisterBuffer = gbm_mod_unregister_buffer,
+		.lock = gbm_mod_lock,
+		.unlock = gbm_mod_unlock,
+		.lock_ycbcr = gbm_mod_lock_ycbcr,
+		.perform = gbm_mod_perform
+	},
+
+	.mutex = PTHREAD_MUTEX_INITIALIZER,
+	.gbm = NULL,
+};
diff --git a/shared/hals/gralloc/gralloc_drm.h b/shared/hals/gralloc/gralloc_drm.h
new file mode 100644
index 0000000..0ece652
--- /dev/null
+++ b/shared/hals/gralloc/gralloc_drm.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
+ * Copyright (C) 2010-2011 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _GRALLOC_DRM_H_
+#define _GRALLOC_DRM_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+	/* perform(const struct gralloc_module_t *mod,
+	 *	   int op,
+	 *	   int *fd);
+	 */
+	GRALLOC_MODULE_PERFORM_GET_DRM_FD                = 0x40000002,
+};
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _GRALLOC_DRM_H_ */
diff --git a/shared/hals/gralloc/gralloc_gbm.cpp b/shared/hals/gralloc/gralloc_gbm.cpp
new file mode 100644
index 0000000..29d11cd
--- /dev/null
+++ b/shared/hals/gralloc/gralloc_gbm.cpp
@@ -0,0 +1,531 @@
+/*
+ * Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
+ * Copyright (C) 2010-2011 LunarG Inc.
+ * Copyright (C) 2016 Linaro, Ltd., Rob Herring <robh@kernel.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#define LOG_TAG "GRALLOC-GBM"
+
+#include <log/log.h>
+#include <cutils/atomic.h>
+#include <cutils/properties.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <assert.h>
+
+#include <hardware/gralloc.h>
+#include <system/graphics.h>
+
+#include <gbm.h>
+
+#include "gralloc_gbm_priv.h"
+#include <android/gralloc_handle.h>
+
+#include <unordered_map>
+
+#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+
+#define unlikely(x) __builtin_expect(!!(x), 0)
+
+static std::unordered_map<buffer_handle_t, struct gbm_bo *> gbm_bo_handle_map;
+
+struct bo_data_t {
+	void *map_data;
+	int lock_count;
+	int locked_for;
+};
+
+void gralloc_gbm_destroy_user_data(struct gbm_bo *bo, void *data)
+{
+	struct bo_data_t *bo_data = (struct bo_data_t *)data;
+	delete bo_data;
+
+	(void)bo;
+}
+
+static struct bo_data_t *gbm_bo_data(struct gbm_bo *bo) {
+	return (struct bo_data_t *)gbm_bo_get_user_data(bo);
+}
+
+
+static uint32_t get_gbm_format(int format)
+{
+	uint32_t fmt;
+
+	switch (format) {
+	case HAL_PIXEL_FORMAT_RGBA_8888:
+		fmt = GBM_FORMAT_ABGR8888;
+		break;
+	case HAL_PIXEL_FORMAT_RGBX_8888:
+		fmt = GBM_FORMAT_XBGR8888;
+		break;
+	case HAL_PIXEL_FORMAT_RGB_888:
+		fmt = GBM_FORMAT_RGB888;
+		break;
+	case HAL_PIXEL_FORMAT_RGB_565:
+		fmt = GBM_FORMAT_RGB565;
+		break;
+	case HAL_PIXEL_FORMAT_BGRA_8888:
+		fmt = GBM_FORMAT_ARGB8888;
+		break;
+	case HAL_PIXEL_FORMAT_YV12:
+		/* YV12 is planar, but must be a single buffer so ask for GR88 */
+		fmt = GBM_FORMAT_GR88;
+		break;
+	case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+	case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+	default:
+		fmt = 0;
+		break;
+	}
+
+	return fmt;
+}
+
+static int gralloc_gbm_get_bpp(int format)
+{
+	int bpp;
+
+	switch (format) {
+	case HAL_PIXEL_FORMAT_RGBA_8888:
+	case HAL_PIXEL_FORMAT_RGBX_8888:
+	case HAL_PIXEL_FORMAT_BGRA_8888:
+		bpp = 4;
+		break;
+	case HAL_PIXEL_FORMAT_RGB_888:
+		bpp = 3;
+		break;
+	case HAL_PIXEL_FORMAT_RGB_565:
+	case HAL_PIXEL_FORMAT_YCbCr_422_I:
+		bpp = 2;
+		break;
+	/* planar; only Y is considered */
+	case HAL_PIXEL_FORMAT_YV12:
+	case HAL_PIXEL_FORMAT_YCbCr_422_SP:
+	case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+		bpp = 1;
+		break;
+	default:
+		bpp = 0;
+		break;
+	}
+
+	return bpp;
+}
+
+static unsigned int get_pipe_bind(int usage)
+{
+	unsigned int bind = 0;
+
+	if (usage & (GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN))
+		bind |= GBM_BO_USE_LINEAR;
+	if (usage & GRALLOC_USAGE_CURSOR)
+		;//bind |= GBM_BO_USE_CURSOR;
+	if (usage & (GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE))
+		bind |= GBM_BO_USE_RENDERING;
+	if (usage & GRALLOC_USAGE_HW_FB)
+		bind |= GBM_BO_USE_SCANOUT;
+	if (usage & GRALLOC_USAGE_HW_COMPOSER)
+		bind |= GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING;
+
+	return bind;
+}
+
+static struct gbm_bo *gbm_import(struct gbm_device *gbm,
+		buffer_handle_t _handle)
+{
+	struct gbm_bo *bo;
+	struct gralloc_handle_t *handle = gralloc_handle(_handle);
+	#ifdef GBM_BO_IMPORT_FD_MODIFIER
+	struct gbm_import_fd_modifier_data data;
+	#else
+	struct gbm_import_fd_data data;
+	#endif
+
+	int format = get_gbm_format(handle->format);
+	if (handle->prime_fd < 0)
+		return NULL;
+
+	memset(&data, 0, sizeof(data));
+	data.width = handle->width;
+	data.height = handle->height;
+	data.format = format;
+	/* Adjust the width and height for a GBM GR88 buffer */
+	if (handle->format == HAL_PIXEL_FORMAT_YV12) {
+		data.width /= 2;
+		data.height += handle->height / 2;
+	}
+
+	#ifdef GBM_BO_IMPORT_FD_MODIFIER
+	data.num_fds = 1;
+	data.fds[0] = handle->prime_fd;
+	data.strides[0] = handle->stride;
+	data.modifier = handle->modifier;
+	bo = gbm_bo_import(gbm, GBM_BO_IMPORT_FD_MODIFIER, &data, 0);
+	#else
+	data.fd = handle->prime_fd;
+	data.stride = handle->stride;
+	bo = gbm_bo_import(gbm, GBM_BO_IMPORT_FD, &data, 0);
+	#endif
+
+	return bo;
+}
+
+static struct gbm_bo *gbm_alloc(struct gbm_device *gbm,
+		buffer_handle_t _handle)
+{
+	struct gbm_bo *bo;
+	struct gralloc_handle_t *handle = gralloc_handle(_handle);
+	int format = get_gbm_format(handle->format);
+	int usage = get_pipe_bind(handle->usage);
+	int width, height;
+
+	width = handle->width;
+	height = handle->height;
+	if (usage & GBM_BO_USE_CURSOR) {
+		if (handle->width < 64)
+			width = 64;
+		if (handle->height < 64)
+			height = 64;
+	}
+
+	/*
+	 * For YV12, we request GR88, so halve the width since we're getting
+	 * 16bpp. Then increase the height by 1.5 for the U and V planes.
+	 */
+	if (handle->format == HAL_PIXEL_FORMAT_YV12) {
+		width /= 2;
+		height += handle->height / 2;
+	}
+
+	ALOGV("create BO, size=%dx%d, fmt=%d, usage=%x",
+	      handle->width, handle->height, handle->format, usage);
+	bo = gbm_bo_create(gbm, width, height, format, usage);
+	if (!bo) {
+		ALOGE("failed to create BO, size=%dx%d, fmt=%d, usage=%x",
+		      handle->width, handle->height, handle->format, usage);
+		return NULL;
+	}
+
+	handle->prime_fd = gbm_bo_get_fd(bo);
+	handle->stride = gbm_bo_get_stride(bo);
+	#ifdef GBM_BO_IMPORT_FD_MODIFIER
+	handle->modifier = gbm_bo_get_modifier(bo);
+	#endif
+
+	return bo;
+}
+
+void gbm_free(buffer_handle_t handle)
+{
+	struct gbm_bo *bo = gralloc_gbm_bo_from_handle(handle);
+
+	if (!bo)
+		return;
+
+	gbm_bo_handle_map.erase(handle);
+	gbm_bo_destroy(bo);
+}
+
+/*
+ * Return the bo of a registered handle.
+ */
+struct gbm_bo *gralloc_gbm_bo_from_handle(buffer_handle_t handle)
+{
+	return gbm_bo_handle_map[handle];
+}
+
+static int gbm_map(buffer_handle_t handle, int x, int y, int w, int h,
+		int enable_write, void **addr)
+{
+	int err = 0;
+	int flags = GBM_BO_TRANSFER_READ;
+	struct gralloc_gbm_handle_t *gbm_handle = gralloc_handle(handle);
+	struct gbm_bo *bo = gralloc_gbm_bo_from_handle(handle);
+	struct bo_data_t *bo_data = gbm_bo_data(bo);
+	uint32_t stride;
+
+	if (bo_data->map_data)
+		return -EINVAL;
+
+	if (gbm_handle->format == HAL_PIXEL_FORMAT_YV12) {
+		if (x || y)
+			ALOGE("can't map with offset for planar %p", bo);
+		w /= 2;
+		h += h / 2;
+	}
+
+	if (enable_write)
+		flags |= GBM_BO_TRANSFER_WRITE;
+
+	*addr = gbm_bo_map(bo, 0, 0, x + w, y + h, flags, &stride, &bo_data->map_data);
+	ALOGV("mapped bo %p (%d, %d)-(%d, %d) at %p", bo, x, y, w, h, *addr);
+	if (*addr == NULL)
+		return -ENOMEM;
+
+	assert(stride == gbm_bo_get_stride(bo));
+
+	return err;
+}
+
+static void gbm_unmap(struct gbm_bo *bo)
+{
+	struct bo_data_t *bo_data = gbm_bo_data(bo);
+
+	gbm_bo_unmap(bo, bo_data->map_data);
+	bo_data->map_data = NULL;
+}
+
+void gbm_dev_destroy(struct gbm_device *gbm)
+{
+	int fd = gbm_device_get_fd(gbm);
+
+	gbm_device_destroy(gbm);
+	close(fd);
+}
+
+struct gbm_device *gbm_dev_create(void)
+{
+	struct gbm_device *gbm;
+	char path[PROPERTY_VALUE_MAX];
+	int fd;
+
+	property_get("gralloc.gbm.device", path, "/dev/dri/renderD128");
+	fd = open(path, O_RDWR | O_CLOEXEC);
+	if (fd < 0) {
+		ALOGE("failed to open %s", path);
+		return NULL;
+	}
+
+	gbm = gbm_create_device(fd);
+	if (!gbm) {
+		ALOGE("failed to create gbm device");
+		close(fd);
+	}
+
+	return gbm;
+}
+
+/*
+ * Register a buffer handle.
+ */
+int gralloc_gbm_handle_register(buffer_handle_t _handle, struct gbm_device *gbm)
+{
+	struct gbm_bo *bo;
+
+	if (!_handle)
+		return -EINVAL;
+
+	if (gbm_bo_handle_map.count(_handle))
+		return -EINVAL;
+
+	bo = gbm_import(gbm, _handle);
+	if (!bo)
+		return -EINVAL;
+
+	gbm_bo_handle_map.emplace(_handle, bo);
+
+	return 0;
+}
+
+/*
+ * Unregister a buffer handle.  It is no-op for handles created locally.
+ */
+int gralloc_gbm_handle_unregister(buffer_handle_t handle)
+{
+	gbm_free(handle);
+
+	return 0;
+}
+
+/*
+ * Create a bo.
+ */
+buffer_handle_t gralloc_gbm_bo_create(struct gbm_device *gbm,
+		int width, int height, int format, int usage, int *stride)
+{
+	struct gbm_bo *bo;
+	native_handle_t *handle;
+
+	handle = gralloc_handle_create(width, height, format, usage);
+	if (!handle)
+		return NULL;
+
+	bo = gbm_alloc(gbm, handle);
+	if (!bo) {
+		native_handle_delete(handle);
+		return NULL;
+	}
+
+	gbm_bo_handle_map.emplace(handle, bo);
+
+	/* in pixels */
+	*stride = gralloc_handle(handle)->stride / gralloc_gbm_get_bpp(format);
+
+	return handle;
+}
+
+/*
+ * Lock a bo.  XXX thread-safety?
+ */
+int gralloc_gbm_bo_lock(buffer_handle_t handle,
+		int usage, int x, int y, int w, int h,
+		void **addr)
+{
+	struct gralloc_handle_t *gbm_handle = gralloc_handle(handle);
+	struct gbm_bo *bo = gralloc_gbm_bo_from_handle(handle);
+	struct bo_data_t *bo_data;
+
+	if (!bo)
+		return -EINVAL;
+
+	if ((gbm_handle->usage & usage) != (uint32_t)usage) {
+		/* make FB special for testing software renderer with */
+
+		if (!(gbm_handle->usage & GRALLOC_USAGE_SW_READ_OFTEN) &&
+				!(gbm_handle->usage & GRALLOC_USAGE_HW_FB) &&
+				!(gbm_handle->usage & GRALLOC_USAGE_HW_TEXTURE)) {
+			ALOGE("bo.usage:x%X/usage:x%X is not GRALLOC_USAGE_HW_FB or GRALLOC_USAGE_HW_TEXTURE",
+				gbm_handle->usage, usage);
+			return -EINVAL;
+		}
+	}
+
+	bo_data = gbm_bo_data(bo);
+	if (!bo_data) {
+		bo_data = new struct bo_data_t();
+		gbm_bo_set_user_data(bo, bo_data, gralloc_gbm_destroy_user_data);
+	}
+
+	ALOGV("lock bo %p, cnt=%d, usage=%x", bo, bo_data->lock_count, usage);
+
+	/* allow multiple locks with compatible usages */
+	if (bo_data->lock_count && (bo_data->locked_for & usage) != usage)
+		return -EINVAL;
+
+	usage |= bo_data->locked_for;
+
+	/*
+	 * Some users will lock with an null crop rect.
+	 * Interpret this as no-crop (full buffer WxH).
+	 */
+	if (w == 0 && h == 0) {
+		w = gbm_handle->width;
+		h = gbm_handle->height;
+	}
+
+	if (usage & (GRALLOC_USAGE_SW_WRITE_MASK |
+		     GRALLOC_USAGE_SW_READ_MASK)) {
+		/* the driver is supposed to wait for the bo */
+		int write = !!(usage & GRALLOC_USAGE_SW_WRITE_MASK);
+		int err = gbm_map(handle, x, y, w, h, write, addr);
+		if (err)
+			return err;
+	}
+	else {
+		/* kernel handles the synchronization here */
+	}
+
+	bo_data->lock_count++;
+	bo_data->locked_for |= usage;
+
+	return 0;
+}
+
+/*
+ * Unlock a bo.
+ */
+int gralloc_gbm_bo_unlock(buffer_handle_t handle)
+{
+	struct gbm_bo *bo = gralloc_gbm_bo_from_handle(handle);
+	struct bo_data_t *bo_data;
+	if (!bo)
+		return -EINVAL;
+
+	bo_data = gbm_bo_data(bo);
+
+	int mapped = bo_data->locked_for &
+		(GRALLOC_USAGE_SW_WRITE_MASK | GRALLOC_USAGE_SW_READ_MASK);
+
+	if (!bo_data->lock_count)
+		return 0;
+
+	if (mapped)
+		gbm_unmap(bo);
+
+	bo_data->lock_count--;
+	if (!bo_data->lock_count)
+		bo_data->locked_for = 0;
+
+	return 0;
+}
+
+#define GRALLOC_ALIGN(value, base) (((value) + ((base)-1)) & ~((base)-1))
+
+int gralloc_gbm_bo_lock_ycbcr(buffer_handle_t handle,
+		int usage, int x, int y, int w, int h,
+		struct android_ycbcr *ycbcr)
+{
+	struct gralloc_handle_t *hnd = gralloc_handle(handle);
+	int ystride, cstride;
+	void *addr = 0;
+	int err;
+
+	ALOGV("handle %p, hnd %p, usage 0x%x", handle, hnd, usage);
+
+	err = gralloc_gbm_bo_lock(handle, usage, x, y, w, h, &addr);
+	if (err)
+		return err;
+
+	memset(ycbcr->reserved, 0, sizeof(ycbcr->reserved));
+
+	switch (hnd->format) {
+	case HAL_PIXEL_FORMAT_YCrCb_420_SP:
+		ystride = cstride = GRALLOC_ALIGN(hnd->width, 16);
+		ycbcr->y = addr;
+		ycbcr->cr = (unsigned char *)addr + ystride * hnd->height;
+		ycbcr->cb = (unsigned char *)addr + ystride * hnd->height + 1;
+		ycbcr->ystride = ystride;
+		ycbcr->cstride = cstride;
+		ycbcr->chroma_step = 2;
+		break;
+	case HAL_PIXEL_FORMAT_YV12:
+		ystride = hnd->width;
+		cstride = GRALLOC_ALIGN(ystride / 2, 16);
+		ycbcr->y = addr;
+		ycbcr->cr = (unsigned char *)addr + ystride * hnd->height;
+		ycbcr->cb = (unsigned char *)addr + ystride * hnd->height + cstride * hnd->height / 2;
+		ycbcr->ystride = ystride;
+		ycbcr->cstride = cstride;
+		ycbcr->chroma_step = 1;
+		break;
+	default:
+		ALOGE("Can not lock buffer, invalid format: 0x%x", hnd->format);
+		return -EINVAL;
+	}
+
+	return 0;
+}
diff --git a/shared/hals/gralloc/gralloc_gbm_priv.h b/shared/hals/gralloc/gralloc_gbm_priv.h
new file mode 100644
index 0000000..cbe9256
--- /dev/null
+++ b/shared/hals/gralloc/gralloc_gbm_priv.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2010-2011 Chia-I Wu <olvaffe@gmail.com>
+ * Copyright (C) 2010-2011 LunarG Inc.
+ * Copyright (C) 2016 Linaro, Ltd., Rob Herring <robh@kernel.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _GRALLOC_GBM_PRIV_H_
+#define _GRALLOC_GBM_PRIV_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct gbm_device;
+struct gbm_bo;
+
+int gralloc_gbm_handle_register(buffer_handle_t handle, struct gbm_device *gbm);
+int gralloc_gbm_handle_unregister(buffer_handle_t handle);
+
+buffer_handle_t gralloc_gbm_bo_create(struct gbm_device *gbm,
+		int width, int height, int format, int usage, int *stride);
+void gbm_free(buffer_handle_t handle);
+
+struct gbm_bo *gralloc_gbm_bo_from_handle(buffer_handle_t handle);
+buffer_handle_t gralloc_gbm_bo_get_handle(struct gbm_bo *bo);
+int gralloc_gbm_get_gem_handle(buffer_handle_t handle);
+
+int gralloc_gbm_bo_lock(buffer_handle_t handle, int usage, int x, int y, int w, int h, void **addr);
+int gralloc_gbm_bo_unlock(buffer_handle_t handle);
+int gralloc_gbm_bo_lock_ycbcr(buffer_handle_t handle, int usage,
+		int x, int y, int w, int h, struct android_ycbcr *ycbcr);
+
+struct gbm_device *gbm_dev_create(void);
+void gbm_dev_destroy(struct gbm_device *gbm);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _GRALLOC_GBM_PRIV_H_ */
diff --git a/shared/hals/health/Android.bp b/shared/hals/health/Android.bp
new file mode 100644
index 0000000..60f1f84
--- /dev/null
+++ b/shared/hals/health/Android.bp
@@ -0,0 +1,40 @@
+cc_library_shared {
+    name: "android.hardware.health@2.1-impl-gsdm845",
+    stem: "android.hardware.health@2.0-impl-2.1-gsdm845",
+
+    // Install to vendor and recovery.
+    proprietary: true,
+    //recovery_available: true,
+
+    relative_install_path: "hw",
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+
+    shared_libs: [
+        "libbase",
+        "libcutils",
+        "libhidlbase",
+        "liblog",
+        "libutils",
+        "android.hardware.health@2.1",
+        "android.hardware.health@2.0",
+    ],
+
+    static_libs: [
+        "android.hardware.health@1.0-convert",
+        "libbatterymonitor",
+        "libhealthloop",
+        "libhealth2impl",
+        // "libhealthd.<device>"
+    ],
+
+    srcs: [
+        "HealthImpl.cpp",
+    ],
+
+    // No vintf_fragments because both -impl and -service should have been
+    // installed.
+}
diff --git a/shared/hals/health/HealthImpl.cpp b/shared/hals/health/HealthImpl.cpp
new file mode 100644
index 0000000..45bd2f8
--- /dev/null
+++ b/shared/hals/health/HealthImpl.cpp
@@ -0,0 +1,50 @@
+#include <memory>
+
+#include <health/utils.h>
+#include <health2impl/Health.h>
+#include <hidl/Status.h>
+#include <log/log.h>
+#include <android-base/strings.h>
+#include <string>
+
+using ::android::sp;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::health::InitHealthdConfig;
+using ::android::hardware::health::V2_1::IHealth;
+using ::android::hidl::base::V1_0::IBase;
+
+using namespace std::literals;
+
+namespace android {
+namespace hardware {
+namespace health {
+namespace V2_1 {
+namespace implementation {
+
+// android::hardware::health::V2_1::implementation::Health implements most
+// defaults. Uncomment functions that you need to override.
+class HealthImpl : public Health {
+  public:
+    HealthImpl(std::unique_ptr<healthd_config>&& config)
+        : Health(std::move(config)) {}
+};
+
+}  // namespace implementation
+}  // namespace V2_1
+}  // namespace health
+}  // namespace hardware
+}  // namespace android
+
+extern "C" IHealth* HIDL_FETCH_IHealth(const char* instance) {
+    using ::android::hardware::health::V2_1::implementation::HealthImpl;
+    if (instance != "default"sv) {
+        ALOGE("Instance is not supported");
+        return nullptr;
+    }
+    auto config = std::make_unique<healthd_config>();
+    InitHealthdConfig(config.get());
+    config->batteryStatusPath = "/sys/class/power_supply/pmi8998_charger/status";
+
+    return new HealthImpl(std::move(config));
+}
diff --git a/shared/hals/liblight/Android.mk b/shared/hals/liblight/Android.mk
new file mode 100644
index 0000000..732de3f
--- /dev/null
+++ b/shared/hals/liblight/Android.mk
@@ -0,0 +1,37 @@
+# Copyright (C) 2008 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.
+
+LOCAL_PATH:= $(call my-dir)
+# HAL module implemenation stored in
+# hw/<COPYPIX_HARDWARE_MODULE_ID>.<ro.board.platform>.so
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := lights.c
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_HEADER_LIBRARIES := libhardware_headers
+LOCAL_SHARED_LIBRARIES := liblog libcutils
+LOCAL_CFLAGS := -DLOG_TAG=\"qdlights\"
+ifeq ($(LLVM_SA), true)
+    LOCAL_CFLAGS += --compile-and-analyze --analyzer-perf --analyzer-Werror
+endif
+LOCAL_CFLAGS += -Wno-error
+LOCAL_CLANG  := true
+LOCAL_MODULE := lights.$(TARGET_DEVICE)
+LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 legacy_not_a_contribution
+LOCAL_LICENSE_CONDITIONS := by_exception_only not_allowed notice
+LOCAL_NOTICE_FILE := $(LOCAL_PATH)/NOTICE
+LOCAL_MODULE_TAGS := optional
+LOCAL_VENDOR_MODULE := true
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/shared/hals/liblight/NOTICE b/shared/hals/liblight/NOTICE
new file mode 100644
index 0000000..7340b9e
--- /dev/null
+++ b/shared/hals/liblight/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2008, 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.
+
+   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.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/shared/hals/liblight/lights.c b/shared/hals/liblight/lights.c
new file mode 100644
index 0000000..08432d5
--- /dev/null
+++ b/shared/hals/liblight/lights.c
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2014, 2017-2018 The  Linux Foundation. All rights reserved.
+ * Not a contribution
+ * Copyright (C) 2008 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 <log/log.h>
+#include <cutils/properties.h>
+
+#include <dirent.h>
+#include <fcntl.h>
+#include <linux/limits.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <pthread.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+
+#include <hardware/lights.h>
+
+#define BACKLIGHT_CLASS "/sys/class/backlight"
+#define BACKLIGHT_CLASS_FSTRING "/sys/class/backlight/%s/brightness"
+
+/**
+ * device methods
+ */
+
+static bool findFirstBacklightDevice(char *filename) {
+    struct dirent *de;
+    DIR *dir = opendir(BACKLIGHT_CLASS);
+    if (dir == NULL)
+        return NULL;
+    while((de = readdir(dir))) {
+        if(de->d_name[0] == '.' &&
+           (de->d_name[1] == '\0' ||
+            (de->d_name[1] == '.' && de->d_name[2] == '\0')))
+            continue;
+        strcpy(filename, de->d_name);
+        closedir(dir);
+        return true;
+    }
+    closedir(dir);
+    return false;
+}
+
+static int
+write_brightness(int value)
+{
+    int fd;
+    char brightness_path[PATH_MAX];
+    char filename[NAME_MAX];
+    if (!findFirstBacklightDevice(filename)) {
+        ALOGE("Couldn't find backlight brightness path");
+        return -EINVAL;
+    }
+
+    ALOGI("Opening backlight device: %s", filename);
+    snprintf(brightness_path, PATH_MAX, BACKLIGHT_CLASS_FSTRING, filename);
+    fd = open(brightness_path, O_WRONLY);
+    if (fd >= 0) {
+        char buffer[20];
+        ssize_t amt;
+        size_t bytes = snprintf(buffer, sizeof(buffer), "%d\n", value);
+        if(bytes < sizeof(buffer)) {
+            amt = write(fd, buffer, bytes);
+        } else {
+            amt = -1;
+            errno = -EINVAL;
+        }
+        close(fd);
+        return amt == -1 ? -errno : 0;
+    } else {
+        ALOGE("write_brightness failed to open %s, fd = %d, errno = %d\n", brightness_path, fd, errno);
+        return -errno;
+    }
+}
+
+static int
+rgb_to_brightness(struct light_state_t const* state)
+{
+    int color = state->color & 0x00ffffff;
+    return ((77*((color>>16)&0x00ff))
+            + (150*((color>>8)&0x00ff)) + (29*(color&0x00ff))) >> 8;
+}
+
+static int
+set_light_backlight(struct light_device_t* dev,
+        struct light_state_t const* state)
+{
+    if(!dev) {
+        return -1;
+    }
+
+    int brightness = rgb_to_brightness(state) << 2; // Scale up to 1020
+    ALOGI("CA:: Writing brightness: %d\n", brightness);
+    brightness = brightness ?: 1 << 2; // Don't allow 0 brightness
+    write_brightness(brightness);
+
+    return 0;
+}
+
+/** Close the lights device */
+static int
+close_lights(struct light_device_t *dev)
+{
+    if (dev) {
+        free(dev);
+    }
+    return 0;
+}
+
+/**
+ * module methods
+ */
+
+/** Open a new instance of a lights device using name */
+static int open_lights(const struct hw_module_t* module, char const* name,
+        struct hw_device_t** device)
+{
+    (void)name;
+
+    struct light_device_t *dev = malloc(sizeof(struct light_device_t));
+
+    if(!dev)
+        return -ENOMEM;
+
+    memset(dev, 0, sizeof(*dev));
+
+    dev->common.tag = HARDWARE_DEVICE_TAG;
+    dev->common.version = LIGHTS_DEVICE_API_VERSION_2_0;
+    dev->common.module = (struct hw_module_t*)module;
+    dev->common.close = (int (*)(struct hw_device_t*))close_lights;
+    dev->set_light = set_light_backlight;
+
+    *device = (struct hw_device_t*)dev;
+    return 0;
+}
+
+static struct hw_module_methods_t lights_module_methods = {
+    .open =  open_lights,
+};
+
+/*
+ * The lights Module
+ */
+struct hw_module_t HAL_MODULE_INFO_SYM = {
+    .tag = HARDWARE_MODULE_TAG,
+    .version_major = 1,
+    .version_minor = 0,
+    .id = LIGHTS_HARDWARE_MODULE_ID,
+    .name = "lights Module",
+    .author = "Google, Inc.",
+    .methods = &lights_module_methods,
+};
diff --git a/shared/hals/libmemtrack/Android.mk b/shared/hals/libmemtrack/Android.mk
new file mode 100644
index 0000000..dfca959
--- /dev/null
+++ b/shared/hals/libmemtrack/Android.mk
@@ -0,0 +1,29 @@
+# Copyright (C) 2017 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.
+
+LOCAL_PATH := $(call my-dir)
+
+# HAL module implemenation stored in
+# hw/<POWERS_HARDWARE_MODULE_ID>.<ro.hardware>.so
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_PROPRIETARY_MODULE := true
+LOCAL_C_INCLUDES += hardware/libhardware/include
+LOCAL_CFLAGS := -Wconversion -Wall -Werror -Wno-sign-conversion
+LOCAL_CLANG  := true
+LOCAL_SHARED_LIBRARIES := liblog libhardware
+LOCAL_SRC_FILES := memtrack_generic.c
+LOCAL_MODULE := memtrack.default
+include $(BUILD_SHARED_LIBRARY)
diff --git a/shared/hals/libmemtrack/memtrack_generic.c b/shared/hals/libmemtrack/memtrack_generic.c
new file mode 100644
index 0000000..b998f89
--- /dev/null
+++ b/shared/hals/libmemtrack/memtrack_generic.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2017 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>
+
+#include <hardware/memtrack.h>
+
+int generic_memtrack_init(const struct memtrack_module *module)
+{
+    if (!module)
+        return -1;
+
+    return 0;
+}
+
+static struct hw_module_methods_t memtrack_module_methods = {
+    .open = NULL,
+};
+
+struct memtrack_module HAL_MODULE_INFO_SYM = {
+    .common = {
+        .tag = HARDWARE_MODULE_TAG,
+        .module_api_version = MEMTRACK_MODULE_API_VERSION_0_1,
+        .hal_api_version = HARDWARE_HAL_API_VERSION,
+        .id = MEMTRACK_HARDWARE_MODULE_ID,
+        .name = "Dummy Memory Tracker HAL",
+        .author = "The Android Open Source Project",
+        .methods = &memtrack_module_methods,
+    },
+
+    .init = generic_memtrack_init,
+};
diff --git a/shared/init.sdm845.rc b/shared/init.sdm845.rc
new file mode 100644
index 0000000..b49fe94
--- /dev/null
+++ b/shared/init.sdm845.rc
@@ -0,0 +1,65 @@
+import init.${ro.hardware}.usb.rc
+import init.${ro.hardware}.power.rc
+
+on fs
+    mount_all /vendor/etc/fstab.${ro.hardware}
+    swapon_all /vendor/etc/fstab.${ro.hardware}
+
+on post-fs
+    # set RLIMIT_MEMLOCK to 64MB
+    setrlimit 8 67108864 67108864
+
+    # make sure remoteprocs have booted, some will attempt
+    # to start before firmware is available and not automatically
+    # retry.
+    write /sys/class/remoteproc/remoteproc0/state start
+    write /sys/class/remoteproc/remoteproc1/state start
+    write /sys/class/remoteproc/remoteproc2/state start
+
+on init
+    # Initialize cpusets to boot-time values
+    write /dev/cpuset/foreground/cpus 0-7
+    write /dev/cpuset/background/cpus 0-7
+    write /dev/cpuset/system-background/cpus 0-7
+    write /dev/cpuset/top-app/cpus 0-7
+
+on early-boot
+    mount debugfs debugfs /sys/kernel/debug
+    chmod 755 /sys/kernel/debug
+    chmod 755 /sys/kernel/debug/sync
+    chown graphics graphics /sys/kernel/debug/sync/sw_sync
+    chmod 777 /sys/kernel/debug/sync/sw_sync
+    chown graphics graphics /sys/kernel/debug/sync/info
+
+on zygote-start
+    mkdir /data/vendor/wifi 0770 wifi wifi
+    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
+    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
+
+on property:sys.boot_completed=1
+    chmod 0755 /sys/kernel/debug/tracing
+
+    # update cpuset now that processors are up
+    # Foreground should contain most cores (7 is reserved for top-app)
+    write /dev/cpuset/foreground/cpus 0-6
+
+    # top-app gets all cpus (including reserved #7)
+    write /dev/cpuset/top-app/cpus 0-7
+
+    #background contains a small subset (generally one little core)
+    write /dev/cpuset/background/cpus 0
+
+    # add system-background cpuset, a new cpuset for system services
+    # that should not run on larger cores
+    # system-background is for system tasks that should only run on
+    # little cores, not on bigs to be used only by init
+    write /dev/cpuset/system-background/cpus 0-3
+
+service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
+                       -Dnl80211 -g@android:wpa_wlan0
+    interface android.hardware.wifi.supplicant@1.0::ISupplicant default
+    interface android.hardware.wifi.supplicant@1.1::ISupplicant default
+    socket wpa_wlan0 dgram 660 wifi wifi
+    class main
+    disabled
+    oneshot
diff --git a/shared/init.sdm845.usb.rc b/shared/init.sdm845.usb.rc
new file mode 100644
index 0000000..50a4340
--- /dev/null
+++ b/shared/init.sdm845.usb.rc
@@ -0,0 +1,88 @@
+on boot
+    mount configfs none /config
+    mkdir /config/usb_gadget/g1 0770 shell shell
+    mkdir /config/usb_gadget/g1/strings/0x409 0770 shell shell
+    write /config/usb_gadget/g1/bcdUSB 0x0200
+    write /config/usb_gadget/g1/idVendor 0x18d1
+    write /config/usb_gadget/g1/bcdDevice 0x0223
+    write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
+    write /config/usb_gadget/g1/strings/0x409/manufacturer "QUALCOMM"
+    write /config/usb_gadget/g1/strings/0x409/product "Android Gadget"
+    mkdir /config/usb_gadget/g1/functions/accessory.gs2
+    mkdir /config/usb_gadget/g1/functions/audio_source.gs3
+    mkdir /config/usb_gadget/g1/functions/midi.gs5
+    mkdir /config/usb_gadget/g1/functions/ffs.adb
+    mkdir /config/usb_gadget/g1/functions/ffs.mtp
+    mkdir /config/usb_gadget/g1/functions/ffs.ptp
+    mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
+    mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
+    write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1
+    write /config/usb_gadget/g1/os_desc/qw_sign "MSFT100"
+    write /config/usb_gadget/g1/configs/b.1/MaxPower 500
+    mkdir /dev/usb-ffs 0775 shell shell
+    mkdir /dev/usb-ffs/adb 0770 shell shell
+    mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
+    mkdir /dev/usb-ffs/mtp 0770 mtp mtp
+    mkdir /dev/usb-ffs/ptp 0770 mtp mtp
+    mount functionfs mtp /dev/usb-ffs/mtp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
+    mount functionfs ptp /dev/usb-ffs/ptp rmode=0770,fmode=0660,uid=1024,gid=1024,no_disconnect=1
+    setprop sys.usb.mtp.device_type 3
+    setprop sys.usb.configfs 1
+    setprop sys.usb.ffs.aio_compat 1
+    symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1
+
+on property:sys.usb.config=none && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/os_desc/use 0
+
+on property:sys.usb.config=mtp && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee1
+    write /config/usb_gadget/g1/os_desc/use 1
+    symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
+
+on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee2
+    write /config/usb_gadget/g1/os_desc/use 1
+    symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/f1
+
+on property:sys.usb.config=rndis && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee3
+
+on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee4
+
+on property:sys.usb.config=ptp && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee5
+    write /config/usb_gadget/g1/os_desc/use 1
+    symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
+
+on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee6
+    write /config/usb_gadget/g1/os_desc/use 1
+    symlink /config/usb_gadget/g1/functions/ffs.ptp /config/usb_gadget/g1/configs/b.1/f1
+
+on property:sys.usb.config=adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee7
+
+on property:sys.usb.config=midi && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee8
+
+on property:sys.usb.config=midi,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x4ee9
+
+on property:sys.usb.config=accessory && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x2d00
+
+on property:sys.usb.config=accessory,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x2d01
+
+on property:sys.usb.config=audio_source && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x2d02
+
+on property:sys.usb.config=audio_source,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x2d03
+
+on property:sys.usb.config=accessory,audio_source && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x2d04
+
+on property:sys.usb.config=accessory,audio_source,adb && property:sys.usb.configfs=1
+    write /config/usb_gadget/g1/idProduct 0x2d05
diff --git a/shared/key_layout.kl b/shared/key_layout.kl
new file mode 100644
index 0000000..a1302da
--- /dev/null
+++ b/shared/key_layout.kl
@@ -0,0 +1,113 @@
+# 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.
+
+#
+# Generic key layout file for full alphabetic US English PC style external keyboards.
+#
+# This file is intentionally very generic and is intended to support a broad rang of keyboards.
+# Do not edit the generic key layout to support a specific keyboard; instead, create
+# a new key layout file with the required keyboard configuration.
+#
+
+key 399   GRAVE
+key 1     BACK
+key 2     1
+key 3     2
+key 4     3
+key 5     4
+key 6     5
+key 7     6
+key 8     7
+key 9     8
+key 10    9
+key 11    0
+key 158   BACK              WAKE_DROPPED
+key 230   SOFT_RIGHT        WAKE
+key 60    SOFT_RIGHT        WAKE
+key 107   ENDCALL           WAKE_DROPPED
+key 62    ENDCALL           WAKE_DROPPED
+key 229   MENU              WAKE_DROPPED
+key 139   MENU              WAKE_DROPPED
+key 59    MENU              WAKE_DROPPED
+key 127   SEARCH            WAKE_DROPPED
+key 217   SEARCH            WAKE_DROPPED
+key 228   POUND
+key 227   STAR
+key 231   CALL              WAKE_DROPPED
+key 61    CALL              WAKE_DROPPED
+key 232   DPAD_CENTER       WAKE_DROPPED
+key 108   DPAD_DOWN         WAKE_DROPPED
+key 103   DPAD_UP           WAKE_DROPPED
+key 102   HOME              WAKE
+key 105   DPAD_LEFT         WAKE_DROPPED
+key 106   DPAD_RIGHT        WAKE_DROPPED
+key 115   VOLUME_UP
+key 114   VOLUME_DOWN
+key 116   POWER             WAKE
+key 212   CAMERA
+
+key 16    Q
+key 17    W
+key 18    E
+key 19    R
+key 20    T
+key 21    Y
+key 22    U
+key 23    I
+key 24    O
+key 25    P
+key 26    LEFT_BRACKET
+key 27    RIGHT_BRACKET
+key 43    BACKSLASH
+
+key 30    A
+key 31    S
+key 32    D
+key 33    F
+key 34    G
+key 35    H
+key 36    J
+key 37    K
+key 38    L
+key 39    SEMICOLON
+key 40    APOSTROPHE
+key 14    DEL
+
+key 44    Z
+key 45    X
+key 46    C
+key 47    V
+key 48    B
+key 49    N
+key 50    M
+key 51    COMMA
+key 52    PERIOD
+key 53    SLASH
+key 28    ENTER
+
+key 56    ALT_LEFT
+key 100   ALT_RIGHT
+key 42    SHIFT_LEFT
+key 54    SHIFT_RIGHT
+key 15    TAB
+key 57    SPACE
+key 150   EXPLORER
+key 155   ENVELOPE
+
+key 12    MINUS
+key 13    EQUALS
+key 215   AT
+
+
+key 82    MENU              WAKE
diff --git a/shared/manifest.xml b/shared/manifest.xml
new file mode 100644
index 0000000..1ff7efb
--- /dev/null
+++ b/shared/manifest.xml
@@ -0,0 +1,127 @@
+<manifest version="1.0" type="device" target-level="4">
+    <hal format="hidl">
+        <name>android.hardware.audio</name>
+        <transport>hwbinder</transport>
+        <version>7.0</version>
+        <interface>
+            <name>IDevicesFactory</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.audio.effect</name>
+        <transport>hwbinder</transport>
+        <version>7.0</version>
+        <interface>
+            <name>IEffectsFactory</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.bluetooth</name>
+        <transport>hwbinder</transport>
+        <version>1.1</version>
+        <interface>
+            <name>IBluetoothHci</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.bluetooth.audio</name>
+        <transport>hwbinder</transport>
+        <version>2.0</version>
+        <interface>
+            <name>IBluetoothAudioProvidersFactory</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.configstore</name>
+        <transport>hwbinder</transport>
+        <version>1.1</version>
+        <interface>
+            <name>ISurfaceFlingerConfigs</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.drm</name>
+        <transport>hwbinder</transport>
+        <version>1.0</version>
+        <interface>
+            <name>ICryptoFactory</name>
+            <instance>default</instance>
+        </interface>
+        <interface>
+            <name>IDrmFactory</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.graphics.composer</name>
+        <transport>hwbinder</transport>
+        <version>2.3</version>
+        <interface>
+            <name>IComposer</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.keymaster</name>
+        <transport>hwbinder</transport>
+        <version>3.0</version>
+        <interface>
+            <name>IKeymasterDevice</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.light</name>
+        <transport>hwbinder</transport>
+        <version>2.0</version>
+        <interface>
+            <name>ILight</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <hal format="hidl">
+        <name>android.hardware.media.omx</name>
+        <transport>hwbinder</transport>
+        <version>1.0</version>
+        <interface>
+            <name>IOmx</name>
+            <instance>default</instance>
+        </interface>
+        <interface>
+            <name>IOmxStore</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+    <!-- <hal format="hidl">
+        <name>android.hardware.memtrack</name>
+        <transport>hwbinder</transport>
+        <version>1.0</version>
+        <interface>
+            <name>IMemtrack</name>
+            <instance>default</instance>
+        </interface>
+    </hal> -->
+    <hal format="hidl">
+        <name>android.hardware.soundtrigger</name>
+        <transport>hwbinder</transport>
+        <version>2.2</version>
+        <interface>
+            <name>ISoundTriggerHw</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+     <hal format="hidl">
+        <name>android.hardware.vibrator</name>
+        <transport>hwbinder</transport>
+        <version>1.1</version>
+        <interface>
+            <name>IVibrator</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+</manifest>
diff --git a/shared/overlay/frameworks/base/core/res/res/values/config.xml b/shared/overlay/frameworks/base/core/res/res/values/config.xml
new file mode 100644
index 0000000..1b701b6
--- /dev/null
+++ b/shared/overlay/frameworks/base/core/res/res/values/config.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+** Copyright 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.
+*/
+-->
+
+<!-- These resources are around just to allow their values to be customized
+     for different hardware and product builds. -->
+<resources>
+
+    <!-- This device is not "voice capable"; it's data-only. -->
+    <bool name="config_voice_capable">false</bool>
+
+    <!-- This device does not allow sms service. -->
+    <bool name="config_sms_capable">false</bool>
+
+    <!-- Separate software navigation bar required on this device. -->
+    <bool name="config_showNavigationBar">true</bool>
+
+    <!-- SDM845 uses an input device for the audio jack detection -->
+    <bool name="config_useDevInputEventForAudioJack">true</bool>
+
+    <!-- Integer indicating the framework scan interval in milliseconds. -->
+    <integer translatable="false" name="config_wifi_framework_scan_interval">10000</integer>
+
+    <!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION.
+         Please don't copy them, copy anything else. -->
+
+    <!-- the 5th element "resore-time" indicates the number of milliseconds to delay
+        before automatically restore the default connection.  Set -1 if the connection
+         does not require auto-restore. -->
+    <!-- the 6th element indicates boot-time dependency-met value. -->
+    <string-array translatable="false" name="networkAttributes">
+        <item>"wifi,1,1,1,-1,true"</item>
+    </string-array>
+
+    <!-- This string array should be overridden by the device to present a list of radio
+         attributes.  This is used by the connectivity manager to decide which networks can coexist
+         based on the hardware -->
+    <!-- An Array of "[ConnectivityManager connectionType],
+                      [# simultaneous connection types]"  -->
+    <string-array translatable="false" name="radioAttributes">
+        <item>"1,1"</item>
+        <item>"9,1"</item>
+    </string-array>
+
+    <!-- List of regexpressions describing the interface (if any) that represent tetherable
+         Wifi interfaces.  If the device doesn't want to support tethering over Wifi this
+         should be empty.  An example would be "softap.*" -->
+    <string-array translatable="false" name="config_tether_wifi_regexs">
+        <item>"wlan0"</item>
+        <item>"softap.*"</item>
+    </string-array>
+
+    <!-- List of regexpressions describing the interface (if any) that represent tetherable
+         USB interfaces.  If the device doesn't want to support tethering over USB this should
+         be empty.  An example would be "usb.*" -->
+    <string-array translatable="false" name="config_tether_usb_regexs">
+        <item>"usb\\d"</item>
+        <item>"rndis\\d"</item>
+    </string-array>
+
+   <!-- List of regexpressions describing the interface (if any) that represent tetherable
+         bluetooth interfaces.  If the device doesn't want to support tethering over bluetooth this
+         should be empty. -->
+    <string-array translatable="false" name="config_tether_bluetooth_regexs">
+        <item>"bt-pan"</item>
+    </string-array>
+
+    <!-- Array of allowable ConnectivityManager network types for tethering -->
+    <!-- Common options are [1, 4] for TYPE_WIFI and TYPE_MOBILE_DUN or
+         [0,1,5,7] for TYPE_MOBILE, TYPE_WIFI, TYPE_MOBILE_HIPRI and TYPE_BLUETOOTH -->
+    <integer-array translatable="false" name="config_tether_upstream_types">
+        <item>1</item>
+        <item>7</item>
+    </integer-array>
+
+</resources>
diff --git a/shared/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/shared/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
new file mode 100644
index 0000000..5add470
--- /dev/null
+++ b/shared/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <integer name="def_screen_off_timeout">180000</integer>
+    <bool name="def_lockscreen_disabled">false</bool>
+    <bool name="def_stay_on_while_plugged_in">true</bool>
+    <integer name="def_screen_brightness">200</integer>
+</resources>
diff --git a/shared/prebuilt-kernel/android-mainline/8021q.ko b/shared/prebuilt-kernel/android-mainline/8021q.ko
new file mode 100644
index 0000000..087443b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/8021q.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/Image.gz b/shared/prebuilt-kernel/android-mainline/Image.gz
new file mode 100644
index 0000000..5f23d34
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/Image.gz
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/adv7511.ko b/shared/prebuilt-kernel/android-mainline/adv7511.ko
new file mode 100644
index 0000000..9855048
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/adv7511.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/aes-neon-blk.ko b/shared/prebuilt-kernel/android-mainline/aes-neon-blk.ko
new file mode 100644
index 0000000..788ee13
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/aes-neon-blk.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/aes-neon-bs.ko b/shared/prebuilt-kernel/android-mainline/aes-neon-bs.ko
new file mode 100644
index 0000000..7990133
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/aes-neon-bs.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/af_alg.ko b/shared/prebuilt-kernel/android-mainline/af_alg.ko
new file mode 100644
index 0000000..788cf64
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/af_alg.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/algif_hash.ko b/shared/prebuilt-kernel/android-mainline/algif_hash.ko
new file mode 100644
index 0000000..a1c32b0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/algif_hash.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/algif_rng.ko b/shared/prebuilt-kernel/android-mainline/algif_rng.ko
new file mode 100644
index 0000000..a097eb5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/algif_rng.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/algif_skcipher.ko b/shared/prebuilt-kernel/android-mainline/algif_skcipher.ko
new file mode 100644
index 0000000..9a5748e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/algif_skcipher.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/amlogic-gxl-crypto.ko b/shared/prebuilt-kernel/android-mainline/amlogic-gxl-crypto.ko
new file mode 100644
index 0000000..2813402
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/amlogic-gxl-crypto.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/arm_smccc_trng.ko b/shared/prebuilt-kernel/android-mainline/arm_smccc_trng.ko
new file mode 100644
index 0000000..f7659e3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/arm_smccc_trng.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/arm_smmuv3_pmu.ko b/shared/prebuilt-kernel/android-mainline/arm_smmuv3_pmu.ko
new file mode 100644
index 0000000..d847ec2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/arm_smmuv3_pmu.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/asix.ko b/shared/prebuilt-kernel/android-mainline/asix.ko
new file mode 100644
index 0000000..6a81ed9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/asix.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ath.ko b/shared/prebuilt-kernel/android-mainline/ath.ko
new file mode 100644
index 0000000..6405c2e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ath.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ath10k_core.ko b/shared/prebuilt-kernel/android-mainline/ath10k_core.ko
new file mode 100644
index 0000000..b68e002
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ath10k_core.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ath10k_snoc.ko b/shared/prebuilt-kernel/android-mainline/ath10k_snoc.ko
new file mode 100644
index 0000000..1ce5cdd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ath10k_snoc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ax88179_178a.ko b/shared/prebuilt-kernel/android-mainline/ax88179_178a.ko
new file mode 100644
index 0000000..a698e2c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ax88179_178a.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ax88796b.ko b/shared/prebuilt-kernel/android-mainline/ax88796b.ko
new file mode 100644
index 0000000..ee961f2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ax88796b.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bcm-phy-lib.ko b/shared/prebuilt-kernel/android-mainline/bcm-phy-lib.ko
new file mode 100644
index 0000000..e842b52
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bcm-phy-lib.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bcm54140.ko b/shared/prebuilt-kernel/android-mainline/bcm54140.ko
new file mode 100644
index 0000000..5fd202e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bcm54140.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bcm7xxx.ko b/shared/prebuilt-kernel/android-mainline/bcm7xxx.ko
new file mode 100644
index 0000000..51c6cd7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bcm7xxx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/binfmt_misc.ko b/shared/prebuilt-kernel/android-mainline/binfmt_misc.ko
new file mode 100644
index 0000000..259788b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/binfmt_misc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/blake2b_generic.ko b/shared/prebuilt-kernel/android-mainline/blake2b_generic.ko
new file mode 100644
index 0000000..bb3f0f9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/blake2b_generic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bluetooth.ko b/shared/prebuilt-kernel/android-mainline/bluetooth.ko
new file mode 100644
index 0000000..e419bec
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bluetooth.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bq25890_charger.ko b/shared/prebuilt-kernel/android-mainline/bq25890_charger.ko
new file mode 100644
index 0000000..e3d0cd1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bq25890_charger.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bq25980_charger.ko b/shared/prebuilt-kernel/android-mainline/bq25980_charger.ko
new file mode 100644
index 0000000..d556356
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bq25980_charger.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bq27xxx_battery.ko b/shared/prebuilt-kernel/android-mainline/bq27xxx_battery.ko
new file mode 100644
index 0000000..584185b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bq27xxx_battery.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bq27xxx_battery_i2c.ko b/shared/prebuilt-kernel/android-mainline/bq27xxx_battery_i2c.ko
new file mode 100644
index 0000000..0c02739
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bq27xxx_battery_i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/br_netfilter.ko b/shared/prebuilt-kernel/android-mainline/br_netfilter.ko
new file mode 100644
index 0000000..eff3e8e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/br_netfilter.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/bridge.ko b/shared/prebuilt-kernel/android-mainline/bridge.ko
new file mode 100644
index 0000000..ea8b0ff
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/bridge.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/broadcom.ko b/shared/prebuilt-kernel/android-mainline/broadcom.ko
new file mode 100644
index 0000000..a75f55f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/broadcom.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/btbcm.ko b/shared/prebuilt-kernel/android-mainline/btbcm.ko
new file mode 100644
index 0000000..f91fa43
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/btbcm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/btintel.ko b/shared/prebuilt-kernel/android-mainline/btintel.ko
new file mode 100644
index 0000000..420720c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/btintel.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/btqca.ko b/shared/prebuilt-kernel/android-mainline/btqca.ko
new file mode 100644
index 0000000..78c0d46
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/btqca.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/btqcomsmd.ko b/shared/prebuilt-kernel/android-mainline/btqcomsmd.ko
new file mode 100644
index 0000000..023bd1e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/btqcomsmd.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/btrtl.ko b/shared/prebuilt-kernel/android-mainline/btrtl.ko
new file mode 100644
index 0000000..9eb59a9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/btrtl.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/btusb.ko b/shared/prebuilt-kernel/android-mainline/btusb.ko
new file mode 100644
index 0000000..35e77bb
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/btusb.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/camcc-sdm845.ko b/shared/prebuilt-kernel/android-mainline/camcc-sdm845.ko
new file mode 100644
index 0000000..3c7c966
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/camcc-sdm845.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ccm.ko b/shared/prebuilt-kernel/android-mainline/ccm.ko
new file mode 100644
index 0000000..4c52e32
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ccm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cdc-acm.ko b/shared/prebuilt-kernel/android-mainline/cdc-acm.ko
new file mode 100644
index 0000000..9e074ec
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cdc-acm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cdc_ether.ko b/shared/prebuilt-kernel/android-mainline/cdc_ether.ko
new file mode 100644
index 0000000..2700443
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cdc_ether.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cdc_ncm.ko b/shared/prebuilt-kernel/android-mainline/cdc_ncm.ko
new file mode 100644
index 0000000..6c0bd3e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cdc_ncm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cdc_subset.ko b/shared/prebuilt-kernel/android-mainline/cdc_subset.ko
new file mode 100644
index 0000000..9bad9db
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cdc_subset.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cec.ko b/shared/prebuilt-kernel/android-mainline/cec.ko
new file mode 100644
index 0000000..3a7e729
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cfg80211.ko b/shared/prebuilt-kernel/android-mainline/cfg80211.ko
new file mode 100644
index 0000000..88a6061
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cfg80211.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ch7006.ko b/shared/prebuilt-kernel/android-mainline/ch7006.ko
new file mode 100644
index 0000000..bc0b559
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ch7006.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/chacha-neon.ko b/shared/prebuilt-kernel/android-mainline/chacha-neon.ko
new file mode 100644
index 0000000..a4b41b8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/chacha-neon.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cls_cgroup.ko b/shared/prebuilt-kernel/android-mainline/cls_cgroup.ko
new file mode 100644
index 0000000..1add9d6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cls_cgroup.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cn10k-rng.ko b/shared/prebuilt-kernel/android-mainline/cn10k-rng.ko
new file mode 100644
index 0000000..e06781e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cn10k-rng.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cp210x.ko b/shared/prebuilt-kernel/android-mainline/cp210x.ko
new file mode 100644
index 0000000..5a69e7d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cp210x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cpufreq_conservative.ko b/shared/prebuilt-kernel/android-mainline/cpufreq_conservative.ko
new file mode 100644
index 0000000..853c701
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cpufreq_conservative.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/crc-ccitt.ko b/shared/prebuilt-kernel/android-mainline/crc-ccitt.ko
new file mode 100644
index 0000000..43ce3ca
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/crc-ccitt.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/crct10dif-ce.ko b/shared/prebuilt-kernel/android-mainline/crct10dif-ce.ko
new file mode 100644
index 0000000..62ccad2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/crct10dif-ce.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cros_ec_baro.ko b/shared/prebuilt-kernel/android-mainline/cros_ec_baro.ko
new file mode 100644
index 0000000..a5949ef
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cros_ec_baro.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cros_ec_chardev.ko b/shared/prebuilt-kernel/android-mainline/cros_ec_chardev.ko
new file mode 100644
index 0000000..05ab7f3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cros_ec_chardev.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cros_ec_light_prox.ko b/shared/prebuilt-kernel/android-mainline/cros_ec_light_prox.ko
new file mode 100644
index 0000000..5ce5c20
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cros_ec_light_prox.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cros_ec_sensors.ko b/shared/prebuilt-kernel/android-mainline/cros_ec_sensors.ko
new file mode 100644
index 0000000..1d46994
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cros_ec_sensors.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cros_ec_sensors_core.ko b/shared/prebuilt-kernel/android-mainline/cros_ec_sensors_core.ko
new file mode 100644
index 0000000..88f77db
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cros_ec_sensors_core.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cros_ec_typec.ko b/shared/prebuilt-kernel/android-mainline/cros_ec_typec.ko
new file mode 100644
index 0000000..fab11da
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cros_ec_typec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/crypto_engine.ko b/shared/prebuilt-kernel/android-mainline/crypto_engine.ko
new file mode 100644
index 0000000..1f48fae
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/crypto_engine.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/curve25519-generic.ko b/shared/prebuilt-kernel/android-mainline/curve25519-generic.ko
new file mode 100644
index 0000000..00754b4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/curve25519-generic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/cuse.ko b/shared/prebuilt-kernel/android-mainline/cuse.ko
new file mode 100644
index 0000000..03709c6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/cuse.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/des_generic.ko b/shared/prebuilt-kernel/android-mainline/des_generic.ko
new file mode 100644
index 0000000..831d769
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/des_generic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/display-connector.ko b/shared/prebuilt-kernel/android-mainline/display-connector.ko
new file mode 100644
index 0000000..c2ea10b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/display-connector.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/dm9601.ko b/shared/prebuilt-kernel/android-mainline/dm9601.ko
new file mode 100644
index 0000000..cd6fe76
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/dm9601.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/drm_dp_aux_bus.ko b/shared/prebuilt-kernel/android-mainline/drm_dp_aux_bus.ko
new file mode 100644
index 0000000..203ff10
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/drm_dp_aux_bus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/drm_shmem_helper.ko b/shared/prebuilt-kernel/android-mainline/drm_shmem_helper.ko
new file mode 100644
index 0000000..25d55dc
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/drm_shmem_helper.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ecc.ko b/shared/prebuilt-kernel/android-mainline/ecc.ko
new file mode 100644
index 0000000..d53bd7e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ecc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ecdh_generic.ko b/shared/prebuilt-kernel/android-mainline/ecdh_generic.ko
new file mode 100644
index 0000000..0250616
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ecdh_generic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/edt-ft5x06.ko b/shared/prebuilt-kernel/android-mainline/edt-ft5x06.ko
new file mode 100644
index 0000000..60ffc73
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/edt-ft5x06.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/fastrpc.ko b/shared/prebuilt-kernel/android-mainline/fastrpc.ko
new file mode 100644
index 0000000..ad3c56d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/fastrpc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/focaltech_fts.ko b/shared/prebuilt-kernel/android-mainline/focaltech_fts.ko
new file mode 100644
index 0000000..28de5ed
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/focaltech_fts.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ftdi_sio.ko b/shared/prebuilt-kernel/android-mainline/ftdi_sio.ko
new file mode 100644
index 0000000..51c960f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ftdi_sio.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/garp.ko b/shared/prebuilt-kernel/android-mainline/garp.ko
new file mode 100644
index 0000000..93c909e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/garp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/genet.ko b/shared/prebuilt-kernel/android-mainline/genet.ko
new file mode 100644
index 0000000..e8eed41
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/genet.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/gnss.ko b/shared/prebuilt-kernel/android-mainline/gnss.ko
new file mode 100644
index 0000000..8a6bcfb
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/gnss.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/goodix_ts.ko b/shared/prebuilt-kernel/android-mainline/goodix_ts.ko
new file mode 100644
index 0000000..f450031
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/goodix_ts.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/governor_userspace.ko b/shared/prebuilt-kernel/android-mainline/governor_userspace.ko
new file mode 100644
index 0000000..17f22aa
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/governor_userspace.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/gpi.ko b/shared/prebuilt-kernel/android-mainline/gpi.ko
new file mode 100644
index 0000000..2aff592
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/gpi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/gpio-wcd934x.ko b/shared/prebuilt-kernel/android-mainline/gpio-wcd934x.ko
new file mode 100644
index 0000000..0fa77e0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/gpio-wcd934x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/gud.ko b/shared/prebuilt-kernel/android-mainline/gud.ko
new file mode 100644
index 0000000..7cccf4f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/gud.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hci_uart.ko b/shared/prebuilt-kernel/android-mainline/hci_uart.ko
new file mode 100644
index 0000000..f1ace32
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hci_uart.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hid-multitouch.ko b/shared/prebuilt-kernel/android-mainline/hid-multitouch.ko
new file mode 100644
index 0000000..ba915d8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hid-multitouch.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hid-rmi.ko b/shared/prebuilt-kernel/android-mainline/hid-rmi.ko
new file mode 100644
index 0000000..bd6f52b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hid-rmi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hidp.ko b/shared/prebuilt-kernel/android-mainline/hidp.ko
new file mode 100644
index 0000000..7744923
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hidp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hisi-trng-v2.ko b/shared/prebuilt-kernel/android-mainline/hisi-trng-v2.ko
new file mode 100644
index 0000000..8b6bc42
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hisi-trng-v2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hisi_hpre.ko b/shared/prebuilt-kernel/android-mainline/hisi_hpre.ko
new file mode 100644
index 0000000..d358ae2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hisi_hpre.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hisi_qm.ko b/shared/prebuilt-kernel/android-mainline/hisi_qm.ko
new file mode 100644
index 0000000..b4b4bbf
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hisi_qm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hisi_sec2.ko b/shared/prebuilt-kernel/android-mainline/hisi_sec2.ko
new file mode 100644
index 0000000..90ec354
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hisi_sec2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/hisi_zip.ko b/shared/prebuilt-kernel/android-mainline/hisi_zip.ko
new file mode 100644
index 0000000..eba4766
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/hisi_zip.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/i2c-gpio.ko b/shared/prebuilt-kernel/android-mainline/i2c-gpio.ko
new file mode 100644
index 0000000..715d4eb
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/i2c-gpio.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/i2c-hid-acpi.ko b/shared/prebuilt-kernel/android-mainline/i2c-hid-acpi.ko
new file mode 100644
index 0000000..20f8c24
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/i2c-hid-acpi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/i2c-hid-of.ko b/shared/prebuilt-kernel/android-mainline/i2c-hid-of.ko
new file mode 100644
index 0000000..a7581eb
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/i2c-hid-of.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/i2c-hid.ko b/shared/prebuilt-kernel/android-mainline/i2c-hid.ko
new file mode 100644
index 0000000..3a07e14
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/i2c-hid.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/i2c-qcom-cci.ko b/shared/prebuilt-kernel/android-mainline/i2c-qcom-cci.ko
new file mode 100644
index 0000000..297fd31
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/i2c-qcom-cci.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/i2c-qcom-geni.ko b/shared/prebuilt-kernel/android-mainline/i2c-qcom-geni.ko
new file mode 100644
index 0000000..5ec1887
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/i2c-qcom-geni.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/icc-osm-l3.ko b/shared/prebuilt-kernel/android-mainline/icc-osm-l3.ko
new file mode 100644
index 0000000..a78b34e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/icc-osm-l3.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/icc-smd-rpm.ko b/shared/prebuilt-kernel/android-mainline/icc-smd-rpm.ko
new file mode 100644
index 0000000..eb0f35f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/icc-smd-rpm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/industrialio-triggered-buffer.ko b/shared/prebuilt-kernel/android-mainline/industrialio-triggered-buffer.ko
new file mode 100644
index 0000000..c602ace
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/industrialio-triggered-buffer.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ip_vs.ko b/shared/prebuilt-kernel/android-mainline/ip_vs.ko
new file mode 100644
index 0000000..c92ac17
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ip_vs.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ip_vs_rr.ko b/shared/prebuilt-kernel/android-mainline/ip_vs_rr.ko
new file mode 100644
index 0000000..b850f5a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ip_vs_rr.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ipa.ko b/shared/prebuilt-kernel/android-mainline/ipa.ko
new file mode 100644
index 0000000..d48a393
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ipa.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ipmi_msghandler.ko b/shared/prebuilt-kernel/android-mainline/ipmi_msghandler.ko
new file mode 100644
index 0000000..4124a3a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ipmi_msghandler.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ipvlan.ko b/shared/prebuilt-kernel/android-mainline/ipvlan.ko
new file mode 100644
index 0000000..001ea54
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ipvlan.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ir-kbd-i2c.ko b/shared/prebuilt-kernel/android-mainline/ir-kbd-i2c.ko
new file mode 100644
index 0000000..40c8fc9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ir-kbd-i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/jc42.ko b/shared/prebuilt-kernel/android-mainline/jc42.ko
new file mode 100644
index 0000000..3a8c9d4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/jc42.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/kfifo_buf.ko b/shared/prebuilt-kernel/android-mainline/kfifo_buf.ko
new file mode 100644
index 0000000..0d183d1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/kfifo_buf.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/lan78xx.ko b/shared/prebuilt-kernel/android-mainline/lan78xx.ko
new file mode 100644
index 0000000..f265f8a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/lan78xx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/leds-lm3692x.ko b/shared/prebuilt-kernel/android-mainline/leds-lm3692x.ko
new file mode 100644
index 0000000..9b8d0f3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/leds-lm3692x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/leds-pca9532.ko b/shared/prebuilt-kernel/android-mainline/leds-pca9532.ko
new file mode 100644
index 0000000..f75ff66
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/leds-pca9532.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/libchacha20poly1305.ko b/shared/prebuilt-kernel/android-mainline/libchacha20poly1305.ko
new file mode 100644
index 0000000..0fea43a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/libchacha20poly1305.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/libcurve25519-generic.ko b/shared/prebuilt-kernel/android-mainline/libcurve25519-generic.ko
new file mode 100644
index 0000000..5dec0ef
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/libcurve25519-generic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/libcurve25519.ko b/shared/prebuilt-kernel/android-mainline/libcurve25519.ko
new file mode 100644
index 0000000..8c791a4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/libcurve25519.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/libdes.ko b/shared/prebuilt-kernel/android-mainline/libdes.ko
new file mode 100644
index 0000000..edf2a4d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/libdes.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/libsm4.ko b/shared/prebuilt-kernel/android-mainline/libsm4.ko
new file mode 100644
index 0000000..379ed9f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/libsm4.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/llc.ko b/shared/prebuilt-kernel/android-mainline/llc.ko
new file mode 100644
index 0000000..3f55b69
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/llc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/lontium-lt8912b.ko b/shared/prebuilt-kernel/android-mainline/lontium-lt8912b.ko
new file mode 100644
index 0000000..a11cae3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/lontium-lt8912b.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/lontium-lt9611uxc.ko b/shared/prebuilt-kernel/android-mainline/lontium-lt9611uxc.ko
new file mode 100644
index 0000000..edd7ed4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/lontium-lt9611uxc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/lpass-gfm-sm8250.ko b/shared/prebuilt-kernel/android-mainline/lpass-gfm-sm8250.ko
new file mode 100644
index 0000000..5b0a52c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/lpass-gfm-sm8250.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/lz4.ko b/shared/prebuilt-kernel/android-mainline/lz4.ko
new file mode 100644
index 0000000..9a828ec
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/lz4.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/lz4_compress.ko b/shared/prebuilt-kernel/android-mainline/lz4_compress.ko
new file mode 100644
index 0000000..9967bc1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/lz4_compress.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/mac80211.ko b/shared/prebuilt-kernel/android-mainline/mac80211.ko
new file mode 100644
index 0000000..efb1a8c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/mac80211.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/macvlan.ko b/shared/prebuilt-kernel/android-mainline/macvlan.ko
new file mode 100644
index 0000000..15a6ddd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/macvlan.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/macvtap.ko b/shared/prebuilt-kernel/android-mainline/macvtap.ko
new file mode 100644
index 0000000..fc4bff5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/macvtap.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/marvell.ko b/shared/prebuilt-kernel/android-mainline/marvell.ko
new file mode 100644
index 0000000..5add6d4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/marvell.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/marvell10g.ko b/shared/prebuilt-kernel/android-mainline/marvell10g.ko
new file mode 100644
index 0000000..035c906
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/marvell10g.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/max17042_battery.ko b/shared/prebuilt-kernel/android-mainline/max17042_battery.ko
new file mode 100644
index 0000000..135e1b8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/max17042_battery.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/mc.ko b/shared/prebuilt-kernel/android-mainline/mc.ko
new file mode 100644
index 0000000..b5c85bf
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/mc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/mcs7830.ko b/shared/prebuilt-kernel/android-mainline/mcs7830.ko
new file mode 100644
index 0000000..0af63f7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/mcs7830.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/mdio-bcm-unimac.ko b/shared/prebuilt-kernel/android-mainline/mdio-bcm-unimac.ko
new file mode 100644
index 0000000..cb6fd68
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/mdio-bcm-unimac.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/microchip.ko b/shared/prebuilt-kernel/android-mainline/microchip.ko
new file mode 100644
index 0000000..f7579d1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/microchip.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/mrp.ko b/shared/prebuilt-kernel/android-mainline/mrp.ko
new file mode 100644
index 0000000..a576849
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/mrp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/mwifiex.ko b/shared/prebuilt-kernel/android-mainline/mwifiex.ko
new file mode 100644
index 0000000..ac576fa
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/mwifiex.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/mwifiex_pcie.ko b/shared/prebuilt-kernel/android-mainline/mwifiex_pcie.ko
new file mode 100644
index 0000000..0a70787
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/mwifiex_pcie.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nbd.ko b/shared/prebuilt-kernel/android-mainline/nbd.ko
new file mode 100644
index 0000000..f6b3d19
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nbd.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nci.ko b/shared/prebuilt-kernel/android-mainline/nci.ko
new file mode 100644
index 0000000..dc9d776
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nci.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/net1080.ko b/shared/prebuilt-kernel/android-mainline/net1080.ko
new file mode 100644
index 0000000..f781dc2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/net1080.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/netlink_diag.ko b/shared/prebuilt-kernel/android-mainline/netlink_diag.ko
new file mode 100644
index 0000000..1552907
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/netlink_diag.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nf_log_syslog.ko b/shared/prebuilt-kernel/android-mainline/nf_log_syslog.ko
new file mode 100644
index 0000000..eec4d4d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nf_log_syslog.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nf_tables.ko b/shared/prebuilt-kernel/android-mainline/nf_tables.ko
new file mode 100644
index 0000000..7384a81
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nf_tables.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nfc.ko b/shared/prebuilt-kernel/android-mainline/nfc.ko
new file mode 100644
index 0000000..75e380b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nfc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_chain_nat.ko b/shared/prebuilt-kernel/android-mainline/nft_chain_nat.ko
new file mode 100644
index 0000000..915aa64
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_chain_nat.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_ct.ko b/shared/prebuilt-kernel/android-mainline/nft_ct.ko
new file mode 100644
index 0000000..b35990a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_ct.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_limit.ko b/shared/prebuilt-kernel/android-mainline/nft_limit.ko
new file mode 100644
index 0000000..f54115c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_limit.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_log.ko b/shared/prebuilt-kernel/android-mainline/nft_log.ko
new file mode 100644
index 0000000..9fce5d1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_log.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_masq.ko b/shared/prebuilt-kernel/android-mainline/nft_masq.ko
new file mode 100644
index 0000000..442a112
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_masq.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_nat.ko b/shared/prebuilt-kernel/android-mainline/nft_nat.ko
new file mode 100644
index 0000000..8c58320
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_nat.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_reject.ko b/shared/prebuilt-kernel/android-mainline/nft_reject.ko
new file mode 100644
index 0000000..5cbfd61
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_reject.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_reject_inet.ko b/shared/prebuilt-kernel/android-mainline/nft_reject_inet.ko
new file mode 100644
index 0000000..01430ec
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_reject_inet.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_reject_ipv4.ko b/shared/prebuilt-kernel/android-mainline/nft_reject_ipv4.ko
new file mode 100644
index 0000000..2e79f37
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_reject_ipv4.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nft_reject_ipv6.ko b/shared/prebuilt-kernel/android-mainline/nft_reject_ipv6.ko
new file mode 100644
index 0000000..b7e01b8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nft_reject_ipv6.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/nt36xxx.ko b/shared/prebuilt-kernel/android-mainline/nt36xxx.ko
new file mode 100644
index 0000000..0ee9fee
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/nt36xxx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/optee-rng.ko b/shared/prebuilt-kernel/android-mainline/optee-rng.ko
new file mode 100644
index 0000000..b340737
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/optee-rng.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/option.ko b/shared/prebuilt-kernel/android-mainline/option.ko
new file mode 100644
index 0000000..ac066d9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/option.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/ov5640.ko b/shared/prebuilt-kernel/android-mainline/ov5640.ko
new file mode 100644
index 0000000..2e3362a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/ov5640.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/p8022.ko b/shared/prebuilt-kernel/android-mainline/p8022.ko
new file mode 100644
index 0000000..04fc9c9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/p8022.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/panel-boe-tv101wum-nl6.ko b/shared/prebuilt-kernel/android-mainline/panel-boe-tv101wum-nl6.ko
new file mode 100644
index 0000000..893c8e5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/panel-boe-tv101wum-nl6.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/panel-edp.ko b/shared/prebuilt-kernel/android-mainline/panel-edp.ko
new file mode 100644
index 0000000..7c24fef
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/panel-edp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/panel-mantix-mlaf057we51.ko b/shared/prebuilt-kernel/android-mainline/panel-mantix-mlaf057we51.ko
new file mode 100644
index 0000000..302c116
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/panel-mantix-mlaf057we51.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/panel-simple.ko b/shared/prebuilt-kernel/android-mainline/panel-simple.ko
new file mode 100644
index 0000000..d5850a2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/panel-simple.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/panel-truly-nt35597.ko b/shared/prebuilt-kernel/android-mainline/panel-truly-nt35597.ko
new file mode 100644
index 0000000..39ae333
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/panel-truly-nt35597.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pci-epf-test.ko b/shared/prebuilt-kernel/android-mainline/pci-epf-test.ko
new file mode 100644
index 0000000..91cdddd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pci-epf-test.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pci-meson.ko b/shared/prebuilt-kernel/android-mainline/pci-meson.ko
new file mode 100644
index 0000000..7971233
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pci-meson.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pci_endpoint_test.ko b/shared/prebuilt-kernel/android-mainline/pci_endpoint_test.ko
new file mode 100644
index 0000000..05840bc
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pci_endpoint_test.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pcs_xpcs.ko b/shared/prebuilt-kernel/android-mainline/pcs_xpcs.ko
new file mode 100644
index 0000000..58490b4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pcs_xpcs.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pegasus.ko b/shared/prebuilt-kernel/android-mainline/pegasus.ko
new file mode 100644
index 0000000..4061c8e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pegasus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pinctrl-lpass-lpi.ko b/shared/prebuilt-kernel/android-mainline/pinctrl-lpass-lpi.ko
new file mode 100644
index 0000000..7b45955
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pinctrl-lpass-lpi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pm8xxx-vibrator.ko b/shared/prebuilt-kernel/android-mainline/pm8xxx-vibrator.ko
new file mode 100644
index 0000000..e143423
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pm8xxx-vibrator.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/poly1305-neon.ko b/shared/prebuilt-kernel/android-mainline/poly1305-neon.ko
new file mode 100644
index 0000000..8d899d0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/poly1305-neon.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/psnap.ko b/shared/prebuilt-kernel/android-mainline/psnap.ko
new file mode 100644
index 0000000..ef45f69
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/psnap.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pwm-beeper.ko b/shared/prebuilt-kernel/android-mainline/pwm-beeper.ko
new file mode 100644
index 0000000..78c4700
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pwm-beeper.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pwm-cros-ec.ko b/shared/prebuilt-kernel/android-mainline/pwm-cros-ec.ko
new file mode 100644
index 0000000..7386257
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pwm-cros-ec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pwm-vibra.ko b/shared/prebuilt-kernel/android-mainline/pwm-vibra.ko
new file mode 100644
index 0000000..ca7d525
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pwm-vibra.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/pwm_bl.ko b/shared/prebuilt-kernel/android-mainline/pwm_bl.ko
new file mode 100644
index 0000000..6eee5a5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/pwm_bl.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6adm.ko b/shared/prebuilt-kernel/android-mainline/q6adm.ko
new file mode 100644
index 0000000..a024d70
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6adm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6afe-clocks.ko b/shared/prebuilt-kernel/android-mainline/q6afe-clocks.ko
new file mode 100644
index 0000000..531a3e5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6afe-clocks.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6afe-dai.ko b/shared/prebuilt-kernel/android-mainline/q6afe-dai.ko
new file mode 100644
index 0000000..79ca013
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6afe-dai.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6afe.ko b/shared/prebuilt-kernel/android-mainline/q6afe.ko
new file mode 100644
index 0000000..149cf97
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6afe.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6apm-dai.ko b/shared/prebuilt-kernel/android-mainline/q6apm-dai.ko
new file mode 100644
index 0000000..9c83352
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6apm-dai.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6apm-lpass-dais.ko b/shared/prebuilt-kernel/android-mainline/q6apm-lpass-dais.ko
new file mode 100644
index 0000000..ecc081f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6apm-lpass-dais.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6asm-dai.ko b/shared/prebuilt-kernel/android-mainline/q6asm-dai.ko
new file mode 100644
index 0000000..76bc52a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6asm-dai.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6asm.ko b/shared/prebuilt-kernel/android-mainline/q6asm.ko
new file mode 100644
index 0000000..adc5c85
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6asm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6core.ko b/shared/prebuilt-kernel/android-mainline/q6core.ko
new file mode 100644
index 0000000..c131191
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6core.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6prm-clocks.ko b/shared/prebuilt-kernel/android-mainline/q6prm-clocks.ko
new file mode 100644
index 0000000..da2d816
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6prm-clocks.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6prm.ko b/shared/prebuilt-kernel/android-mainline/q6prm.ko
new file mode 100644
index 0000000..e326cb7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6prm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/q6routing.ko b/shared/prebuilt-kernel/android-mainline/q6routing.ko
new file mode 100644
index 0000000..5047acd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/q6routing.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom-camss.ko b/shared/prebuilt-kernel/android-mainline/qcom-camss.ko
new file mode 100644
index 0000000..2370439
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom-camss.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom-coincell.ko b/shared/prebuilt-kernel/android-mainline/qcom-coincell.ko
new file mode 100644
index 0000000..d318289
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom-coincell.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom-emac.ko b/shared/prebuilt-kernel/android-mainline/qcom-emac.ko
new file mode 100644
index 0000000..012d3d0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom-emac.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom-rng.ko b/shared/prebuilt-kernel/android-mainline/qcom-rng.ko
new file mode 100644
index 0000000..ed93f05
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom-rng.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom-spmi-haptics.ko b/shared/prebuilt-kernel/android-mainline/qcom-spmi-haptics.ko
new file mode 100644
index 0000000..1be5474
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom-spmi-haptics.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom-spmi-rradc.ko b/shared/prebuilt-kernel/android-mainline/qcom-spmi-rradc.ko
new file mode 100644
index 0000000..b2eef20
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom-spmi-rradc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom-wdt.ko b/shared/prebuilt-kernel/android-mainline/qcom-wdt.ko
new file mode 100644
index 0000000..594298d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom-wdt.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_common.ko b/shared/prebuilt-kernel/android-mainline/qcom_common.ko
new file mode 100644
index 0000000..be68852
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_common.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_fg.ko b/shared/prebuilt-kernel/android-mainline/qcom_fg.ko
new file mode 100644
index 0000000..ca95fc8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_fg.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_glink_smem.ko b/shared/prebuilt-kernel/android-mainline/qcom_glink_smem.ko
new file mode 100644
index 0000000..7cfabc7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_glink_smem.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_pil_info.ko b/shared/prebuilt-kernel/android-mainline/qcom_pil_info.ko
new file mode 100644
index 0000000..e63c476
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_pil_info.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_q6v5.ko b/shared/prebuilt-kernel/android-mainline/qcom_q6v5.ko
new file mode 100644
index 0000000..449a777
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_q6v5.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_q6v5_adsp.ko b/shared/prebuilt-kernel/android-mainline/qcom_q6v5_adsp.ko
new file mode 100644
index 0000000..f875e45
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_q6v5_adsp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_q6v5_mss.ko b/shared/prebuilt-kernel/android-mainline/qcom_q6v5_mss.ko
new file mode 100644
index 0000000..2f6b920
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_q6v5_mss.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_q6v5_pas.ko b/shared/prebuilt-kernel/android-mainline/qcom_q6v5_pas.ko
new file mode 100644
index 0000000..4e4b5bf
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_q6v5_pas.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_smb2.ko b/shared/prebuilt-kernel/android-mainline/qcom_smb2.ko
new file mode 100644
index 0000000..e472788
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_smb2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_stats.ko b/shared/prebuilt-kernel/android-mainline/qcom_stats.ko
new file mode 100644
index 0000000..273af2a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_stats.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_sysmon.ko b/shared/prebuilt-kernel/android-mainline/qcom_sysmon.ko
new file mode 100644
index 0000000..f8ccb08
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_sysmon.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qcom_wcnss_pil.ko b/shared/prebuilt-kernel/android-mainline/qcom_wcnss_pil.ko
new file mode 100644
index 0000000..b926b8d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qcom_wcnss_pil.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qnoc-msm8916.ko b/shared/prebuilt-kernel/android-mainline/qnoc-msm8916.ko
new file mode 100644
index 0000000..73d886a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qnoc-msm8916.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qnoc-sm8150.ko b/shared/prebuilt-kernel/android-mainline/qnoc-sm8150.ko
new file mode 100644
index 0000000..6c505a1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qnoc-sm8150.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qnoc-sm8250.ko b/shared/prebuilt-kernel/android-mainline/qnoc-sm8250.ko
new file mode 100644
index 0000000..1ebc5e6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qnoc-sm8250.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qnoc-sm8350.ko b/shared/prebuilt-kernel/android-mainline/qnoc-sm8350.ko
new file mode 100644
index 0000000..534b1b0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qnoc-sm8350.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qrtr-smd.ko b/shared/prebuilt-kernel/android-mainline/qrtr-smd.ko
new file mode 100644
index 0000000..d438e63
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qrtr-smd.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qrtr-tun.ko b/shared/prebuilt-kernel/android-mainline/qrtr-tun.ko
new file mode 100644
index 0000000..8ced014
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qrtr-tun.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/qrtr.ko b/shared/prebuilt-kernel/android-mainline/qrtr.ko
new file mode 100644
index 0000000..872a709
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/qrtr.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/r8152.ko b/shared/prebuilt-kernel/android-mainline/r8152.ko
new file mode 100644
index 0000000..a7e5a27
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/r8152.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/raid_class.ko b/shared/prebuilt-kernel/android-mainline/raid_class.ko
new file mode 100644
index 0000000..2376ccb
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/raid_class.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-adstech-dvb-t-pci.ko b/shared/prebuilt-kernel/android-mainline/rc-adstech-dvb-t-pci.ko
new file mode 100644
index 0000000..573ef34
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-adstech-dvb-t-pci.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-alink-dtu-m.ko b/shared/prebuilt-kernel/android-mainline/rc-alink-dtu-m.ko
new file mode 100644
index 0000000..c9e98f7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-alink-dtu-m.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-anysee.ko b/shared/prebuilt-kernel/android-mainline/rc-anysee.ko
new file mode 100644
index 0000000..3efa1c3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-anysee.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-apac-viewcomp.ko b/shared/prebuilt-kernel/android-mainline/rc-apac-viewcomp.ko
new file mode 100644
index 0000000..8159951
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-apac-viewcomp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-astrometa-t2hybrid.ko b/shared/prebuilt-kernel/android-mainline/rc-astrometa-t2hybrid.ko
new file mode 100644
index 0000000..1b0c2d7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-astrometa-t2hybrid.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-asus-pc39.ko b/shared/prebuilt-kernel/android-mainline/rc-asus-pc39.ko
new file mode 100644
index 0000000..bb6005c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-asus-pc39.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-asus-ps3-100.ko b/shared/prebuilt-kernel/android-mainline/rc-asus-ps3-100.ko
new file mode 100644
index 0000000..31163d2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-asus-ps3-100.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-ati-tv-wonder-hd-600.ko b/shared/prebuilt-kernel/android-mainline/rc-ati-tv-wonder-hd-600.ko
new file mode 100644
index 0000000..5f44898
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-ati-tv-wonder-hd-600.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-ati-x10.ko b/shared/prebuilt-kernel/android-mainline/rc-ati-x10.ko
new file mode 100644
index 0000000..85e55aa
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-ati-x10.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avermedia-a16d.ko b/shared/prebuilt-kernel/android-mainline/rc-avermedia-a16d.ko
new file mode 100644
index 0000000..a591b9c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avermedia-a16d.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avermedia-cardbus.ko b/shared/prebuilt-kernel/android-mainline/rc-avermedia-cardbus.ko
new file mode 100644
index 0000000..2e8f36c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avermedia-cardbus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avermedia-dvbt.ko b/shared/prebuilt-kernel/android-mainline/rc-avermedia-dvbt.ko
new file mode 100644
index 0000000..3b69cc8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avermedia-dvbt.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avermedia-m135a.ko b/shared/prebuilt-kernel/android-mainline/rc-avermedia-m135a.ko
new file mode 100644
index 0000000..0949b6b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avermedia-m135a.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avermedia-m733a-rm-k6.ko b/shared/prebuilt-kernel/android-mainline/rc-avermedia-m733a-rm-k6.ko
new file mode 100644
index 0000000..9e94b7c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avermedia-m733a-rm-k6.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avermedia-rm-ks.ko b/shared/prebuilt-kernel/android-mainline/rc-avermedia-rm-ks.ko
new file mode 100644
index 0000000..1d3307d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avermedia-rm-ks.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avermedia.ko b/shared/prebuilt-kernel/android-mainline/rc-avermedia.ko
new file mode 100644
index 0000000..e8894c9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avermedia.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-avertv-303.ko b/shared/prebuilt-kernel/android-mainline/rc-avertv-303.ko
new file mode 100644
index 0000000..c298261
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-avertv-303.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-azurewave-ad-tu700.ko b/shared/prebuilt-kernel/android-mainline/rc-azurewave-ad-tu700.ko
new file mode 100644
index 0000000..7b903fd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-azurewave-ad-tu700.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-beelink-gs1.ko b/shared/prebuilt-kernel/android-mainline/rc-beelink-gs1.ko
new file mode 100644
index 0000000..63be773
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-beelink-gs1.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-behold-columbus.ko b/shared/prebuilt-kernel/android-mainline/rc-behold-columbus.ko
new file mode 100644
index 0000000..f921ade
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-behold-columbus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-behold.ko b/shared/prebuilt-kernel/android-mainline/rc-behold.ko
new file mode 100644
index 0000000..ff73a9f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-behold.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-budget-ci-old.ko b/shared/prebuilt-kernel/android-mainline/rc-budget-ci-old.ko
new file mode 100644
index 0000000..ad0a2be
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-budget-ci-old.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-cinergy-1400.ko b/shared/prebuilt-kernel/android-mainline/rc-cinergy-1400.ko
new file mode 100644
index 0000000..4a2964f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-cinergy-1400.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-cinergy.ko b/shared/prebuilt-kernel/android-mainline/rc-cinergy.ko
new file mode 100644
index 0000000..a825c5c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-cinergy.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-core.ko b/shared/prebuilt-kernel/android-mainline/rc-core.ko
new file mode 100644
index 0000000..b62eafc
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-core.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-ct-90405.ko b/shared/prebuilt-kernel/android-mainline/rc-ct-90405.ko
new file mode 100644
index 0000000..37b41f6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-ct-90405.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-d680-dmb.ko b/shared/prebuilt-kernel/android-mainline/rc-d680-dmb.ko
new file mode 100644
index 0000000..a8cfe9d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-d680-dmb.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-delock-61959.ko b/shared/prebuilt-kernel/android-mainline/rc-delock-61959.ko
new file mode 100644
index 0000000..fcbbc2a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-delock-61959.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dib0700-nec.ko b/shared/prebuilt-kernel/android-mainline/rc-dib0700-nec.ko
new file mode 100644
index 0000000..8ad249e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dib0700-nec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dib0700-rc5.ko b/shared/prebuilt-kernel/android-mainline/rc-dib0700-rc5.ko
new file mode 100644
index 0000000..c4c39d7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dib0700-rc5.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-digitalnow-tinytwin.ko b/shared/prebuilt-kernel/android-mainline/rc-digitalnow-tinytwin.ko
new file mode 100644
index 0000000..20dbed0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-digitalnow-tinytwin.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-digittrade.ko b/shared/prebuilt-kernel/android-mainline/rc-digittrade.ko
new file mode 100644
index 0000000..af74b59
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-digittrade.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dm1105-nec.ko b/shared/prebuilt-kernel/android-mainline/rc-dm1105-nec.ko
new file mode 100644
index 0000000..ead7ce4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dm1105-nec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dntv-live-dvb-t.ko b/shared/prebuilt-kernel/android-mainline/rc-dntv-live-dvb-t.ko
new file mode 100644
index 0000000..9bd2707
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dntv-live-dvb-t.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dntv-live-dvbt-pro.ko b/shared/prebuilt-kernel/android-mainline/rc-dntv-live-dvbt-pro.ko
new file mode 100644
index 0000000..e84184b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dntv-live-dvbt-pro.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dtt200u.ko b/shared/prebuilt-kernel/android-mainline/rc-dtt200u.ko
new file mode 100644
index 0000000..9db8b06
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dtt200u.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dvbsky.ko b/shared/prebuilt-kernel/android-mainline/rc-dvbsky.ko
new file mode 100644
index 0000000..a920d87
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dvbsky.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dvico-mce.ko b/shared/prebuilt-kernel/android-mainline/rc-dvico-mce.ko
new file mode 100644
index 0000000..1ff3415
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dvico-mce.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-dvico-portable.ko b/shared/prebuilt-kernel/android-mainline/rc-dvico-portable.ko
new file mode 100644
index 0000000..6f8d525
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-dvico-portable.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-em-terratec.ko b/shared/prebuilt-kernel/android-mainline/rc-em-terratec.ko
new file mode 100644
index 0000000..5fe1a68
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-em-terratec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-encore-enltv-fm53.ko b/shared/prebuilt-kernel/android-mainline/rc-encore-enltv-fm53.ko
new file mode 100644
index 0000000..b6036ff
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-encore-enltv-fm53.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-encore-enltv.ko b/shared/prebuilt-kernel/android-mainline/rc-encore-enltv.ko
new file mode 100644
index 0000000..70914b2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-encore-enltv.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-encore-enltv2.ko b/shared/prebuilt-kernel/android-mainline/rc-encore-enltv2.ko
new file mode 100644
index 0000000..2a5ca0f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-encore-enltv2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-evga-indtube.ko b/shared/prebuilt-kernel/android-mainline/rc-evga-indtube.ko
new file mode 100644
index 0000000..fc1cec8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-evga-indtube.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-eztv.ko b/shared/prebuilt-kernel/android-mainline/rc-eztv.ko
new file mode 100644
index 0000000..49dbcce
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-eztv.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-flydvb.ko b/shared/prebuilt-kernel/android-mainline/rc-flydvb.ko
new file mode 100644
index 0000000..3d5a31e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-flydvb.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-flyvideo.ko b/shared/prebuilt-kernel/android-mainline/rc-flyvideo.ko
new file mode 100644
index 0000000..60d7354
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-flyvideo.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-fusionhdtv-mce.ko b/shared/prebuilt-kernel/android-mainline/rc-fusionhdtv-mce.ko
new file mode 100644
index 0000000..a8d3d75
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-fusionhdtv-mce.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-gadmei-rm008z.ko b/shared/prebuilt-kernel/android-mainline/rc-gadmei-rm008z.ko
new file mode 100644
index 0000000..10001ed
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-gadmei-rm008z.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-geekbox.ko b/shared/prebuilt-kernel/android-mainline/rc-geekbox.ko
new file mode 100644
index 0000000..b3a7ebf
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-geekbox.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-genius-tvgo-a11mce.ko b/shared/prebuilt-kernel/android-mainline/rc-genius-tvgo-a11mce.ko
new file mode 100644
index 0000000..def0443
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-genius-tvgo-a11mce.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-gotview7135.ko b/shared/prebuilt-kernel/android-mainline/rc-gotview7135.ko
new file mode 100644
index 0000000..77887d9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-gotview7135.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-hauppauge.ko b/shared/prebuilt-kernel/android-mainline/rc-hauppauge.ko
new file mode 100644
index 0000000..c808e36
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-hauppauge.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-hisi-poplar.ko b/shared/prebuilt-kernel/android-mainline/rc-hisi-poplar.ko
new file mode 100644
index 0000000..c65f791
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-hisi-poplar.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-hisi-tv-demo.ko b/shared/prebuilt-kernel/android-mainline/rc-hisi-tv-demo.ko
new file mode 100644
index 0000000..8f0b903
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-hisi-tv-demo.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-imon-mce.ko b/shared/prebuilt-kernel/android-mainline/rc-imon-mce.ko
new file mode 100644
index 0000000..7858f3a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-imon-mce.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-imon-pad.ko b/shared/prebuilt-kernel/android-mainline/rc-imon-pad.ko
new file mode 100644
index 0000000..886d5a8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-imon-pad.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-imon-rsc.ko b/shared/prebuilt-kernel/android-mainline/rc-imon-rsc.ko
new file mode 100644
index 0000000..30f0528
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-imon-rsc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-iodata-bctv7e.ko b/shared/prebuilt-kernel/android-mainline/rc-iodata-bctv7e.ko
new file mode 100644
index 0000000..7a3ab98
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-iodata-bctv7e.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-it913x-v1.ko b/shared/prebuilt-kernel/android-mainline/rc-it913x-v1.ko
new file mode 100644
index 0000000..0e3a422
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-it913x-v1.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-it913x-v2.ko b/shared/prebuilt-kernel/android-mainline/rc-it913x-v2.ko
new file mode 100644
index 0000000..ea6ce32
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-it913x-v2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-kaiomy.ko b/shared/prebuilt-kernel/android-mainline/rc-kaiomy.ko
new file mode 100644
index 0000000..e80a02a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-kaiomy.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-khadas.ko b/shared/prebuilt-kernel/android-mainline/rc-khadas.ko
new file mode 100644
index 0000000..83a1ef2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-khadas.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-khamsin.ko b/shared/prebuilt-kernel/android-mainline/rc-khamsin.ko
new file mode 100644
index 0000000..c005d8c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-khamsin.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-kworld-315u.ko b/shared/prebuilt-kernel/android-mainline/rc-kworld-315u.ko
new file mode 100644
index 0000000..45e112b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-kworld-315u.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-kworld-pc150u.ko b/shared/prebuilt-kernel/android-mainline/rc-kworld-pc150u.ko
new file mode 100644
index 0000000..a833c86
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-kworld-pc150u.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-kworld-plus-tv-analog.ko b/shared/prebuilt-kernel/android-mainline/rc-kworld-plus-tv-analog.ko
new file mode 100644
index 0000000..e256cc2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-kworld-plus-tv-analog.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-leadtek-y04g0051.ko b/shared/prebuilt-kernel/android-mainline/rc-leadtek-y04g0051.ko
new file mode 100644
index 0000000..a4721e4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-leadtek-y04g0051.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-lme2510.ko b/shared/prebuilt-kernel/android-mainline/rc-lme2510.ko
new file mode 100644
index 0000000..3c27539
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-lme2510.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-manli.ko b/shared/prebuilt-kernel/android-mainline/rc-manli.ko
new file mode 100644
index 0000000..4d30a1c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-manli.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-mecool-kii-pro.ko b/shared/prebuilt-kernel/android-mainline/rc-mecool-kii-pro.ko
new file mode 100644
index 0000000..877ff4e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-mecool-kii-pro.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-mecool-kiii-pro.ko b/shared/prebuilt-kernel/android-mainline/rc-mecool-kiii-pro.ko
new file mode 100644
index 0000000..df3c9c1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-mecool-kiii-pro.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-medion-x10-digitainer.ko b/shared/prebuilt-kernel/android-mainline/rc-medion-x10-digitainer.ko
new file mode 100644
index 0000000..2869e3c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-medion-x10-digitainer.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-medion-x10-or2x.ko b/shared/prebuilt-kernel/android-mainline/rc-medion-x10-or2x.ko
new file mode 100644
index 0000000..888a3a9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-medion-x10-or2x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-medion-x10.ko b/shared/prebuilt-kernel/android-mainline/rc-medion-x10.ko
new file mode 100644
index 0000000..4af77da
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-medion-x10.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-minix-neo.ko b/shared/prebuilt-kernel/android-mainline/rc-minix-neo.ko
new file mode 100644
index 0000000..3fe2e9a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-minix-neo.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-msi-digivox-ii.ko b/shared/prebuilt-kernel/android-mainline/rc-msi-digivox-ii.ko
new file mode 100644
index 0000000..3172a9e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-msi-digivox-ii.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-msi-digivox-iii.ko b/shared/prebuilt-kernel/android-mainline/rc-msi-digivox-iii.ko
new file mode 100644
index 0000000..2d54d10
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-msi-digivox-iii.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-msi-tvanywhere-plus.ko b/shared/prebuilt-kernel/android-mainline/rc-msi-tvanywhere-plus.ko
new file mode 100644
index 0000000..6cae898
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-msi-tvanywhere-plus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-msi-tvanywhere.ko b/shared/prebuilt-kernel/android-mainline/rc-msi-tvanywhere.ko
new file mode 100644
index 0000000..2e39e68
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-msi-tvanywhere.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-nebula.ko b/shared/prebuilt-kernel/android-mainline/rc-nebula.ko
new file mode 100644
index 0000000..a4fcf04
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-nebula.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-nec-terratec-cinergy-xs.ko b/shared/prebuilt-kernel/android-mainline/rc-nec-terratec-cinergy-xs.ko
new file mode 100644
index 0000000..c00df15
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-nec-terratec-cinergy-xs.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-norwood.ko b/shared/prebuilt-kernel/android-mainline/rc-norwood.ko
new file mode 100644
index 0000000..f193965
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-norwood.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-npgtech.ko b/shared/prebuilt-kernel/android-mainline/rc-npgtech.ko
new file mode 100644
index 0000000..3723b71
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-npgtech.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-odroid.ko b/shared/prebuilt-kernel/android-mainline/rc-odroid.ko
new file mode 100644
index 0000000..54e0ffa
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-odroid.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pctv-sedna.ko b/shared/prebuilt-kernel/android-mainline/rc-pctv-sedna.ko
new file mode 100644
index 0000000..9928ecd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pctv-sedna.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pine64.ko b/shared/prebuilt-kernel/android-mainline/rc-pine64.ko
new file mode 100644
index 0000000..db75c72
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pine64.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pinnacle-color.ko b/shared/prebuilt-kernel/android-mainline/rc-pinnacle-color.ko
new file mode 100644
index 0000000..666b046
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pinnacle-color.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pinnacle-grey.ko b/shared/prebuilt-kernel/android-mainline/rc-pinnacle-grey.ko
new file mode 100644
index 0000000..dad0a6f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pinnacle-grey.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pinnacle-pctv-hd.ko b/shared/prebuilt-kernel/android-mainline/rc-pinnacle-pctv-hd.ko
new file mode 100644
index 0000000..2f1a48e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pinnacle-pctv-hd.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pixelview-002t.ko b/shared/prebuilt-kernel/android-mainline/rc-pixelview-002t.ko
new file mode 100644
index 0000000..8e335ee
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pixelview-002t.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pixelview-mk12.ko b/shared/prebuilt-kernel/android-mainline/rc-pixelview-mk12.ko
new file mode 100644
index 0000000..c5b815a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pixelview-mk12.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pixelview-new.ko b/shared/prebuilt-kernel/android-mainline/rc-pixelview-new.ko
new file mode 100644
index 0000000..017ad42
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pixelview-new.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pixelview.ko b/shared/prebuilt-kernel/android-mainline/rc-pixelview.ko
new file mode 100644
index 0000000..70093a0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pixelview.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-powercolor-real-angel.ko b/shared/prebuilt-kernel/android-mainline/rc-powercolor-real-angel.ko
new file mode 100644
index 0000000..33eab54
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-powercolor-real-angel.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-proteus-2309.ko b/shared/prebuilt-kernel/android-mainline/rc-proteus-2309.ko
new file mode 100644
index 0000000..2e3b24b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-proteus-2309.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-purpletv.ko b/shared/prebuilt-kernel/android-mainline/rc-purpletv.ko
new file mode 100644
index 0000000..d24f777
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-purpletv.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-pv951.ko b/shared/prebuilt-kernel/android-mainline/rc-pv951.ko
new file mode 100644
index 0000000..6794705
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-pv951.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-rc6-mce.ko b/shared/prebuilt-kernel/android-mainline/rc-rc6-mce.ko
new file mode 100644
index 0000000..4c0fdf0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-rc6-mce.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-real-audio-220-32-keys.ko b/shared/prebuilt-kernel/android-mainline/rc-real-audio-220-32-keys.ko
new file mode 100644
index 0000000..dc56f5e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-real-audio-220-32-keys.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-reddo.ko b/shared/prebuilt-kernel/android-mainline/rc-reddo.ko
new file mode 100644
index 0000000..26d84c1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-reddo.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-snapstream-firefly.ko b/shared/prebuilt-kernel/android-mainline/rc-snapstream-firefly.ko
new file mode 100644
index 0000000..bb0585a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-snapstream-firefly.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-streamzap.ko b/shared/prebuilt-kernel/android-mainline/rc-streamzap.ko
new file mode 100644
index 0000000..711b581
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-streamzap.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-su3000.ko b/shared/prebuilt-kernel/android-mainline/rc-su3000.ko
new file mode 100644
index 0000000..f2712c8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-su3000.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-tanix-tx3mini.ko b/shared/prebuilt-kernel/android-mainline/rc-tanix-tx3mini.ko
new file mode 100644
index 0000000..a878936
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-tanix-tx3mini.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-tanix-tx5max.ko b/shared/prebuilt-kernel/android-mainline/rc-tanix-tx5max.ko
new file mode 100644
index 0000000..7f0da62
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-tanix-tx5max.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-tbs-nec.ko b/shared/prebuilt-kernel/android-mainline/rc-tbs-nec.ko
new file mode 100644
index 0000000..3f29979
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-tbs-nec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-technisat-ts35.ko b/shared/prebuilt-kernel/android-mainline/rc-technisat-ts35.ko
new file mode 100644
index 0000000..8634bb3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-technisat-ts35.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-technisat-usb2.ko b/shared/prebuilt-kernel/android-mainline/rc-technisat-usb2.ko
new file mode 100644
index 0000000..3299832
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-technisat-usb2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-c-pci.ko b/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-c-pci.ko
new file mode 100644
index 0000000..58b1def
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-c-pci.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-s2-hd.ko b/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-s2-hd.ko
new file mode 100644
index 0000000..7865078
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-s2-hd.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-xs.ko b/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-xs.ko
new file mode 100644
index 0000000..c31c660
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-terratec-cinergy-xs.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-terratec-slim-2.ko b/shared/prebuilt-kernel/android-mainline/rc-terratec-slim-2.ko
new file mode 100644
index 0000000..1264d46
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-terratec-slim-2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-terratec-slim.ko b/shared/prebuilt-kernel/android-mainline/rc-terratec-slim.ko
new file mode 100644
index 0000000..df39bb5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-terratec-slim.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-tevii-nec.ko b/shared/prebuilt-kernel/android-mainline/rc-tevii-nec.ko
new file mode 100644
index 0000000..4f98aa9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-tevii-nec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-tivo.ko b/shared/prebuilt-kernel/android-mainline/rc-tivo.ko
new file mode 100644
index 0000000..236a6c9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-tivo.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-total-media-in-hand-02.ko b/shared/prebuilt-kernel/android-mainline/rc-total-media-in-hand-02.ko
new file mode 100644
index 0000000..8298b3e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-total-media-in-hand-02.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-total-media-in-hand.ko b/shared/prebuilt-kernel/android-mainline/rc-total-media-in-hand.ko
new file mode 100644
index 0000000..7d4759e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-total-media-in-hand.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-trekstor.ko b/shared/prebuilt-kernel/android-mainline/rc-trekstor.ko
new file mode 100644
index 0000000..66f3fb9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-trekstor.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-tt-1500.ko b/shared/prebuilt-kernel/android-mainline/rc-tt-1500.ko
new file mode 100644
index 0000000..6db6750
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-tt-1500.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-twinhan-dtv-cab-ci.ko b/shared/prebuilt-kernel/android-mainline/rc-twinhan-dtv-cab-ci.ko
new file mode 100644
index 0000000..eb9a9a4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-twinhan-dtv-cab-ci.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-twinhan1027.ko b/shared/prebuilt-kernel/android-mainline/rc-twinhan1027.ko
new file mode 100644
index 0000000..f285ead
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-twinhan1027.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-vega-s9x.ko b/shared/prebuilt-kernel/android-mainline/rc-vega-s9x.ko
new file mode 100644
index 0000000..fbe24b4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-vega-s9x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-videomate-m1f.ko b/shared/prebuilt-kernel/android-mainline/rc-videomate-m1f.ko
new file mode 100644
index 0000000..d358947
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-videomate-m1f.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-videomate-s350.ko b/shared/prebuilt-kernel/android-mainline/rc-videomate-s350.ko
new file mode 100644
index 0000000..cc190d4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-videomate-s350.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-videomate-tv-pvr.ko b/shared/prebuilt-kernel/android-mainline/rc-videomate-tv-pvr.ko
new file mode 100644
index 0000000..595babb
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-videomate-tv-pvr.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-videostrong-kii-pro.ko b/shared/prebuilt-kernel/android-mainline/rc-videostrong-kii-pro.ko
new file mode 100644
index 0000000..9fa8f82
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-videostrong-kii-pro.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-wetek-hub.ko b/shared/prebuilt-kernel/android-mainline/rc-wetek-hub.ko
new file mode 100644
index 0000000..66914a9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-wetek-hub.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-wetek-play2.ko b/shared/prebuilt-kernel/android-mainline/rc-wetek-play2.ko
new file mode 100644
index 0000000..1f8bc88
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-wetek-play2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-winfast-usbii-deluxe.ko b/shared/prebuilt-kernel/android-mainline/rc-winfast-usbii-deluxe.ko
new file mode 100644
index 0000000..0b706c0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-winfast-usbii-deluxe.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-winfast.ko b/shared/prebuilt-kernel/android-mainline/rc-winfast.ko
new file mode 100644
index 0000000..b615fbc
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-winfast.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-x96max.ko b/shared/prebuilt-kernel/android-mainline/rc-x96max.ko
new file mode 100644
index 0000000..ca70d62
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-x96max.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-xbox-360.ko b/shared/prebuilt-kernel/android-mainline/rc-xbox-360.ko
new file mode 100644
index 0000000..df040b2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-xbox-360.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-xbox-dvd.ko b/shared/prebuilt-kernel/android-mainline/rc-xbox-dvd.ko
new file mode 100644
index 0000000..f116b61
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-xbox-dvd.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rc-zx-irdec.ko b/shared/prebuilt-kernel/android-mainline/rc-zx-irdec.ko
new file mode 100644
index 0000000..4a3bdd3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rc-zx-irdec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/regmap-sdw.ko b/shared/prebuilt-kernel/android-mainline/regmap-sdw.ko
new file mode 100644
index 0000000..51b4f38
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/regmap-sdw.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/regmap-slimbus.ko b/shared/prebuilt-kernel/android-mainline/regmap-slimbus.ko
new file mode 100644
index 0000000..401c2a0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/regmap-slimbus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/reset-qcom-pdc.ko b/shared/prebuilt-kernel/android-mainline/reset-qcom-pdc.ko
new file mode 100644
index 0000000..b8c832b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/reset-qcom-pdc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rfkill.ko b/shared/prebuilt-kernel/android-mainline/rfkill.ko
new file mode 100644
index 0000000..9051be3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rfkill.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rmi_core.ko b/shared/prebuilt-kernel/android-mainline/rmi_core.ko
new file mode 100644
index 0000000..1e3e9e9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rmi_core.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rmi_i2c.ko b/shared/prebuilt-kernel/android-mainline/rmi_i2c.ko
new file mode 100644
index 0000000..f9cbb66
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rmi_i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rmnet.ko b/shared/prebuilt-kernel/android-mainline/rmnet.ko
new file mode 100644
index 0000000..0d586ac
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rmnet.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rng-core.ko b/shared/prebuilt-kernel/android-mainline/rng-core.ko
new file mode 100644
index 0000000..2109f34
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rng-core.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rtc-pcf85063.ko b/shared/prebuilt-kernel/android-mainline/rtc-pcf85063.ko
new file mode 100644
index 0000000..2ab4db3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rtc-pcf85063.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rtc-pm8xxx.ko b/shared/prebuilt-kernel/android-mainline/rtc-pm8xxx.ko
new file mode 100644
index 0000000..2161d2d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rtc-pm8xxx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/rtl8150.ko b/shared/prebuilt-kernel/android-mainline/rtl8150.ko
new file mode 100644
index 0000000..c2f7ae5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/rtl8150.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/s3fwrn5.ko b/shared/prebuilt-kernel/android-mainline/s3fwrn5.ko
new file mode 100644
index 0000000..33e7ce4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/s3fwrn5.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/s3fwrn5_i2c.ko b/shared/prebuilt-kernel/android-mainline/s3fwrn5_i2c.ko
new file mode 100644
index 0000000..3622a0a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/s3fwrn5_i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r1.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r1.dtb
new file mode 100644
index 0000000..ffeb430
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r1.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r2.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r2.dtb
new file mode 100644
index 0000000..6709a3b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r2.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r3.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r3.dtb
new file mode 100644
index 0000000..6cd8fa2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-cheza-r3.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-db845c.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-db845c.dtb
new file mode 100644
index 0000000..1d6407a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-db845c.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-lge-judyln.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-lge-judyln.dtb
new file mode 100644
index 0000000..497cda6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-lge-judyln.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-lge-judyp.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-lge-judyp.dtb
new file mode 100644
index 0000000..98c3856
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-lge-judyp.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-mtp.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-mtp.dtb
new file mode 100644
index 0000000..58e5431
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-mtp.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-oneplus-enchilada.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-oneplus-enchilada.dtb
new file mode 100644
index 0000000..95cfe41
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-oneplus-enchilada.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-oneplus-fajita.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-oneplus-fajita.dtb
new file mode 100644
index 0000000..e0b737b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-oneplus-fajita.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-shift-axolotl.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-shift-axolotl.dtb
new file mode 100644
index 0000000..717ba92
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-shift-axolotl.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-akari.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-akari.dtb
new file mode 100644
index 0000000..e33ffcd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-akari.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-akatsuki.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-akatsuki.dtb
new file mode 100644
index 0000000..9348958
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-akatsuki.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-apollo.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-apollo.dtb
new file mode 100644
index 0000000..f236651
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-sony-xperia-tama-apollo.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium-ebbg.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium-ebbg.dtb
new file mode 100644
index 0000000..0c99b3f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium-ebbg.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium-tianma.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium-tianma.dtb
new file mode 100644
index 0000000..471364b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium-tianma.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium.dtb
new file mode 100644
index 0000000..136566d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-beryllium.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-equuleus.dtb b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-equuleus.dtb
new file mode 100644
index 0000000..d985410
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sdm845-xiaomi-equuleus.dtb
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sil164.ko b/shared/prebuilt-kernel/android-mainline/sil164.ko
new file mode 100644
index 0000000..77d07b5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sil164.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/simple-bridge.ko b/shared/prebuilt-kernel/android-mainline/simple-bridge.ko
new file mode 100644
index 0000000..fd62c7d
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/simple-bridge.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sit.ko b/shared/prebuilt-kernel/android-mainline/sit.ko
new file mode 100644
index 0000000..8b2985f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sit.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/slim-qcom-ngd-ctrl.ko b/shared/prebuilt-kernel/android-mainline/slim-qcom-ngd-ctrl.ko
new file mode 100644
index 0000000..63d511f
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/slim-qcom-ngd-ctrl.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sm4_generic.ko b/shared/prebuilt-kernel/android-mainline/sm4_generic.ko
new file mode 100644
index 0000000..a156140
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sm4_generic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/smsc.ko b/shared/prebuilt-kernel/android-mainline/smsc.ko
new file mode 100644
index 0000000..cf992fe
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/smsc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/smsc75xx.ko b/shared/prebuilt-kernel/android-mainline/smsc75xx.ko
new file mode 100644
index 0000000..db4fb9b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/smsc75xx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/smsc95xx.ko b/shared/prebuilt-kernel/android-mainline/smsc95xx.ko
new file mode 100644
index 0000000..4fd2117
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/smsc95xx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-q6apm.ko b/shared/prebuilt-kernel/android-mainline/snd-q6apm.ko
new file mode 100644
index 0000000..c23fb4a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-q6apm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-q6dsp-common.ko b/shared/prebuilt-kernel/android-mainline/snd-q6dsp-common.ko
new file mode 100644
index 0000000..e811874
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-q6dsp-common.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-apq8016-sbc.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-apq8016-sbc.ko
new file mode 100644
index 0000000..4979fa8
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-apq8016-sbc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-apq8096.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-apq8096.ko
new file mode 100644
index 0000000..ac60ff7
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-apq8096.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-cros-ec-codec.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-cros-ec-codec.ko
new file mode 100644
index 0000000..ae39e24
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-cros-ec-codec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-dmic.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-dmic.ko
new file mode 100644
index 0000000..d2e2e44
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-dmic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-fsl-esai.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-fsl-esai.ko
new file mode 100644
index 0000000..7efa27a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-fsl-esai.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-fsl-ssi.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-fsl-ssi.ko
new file mode 100644
index 0000000..3aedc96
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-fsl-ssi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-imx-audmux.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-imx-audmux.ko
new file mode 100644
index 0000000..7210363
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-imx-audmux.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-apq8016.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-apq8016.ko
new file mode 100644
index 0000000..dd5caec
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-apq8016.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-cpu.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-cpu.ko
new file mode 100644
index 0000000..6b2870e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-cpu.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-platform.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-platform.ko
new file mode 100644
index 0000000..05a2635
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-platform.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-va-macro.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-va-macro.ko
new file mode 100644
index 0000000..fd8dc9a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-va-macro.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-wsa-macro.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-wsa-macro.ko
new file mode 100644
index 0000000..4da50ca
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-lpass-wsa-macro.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-max98927.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-max98927.ko
new file mode 100644
index 0000000..3d17fc5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-max98927.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-msm8916-analog.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-msm8916-analog.ko
new file mode 100644
index 0000000..85b50b4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-msm8916-analog.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-msm8916-digital.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-msm8916-digital.ko
new file mode 100644
index 0000000..dbee05e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-msm8916-digital.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-qcom-common.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-qcom-common.ko
new file mode 100644
index 0000000..b6a1127
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-qcom-common.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-rl6231.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-rl6231.ko
new file mode 100644
index 0000000..0c32f15
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-rl6231.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-rt5663.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-rt5663.ko
new file mode 100644
index 0000000..1735d0e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-rt5663.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-sdm845.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-sdm845.ko
new file mode 100644
index 0000000..59765f0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-sdm845.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-sgtl5000.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-sgtl5000.ko
new file mode 100644
index 0000000..64ab4b6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-sgtl5000.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-simple-mux.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-simple-mux.ko
new file mode 100644
index 0000000..50f6f83
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-simple-mux.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-sm8250.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-sm8250.ko
new file mode 100644
index 0000000..6438b03
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-sm8250.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-spdif-rx.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-spdif-rx.ko
new file mode 100644
index 0000000..1996d9c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-spdif-rx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-spdif-tx.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-spdif-tx.ko
new file mode 100644
index 0000000..8275c71
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-spdif-tx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-tas2559.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-tas2559.ko
new file mode 100644
index 0000000..b97d89c
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-tas2559.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic31xx.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic31xx.ko
new file mode 100644
index 0000000..de796b9
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic31xx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic32x4-i2c.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic32x4-i2c.ko
new file mode 100644
index 0000000..09a3459
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic32x4-i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic32x4.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic32x4.ko
new file mode 100644
index 0000000..cba6a15
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-tlv320aic32x4.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-wcd-mbhc.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-wcd-mbhc.ko
new file mode 100644
index 0000000..6d4ede2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-wcd-mbhc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-wcd934x.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-wcd934x.ko
new file mode 100644
index 0000000..9683868
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-wcd934x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-wm8978.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-wm8978.ko
new file mode 100644
index 0000000..72d5ab6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-wm8978.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/snd-soc-wsa881x.ko b/shared/prebuilt-kernel/android-mainline/snd-soc-wsa881x.ko
new file mode 100644
index 0000000..cea018e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/snd-soc-wsa881x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/soundwire-bus.ko b/shared/prebuilt-kernel/android-mainline/soundwire-bus.ko
new file mode 100644
index 0000000..bd145d1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/soundwire-bus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/soundwire-qcom.ko b/shared/prebuilt-kernel/android-mainline/soundwire-qcom.ko
new file mode 100644
index 0000000..4b0aca3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/soundwire-qcom.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/spi-bitbang.ko b/shared/prebuilt-kernel/android-mainline/spi-bitbang.ko
new file mode 100644
index 0000000..4478a71
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/spi-bitbang.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/spi-geni-qcom.ko b/shared/prebuilt-kernel/android-mainline/spi-geni-qcom.ko
new file mode 100644
index 0000000..d060ec2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/spi-geni-qcom.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/spi-qcom-qspi.ko b/shared/prebuilt-kernel/android-mainline/spi-qcom-qspi.ko
new file mode 100644
index 0000000..79852ec
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/spi-qcom-qspi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/spidev.ko b/shared/prebuilt-kernel/android-mainline/spidev.ko
new file mode 100644
index 0000000..86e2432
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/spidev.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/sr9800.ko b/shared/prebuilt-kernel/android-mainline/sr9800.ko
new file mode 100644
index 0000000..89dd8c1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/sr9800.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_lsm6dsx.ko b/shared/prebuilt-kernel/android-mainline/st_lsm6dsx.ko
new file mode 100644
index 0000000..d253dd5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_lsm6dsx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_lsm6dsx_i2c.ko b/shared/prebuilt-kernel/android-mainline/st_lsm6dsx_i2c.ko
new file mode 100644
index 0000000..c94c251
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_lsm6dsx_i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_lsm6dsx_spi.ko b/shared/prebuilt-kernel/android-mainline/st_lsm6dsx_spi.ko
new file mode 100644
index 0000000..e7263b1
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_lsm6dsx_spi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_magn.ko b/shared/prebuilt-kernel/android-mainline/st_magn.ko
new file mode 100644
index 0000000..bd67457
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_magn.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_magn_i2c.ko b/shared/prebuilt-kernel/android-mainline/st_magn_i2c.ko
new file mode 100644
index 0000000..0ff3237
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_magn_i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_magn_spi.ko b/shared/prebuilt-kernel/android-mainline/st_magn_spi.ko
new file mode 100644
index 0000000..070badf
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_magn_spi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_sensors.ko b/shared/prebuilt-kernel/android-mainline/st_sensors.ko
new file mode 100644
index 0000000..56523b4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_sensors.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_sensors_i2c.ko b/shared/prebuilt-kernel/android-mainline/st_sensors_i2c.ko
new file mode 100644
index 0000000..84ccca6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_sensors_i2c.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/st_sensors_spi.ko b/shared/prebuilt-kernel/android-mainline/st_sensors_spi.ko
new file mode 100644
index 0000000..ef3ab95
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/st_sensors_spi.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/stp.ko b/shared/prebuilt-kernel/android-mainline/stp.ko
new file mode 100644
index 0000000..cbd519b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/stp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/tap.ko b/shared/prebuilt-kernel/android-mainline/tap.ko
new file mode 100644
index 0000000..126e8a4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/tap.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/tcp_bic.ko b/shared/prebuilt-kernel/android-mainline/tcp_bic.ko
new file mode 100644
index 0000000..448807e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/tcp_bic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/tcp_htcp.ko b/shared/prebuilt-kernel/android-mainline/tcp_htcp.ko
new file mode 100644
index 0000000..5bc9bb2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/tcp_htcp.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/tcpci.ko b/shared/prebuilt-kernel/android-mainline/tcpci.ko
new file mode 100644
index 0000000..cf52cd2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/tcpci.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/tcpm.ko b/shared/prebuilt-kernel/android-mainline/tcpm.ko
new file mode 100644
index 0000000..72e6132
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/tcpm.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/tps6598x.ko b/shared/prebuilt-kernel/android-mainline/tps6598x.ko
new file mode 100644
index 0000000..a971d6b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/tps6598x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/typec.ko b/shared/prebuilt-kernel/android-mainline/typec.ko
new file mode 100644
index 0000000..00603b6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/typec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/uinput.ko b/shared/prebuilt-kernel/android-mainline/uinput.ko
new file mode 100644
index 0000000..62ac3f4
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/uinput.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/usb_wwan.ko b/shared/prebuilt-kernel/android-mainline/usb_wwan.ko
new file mode 100644
index 0000000..8e02d1e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/usb_wwan.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/usbnet.ko b/shared/prebuilt-kernel/android-mainline/usbnet.ko
new file mode 100644
index 0000000..01fc376
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/usbnet.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/usbserial.ko b/shared/prebuilt-kernel/android-mainline/usbserial.ko
new file mode 100644
index 0000000..1a02bdb
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/usbserial.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/uvcvideo.ko b/shared/prebuilt-kernel/android-mainline/uvcvideo.ko
new file mode 100644
index 0000000..2f564ba
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/uvcvideo.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/v4l2-async.ko b/shared/prebuilt-kernel/android-mainline/v4l2-async.ko
new file mode 100644
index 0000000..995c79e
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/v4l2-async.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/v4l2-dv-timings.ko b/shared/prebuilt-kernel/android-mainline/v4l2-dv-timings.ko
new file mode 100644
index 0000000..4bbaae5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/v4l2-dv-timings.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/v4l2-fwnode.ko b/shared/prebuilt-kernel/android-mainline/v4l2-fwnode.ko
new file mode 100644
index 0000000..24f666b
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/v4l2-fwnode.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/v4l2-mem2mem.ko b/shared/prebuilt-kernel/android-mainline/v4l2-mem2mem.ko
new file mode 100644
index 0000000..76cda14
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/v4l2-mem2mem.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/vcnl4000.ko b/shared/prebuilt-kernel/android-mainline/vcnl4000.ko
new file mode 100644
index 0000000..a604b92
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/vcnl4000.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/venus-core.ko b/shared/prebuilt-kernel/android-mainline/venus-core.ko
new file mode 100644
index 0000000..ad207d3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/venus-core.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/venus-dec.ko b/shared/prebuilt-kernel/android-mainline/venus-dec.ko
new file mode 100644
index 0000000..0b28934
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/venus-dec.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/venus-enc.ko b/shared/prebuilt-kernel/android-mainline/venus-enc.ko
new file mode 100644
index 0000000..cfe2378
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/venus-enc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/videobuf2-common.ko b/shared/prebuilt-kernel/android-mainline/videobuf2-common.ko
new file mode 100644
index 0000000..f2996f6
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/videobuf2-common.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/videobuf2-dma-contig.ko b/shared/prebuilt-kernel/android-mainline/videobuf2-dma-contig.ko
new file mode 100644
index 0000000..d4a2466
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/videobuf2-dma-contig.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/videobuf2-dma-sg.ko b/shared/prebuilt-kernel/android-mainline/videobuf2-dma-sg.ko
new file mode 100644
index 0000000..c4146ef
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/videobuf2-dma-sg.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/videobuf2-memops.ko b/shared/prebuilt-kernel/android-mainline/videobuf2-memops.ko
new file mode 100644
index 0000000..7e232f5
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/videobuf2-memops.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/videobuf2-v4l2.ko b/shared/prebuilt-kernel/android-mainline/videobuf2-v4l2.ko
new file mode 100644
index 0000000..f453f44
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/videobuf2-v4l2.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/videobuf2-vmalloc.ko b/shared/prebuilt-kernel/android-mainline/videobuf2-vmalloc.ko
new file mode 100644
index 0000000..6493839
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/videobuf2-vmalloc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/videodev.ko b/shared/prebuilt-kernel/android-mainline/videodev.ko
new file mode 100644
index 0000000..b9348ed
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/videodev.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/vxlan.ko b/shared/prebuilt-kernel/android-mainline/vxlan.ko
new file mode 100644
index 0000000..828ace3
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/vxlan.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/wcd934x.ko b/shared/prebuilt-kernel/android-mainline/wcd934x.ko
new file mode 100644
index 0000000..0ee0b87
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/wcd934x.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/wcn36xx.ko b/shared/prebuilt-kernel/android-mainline/wcn36xx.ko
new file mode 100644
index 0000000..f517fb0
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/wcn36xx.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/wireguard.ko b/shared/prebuilt-kernel/android-mainline/wireguard.ko
new file mode 100644
index 0000000..453e934
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/wireguard.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/wm8994.ko b/shared/prebuilt-kernel/android-mainline/wm8994.ko
new file mode 100644
index 0000000..c14aa29
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/wm8994.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/xt_CHECKSUM.ko b/shared/prebuilt-kernel/android-mainline/xt_CHECKSUM.ko
new file mode 100644
index 0000000..4b0ea49
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/xt_CHECKSUM.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/xt_LOG.ko b/shared/prebuilt-kernel/android-mainline/xt_LOG.ko
new file mode 100644
index 0000000..01c6d25
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/xt_LOG.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/xt_addrtype.ko b/shared/prebuilt-kernel/android-mainline/xt_addrtype.ko
new file mode 100644
index 0000000..f95528a
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/xt_addrtype.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/xt_comment.ko b/shared/prebuilt-kernel/android-mainline/xt_comment.ko
new file mode 100644
index 0000000..a995d00
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/xt_comment.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/xt_ipvs.ko b/shared/prebuilt-kernel/android-mainline/xt_ipvs.ko
new file mode 100644
index 0000000..26a3ccd
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/xt_ipvs.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/xxhash_generic.ko b/shared/prebuilt-kernel/android-mainline/xxhash_generic.ko
new file mode 100644
index 0000000..a8bd136
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/xxhash_generic.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/zaurus.ko b/shared/prebuilt-kernel/android-mainline/zaurus.ko
new file mode 100644
index 0000000..cfeb2c2
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/zaurus.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/zram.ko b/shared/prebuilt-kernel/android-mainline/zram.ko
new file mode 100644
index 0000000..bd19d94
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/zram.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-mainline/zsmalloc.ko b/shared/prebuilt-kernel/android-mainline/zsmalloc.ko
new file mode 100644
index 0000000..21d4693
--- /dev/null
+++ b/shared/prebuilt-kernel/android-mainline/zsmalloc.ko
Binary files differ
diff --git a/shared/prebuilt-kernel/android-upstream/Image.gz b/shared/prebuilt-kernel/android-upstream/Image.gz
new file mode 100644
index 0000000..7560acf
--- /dev/null
+++ b/shared/prebuilt-kernel/android-upstream/Image.gz
Binary files differ
diff --git a/shared/prebuilt-kernel/android-upstream/sdm845-xiaomi-beryllium.dtb b/shared/prebuilt-kernel/android-upstream/sdm845-xiaomi-beryllium.dtb
new file mode 100644
index 0000000..d3e5340
--- /dev/null
+++ b/shared/prebuilt-kernel/android-upstream/sdm845-xiaomi-beryllium.dtb
Binary files differ
diff --git a/shared/seccomp_policy/mediaextractor.policy b/shared/seccomp_policy/mediaextractor.policy
new file mode 100644
index 0000000..cf7e427
--- /dev/null
+++ b/shared/seccomp_policy/mediaextractor.policy
@@ -0,0 +1,5 @@
+# device specific syscalls
+# extension of frameworks/av/services/mediaextractor/seccomp_policy/mediaextractor-arm64.policy
+uname: 1
+memfd_create: 1
+ftruncate: 1
diff --git a/shared/seccomp_policy/mediaswcodec.policy b/shared/seccomp_policy/mediaswcodec.policy
new file mode 100644
index 0000000..8b1f97b
--- /dev/null
+++ b/shared/seccomp_policy/mediaswcodec.policy
@@ -0,0 +1,4 @@
+# device specific syscalls
+# extension of frameworks/av/services/mediacodec/seccomp_policy/mediaswcodec-arm64.policy
+sysinfo: 1
+uname: 1
diff --git a/shared/sepolicy/app.te b/shared/sepolicy/app.te
new file mode 100644
index 0000000..890e6e6
--- /dev/null
+++ b/shared/sepolicy/app.te
@@ -0,0 +1,4 @@
+# Few system/untrusted_app_xx apps eg. deskclock,
+# gallery3d et al. need read-only access to /dev/dri
+# as well, otherwise they don't open and crash.
+gpu_access(appdomain -isolated_app)
diff --git a/shared/sepolicy/bootanim.te b/shared/sepolicy/bootanim.te
new file mode 100644
index 0000000..96fd94b
--- /dev/null
+++ b/shared/sepolicy/bootanim.te
@@ -0,0 +1,2 @@
+gpu_access(bootanim)
+allow bootanim hal_graphics_allocator_default_tmpfs:file { read write };
diff --git a/shared/sepolicy/crash_dump.te b/shared/sepolicy/crash_dump.te
new file mode 100644
index 0000000..1a979bf
--- /dev/null
+++ b/shared/sepolicy/crash_dump.te
@@ -0,0 +1,8 @@
+# audit2allow
+allow crash_dump bluetooth_data_file:file { getattr map open read };
+allow crash_dump bluetooth_prop:file { getattr map open };
+allow crash_dump device_config_runtime_native_boot_prop:file { getattr map open };
+allow crash_dump device_config_runtime_native_prop:file { getattr map open };
+allow crash_dump hwservicemanager_prop:file { getattr map open };
+allow crash_dump runtime_event_log_tags_file:file getattr;
+allow crash_dump resourcecache_data_file:file { getattr map open read };
diff --git a/shared/sepolicy/file.te b/shared/sepolicy/file.te
new file mode 100644
index 0000000..f259ca3
--- /dev/null
+++ b/shared/sepolicy/file.te
@@ -0,0 +1,9 @@
+type sysfs_gpu, fs_type, sysfs_type;
+type sysfs_lights, fs_type, sysfs_type;
+type sysfs_mss, fs_type, sysfs_type;
+type sysfs_rmtfs, fs_type, sysfs_type;
+type sysfs_remoteproc, fs_type, sysfs_type;
+type dri_device, dev_type;
+type rmtfs_device, dev_type;
+type modem_block_device, dev_type;
+type tqftpserv_vendor_data_file, file_type, data_file_type, mlstrustedobject;
diff --git a/shared/sepolicy/file_contexts b/shared/sepolicy/file_contexts
new file mode 100644
index 0000000..df8fa3c
--- /dev/null
+++ b/shared/sepolicy/file_contexts
@@ -0,0 +1,63 @@
+/dev/block/platform/soc@0/1d84000\.ufshc/by-name/fsc					u:object_r:modem_block_device:s0
+/dev/block/platform/soc@0/1d84000\.ufshc/by-name/fsg					u:object_r:modem_block_device:s0
+/dev/block/platform/soc@0/1d84000\.ufshc/by-name/modemst[12]				u:object_r:modem_block_device:s0
+/dev/block/platform/soc@0/1d84000\.ufshc/by-name/userdata				u:object_r:userdata_block_device:s0
+
+/dev/dri										u:object_r:dri_device:s0
+/dev/dri/card0										u:object_r:graphics_device:s0
+/dev/dri/renderD128									u:object_r:gpu_device:s0
+/dev/input/.*										u:object_r:input_device:s0
+/dev/qcom_rmtfs_mem1									u:object_r:rmtfs_device:s0
+/dev/ttyMSM0										u:object_r:console_device:s0
+
+/sys/(/.*)?										u:object_r:sysfs:s0
+
+/sys/bus/platform/drivers/qcom-q6v5-mss							u:object_r:sysfs_mss:s0
+/sys/devices/platform/f6301000.memory/rmtfs						u:object_r:sysfs_rmtfs:s0
+
+/sys/devices/platform/soc@0/4080000.remoteproc						u:object_r:sysfs_remoteproc:s0
+/sys/devices/platform/soc@0/ae00000.mdss						u:object_r:sysfs_gpu:s0
+/sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000/rtc	u:object_r:sysfs_rtc:s0
+
+/sys/class/backlight(/.*)?								u:object_r:sysfs_lights:s0
+/sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-03/c440000.spmi:pmic@3:leds@d800/backlight	u:object_r:sysfs_lights:s0
+
+/sys/class/power_supply(/.*)?								u:object_r:sysfs_power:s0
+/sys/devices/platform/soc@0/.*/power_supply(/.*)?					u:object_r:sysfs_power:s0
+
+/sys/class/remoteproc									u:object_r:sysfs_remoteproc:s0
+/sys/devices/platform/remoteproc-adsp/remoteproc					u:object_r:sysfs_remoteproc:s0
+/sys/devices/platform/remoteproc-cdsp/remoteproc					u:object_r:sysfs_remoteproc:s0
+
+/sys/devices/platform/soc@0/.*/wakeup(/.*)?						u:object_r:sysfs_wakeup:s0
+
+/data/vendor/tmp(/.*)?									u:object_r:tqftpserv_vendor_data_file:s0
+/data/vendor/readwrite(/.*)?								u:object_r:tqftpserv_vendor_data_file:s0
+/data/vendor/readonly(/.*)?								u:object_r:tqftpserv_vendor_data_file:s0
+
+/system/bin/tinymix									u:object_r:tinymix_exec:s0
+/system/bin/set_wlan_mac\.sh								u:object_r:set_wlan_mac_exec:s0
+
+/vendor/bin/hw/android\.hardware\.gatekeeper@1\.0-service\.software			u:object_r:hal_gatekeeper_default_exec:s0
+/vendor/bin/hw/android\.hardware\.graphics\.allocator@4\.0-service\.minigbm_msm		u:object_r:hal_graphics_allocator_default_exec:s0
+/vendor/bin/hw/android\.hardware\.vibrator@1\.1-service\.sdm845				u:object_r:hal_vibrator_default_exec:s0
+/vendor/bin/hw/android\.hardware\.light@2\.0-service					u:object_r:hal_light_default_exec:s0
+/vendor/bin/hw/android.hardware.vibrator@1.1-service.ff					u:object_r:hal_vibrator_default_exec:s0
+/vendor/bin/pd-mapper									u:object_r:pd_mapper_exec:s0
+/vendor/bin/qrtr-cfg									u:object_r:qrtr_exec:s0
+/vendor/bin/qrtr-ns									u:object_r:qrtr_exec:s0
+/vendor/bin/rmtfs									u:object_r:rmtfs_exec:s0
+/vendor/bin/tqftpserv									u:object_r:tqftpserv_exec:s0
+
+/vendor/lib(64)?/dri/.*									u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/hw/gralloc\.gbm\.so							u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/hw/android\.hardware\.health@2\.0-impl-2\.1-cuttlefish\.so		u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/hw/gralloc\.minigbm_msm\.so						u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/hw/android\.hardware\.graphics\.mapper@4\.0-impl\.minigbm_msm\.so	u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libdrm\.so								u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libdrm_freedreno\.so							u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libgbm_mesa\.so							u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libglapi\.so								u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libminigbm_gralloc_msm\.so						u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libqrtr\.so								u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/hw/android\.hardware\.health@2\.0-impl-2\.1-sdm845\.so			u:object_r:same_process_hal_file:s0
diff --git a/shared/sepolicy/fsck.te b/shared/sepolicy/fsck.te
new file mode 100644
index 0000000..8bd61e7
--- /dev/null
+++ b/shared/sepolicy/fsck.te
@@ -0,0 +1 @@
+allow fsck sysfs_power:dir search;
diff --git a/shared/sepolicy/genfs_contexts b/shared/sepolicy/genfs_contexts
new file mode 100644
index 0000000..3599651
--- /dev/null
+++ b/shared/sepolicy/genfs_contexts
@@ -0,0 +1,15 @@
+genfscon sysfs   /devices/platform/88f00000.memory/rmtfs					u:object_r:sysfs_rmtfs:s0 # Axolotl
+genfscon sysfs   /devices/platform/f6301000.memory/rmtfs					u:object_r:sysfs_rmtfs:s0 # Beryllium
+genfscon sysfs   /devices/platform/f5b01000.memory/rmtfs					u:object_r:sysfs_rmtfs:s0 # Enchilada
+genfscon sysfs   /devices/platform/88f00000.rmtfs/rmtfs						u:object_r:sysfs_rmtfs:s0 # Axolotl
+genfscon sysfs   /devices/platform/f6301000.rmtfs/rmtfs						u:object_r:sysfs_rmtfs:s0 # Beryllium
+genfscon sysfs   /devices/platform/f5b01000.rmtfs-mem/rmtfs					u:object_r:sysfs_rmtfs:s0 # Enchilada
+genfscon sysfs   /devices/platform/remoteproc-adsp/remoteproc					u:object_r:sysfs_remoteproc:s0
+genfscon sysfs   /devices/platform/remoteproc-cdsp/remoteproc					u:object_r:sysfs_remoteproc:s0
+genfscon sysfs   /devices/platform/soc@0/4080000.remoteproc					u:object_r:sysfs_remoteproc:s0
+genfscon sysfs   /devices/platform/soc@0/ae00000.mdss						u:object_r:sysfs_gpu:s0
+genfscon sysfs   /devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000	u:object_r:sysfs_rtc:s0
+genfscon sysfs   /devices/platform/soc@0/c440000.spmi/spmi-0/0-02/c440000.spmi:pmic@2:fuel-gauge@4000/power_supply	u:object_r:sysfs_power:s0
+genfscon sysfs   /devices/platform/soc@0/c440000.spmi/spmi-0/0-02/c440000.spmi:pmic@2:charger@1000/power_supply/	u:object_r:sysfs_power:s0
+genfscon sysfs   /sys/devices/platform/soc@0/ac0000.geniqup/a88000.i2c/i2c-10/10-0055/power_supply			u:object_r:sysfs_power:s0 # Enchilada BQ27411
+genfscon sysfs   /devices/platform/soc@0/c440000.spmi/spmi-0/0-03/c440000.spmi:pmic@3:leds@d800/backlight		u:object_r:sysfs_lights:s0
diff --git a/shared/sepolicy/hal_drm_default.te b/shared/sepolicy/hal_drm_default.te
new file mode 100644
index 0000000..e783575
--- /dev/null
+++ b/shared/sepolicy/hal_drm_default.te
@@ -0,0 +1,2 @@
+# audit2allow
+allow hal_drm_default vndbinder_device:chr_file rw_file_perms;
diff --git a/shared/sepolicy/hal_graphics_allocator_default.te b/shared/sepolicy/hal_graphics_allocator_default.te
new file mode 100644
index 0000000..00f38cc
--- /dev/null
+++ b/shared/sepolicy/hal_graphics_allocator_default.te
@@ -0,0 +1 @@
+gpu_access(hal_graphics_allocator_default)
diff --git a/shared/sepolicy/hal_graphics_composer.te b/shared/sepolicy/hal_graphics_composer.te
new file mode 100644
index 0000000..cc45ebf
--- /dev/null
+++ b/shared/sepolicy/hal_graphics_composer.te
@@ -0,0 +1,3 @@
+allow hal_graphics_composer_server hal_graphics_allocator_default_tmpfs:file read;
+
+gpu_access(hal_graphics_composer_server)
diff --git a/shared/sepolicy/hal_graphics_composer_default.te b/shared/sepolicy/hal_graphics_composer_default.te
new file mode 100644
index 0000000..aca7085
--- /dev/null
+++ b/shared/sepolicy/hal_graphics_composer_default.te
@@ -0,0 +1,9 @@
+hal_client_domain(hal_graphics_composer_default, hal_graphics_allocator);
+vndbinder_use(hal_graphics_composer_default)
+
+allow hal_graphics_composer_default self:netlink_kobject_uevent_socket { bind create read };
+allow hal_graphics_composer_default hal_graphics_allocator_default_tmpfs:file write;
+
+# Suppress warnings for drm_hwcomposer trying to read some vendor.hwc.*
+# properties as dragonboard never configures these properties.
+dontaudit hal_graphics_composer_default default_prop:file read;
diff --git a/shared/sepolicy/hal_health_default.te b/shared/sepolicy/hal_health_default.te
new file mode 100644
index 0000000..26a64ca
--- /dev/null
+++ b/shared/sepolicy/hal_health_default.te
@@ -0,0 +1,5 @@
+
+allow hal_health_default sysfs_power:file { read open write getattr };
+allow hal_health_default sysfs:file { read open write };
+allow hal_health_default sysfs_power:lnk_file { read };
+allow hal_health_default sysfs_power:dir { open search read };
diff --git a/shared/sepolicy/hal_light_default.te b/shared/sepolicy/hal_light_default.te
new file mode 100644
index 0000000..c8483af
--- /dev/null
+++ b/shared/sepolicy/hal_light_default.te
@@ -0,0 +1,6 @@
+# audit2allow
+allow hal_light_default sysfs_lights:file { read open write };
+allow hal_light_default sysfs_lights:lnk_file { read };
+allow hal_light_default sysfs_gpu:dir { search };
+allow hal_light_default sysfs_gpu:file { read open write };
+allow hal_light_default sysfs_lights:dir { open search read };
diff --git a/shared/sepolicy/hal_memtrack.te b/shared/sepolicy/hal_memtrack.te
new file mode 100644
index 0000000..51bd527
--- /dev/null
+++ b/shared/sepolicy/hal_memtrack.te
@@ -0,0 +1,4 @@
+# Memtrack reads proc/<pid>/cmdline to check if process is surfaceflinger.
+# Grant access if that's the case; don't log denials for other processes.
+allow hal_memtrack surfaceflinger:file read;
+dontaudit hal_memtrack { domain -surfaceflinger}:file read;
diff --git a/shared/sepolicy/hal_vibrator.te b/shared/sepolicy/hal_vibrator.te
new file mode 100644
index 0000000..cca0a1d
--- /dev/null
+++ b/shared/sepolicy/hal_vibrator.te
@@ -0,0 +1,12 @@
+# Vibrator HAL scans input devices to find the haptics device
+# it then calls ioctls on it.
+init_daemon_domain(hal_vibrator_default);
+
+allow hal_vibrator_default input_device:chr_file { ioctl open read write };
+# EVIOCGBIT + EV_FF
+allowxperm hal_vibrator_default input_device:chr_file ioctl 0x4535;
+# EVIOCSFF
+allowxperm hal_vibrator_default input_device:chr_file ioctl 0x4580;
+# EVIOCRMFF
+allowxperm hal_vibrator_default input_device:chr_file ioctl 0x4581;
+allow hal_vibrator_default input_device:dir { open read search };
\ No newline at end of file
diff --git a/shared/sepolicy/hal_wifi_supplicant_default.te b/shared/sepolicy/hal_wifi_supplicant_default.te
new file mode 100644
index 0000000..c657db5
--- /dev/null
+++ b/shared/sepolicy/hal_wifi_supplicant_default.te
@@ -0,0 +1,6 @@
+# TODO(b/36657258): Remove data_between_core_and_vendor_violators once
+# hal_wifi_supplicant no longer directly accesses wifi_data_file.
+typeattribute hal_wifi_supplicant_default data_between_core_and_vendor_violators;
+
+allow hal_wifi_supplicant_default wifi_data_file:dir create_dir_perms;
+allow hal_wifi_supplicant_default wifi_data_file:file create_file_perms;
diff --git a/shared/sepolicy/kernel.te b/shared/sepolicy/kernel.te
new file mode 100644
index 0000000..3fad122
--- /dev/null
+++ b/shared/sepolicy/kernel.te
@@ -0,0 +1,7 @@
+# audit2allow
+allow kernel device:chr_file { create setattr };
+allow kernel device:dir { add_name create write };
+allow kernel self:capability mknod;
+allow kernel vendor_file:file { open read };
+allow kernel self:system module_request;
+allow vendor_init kernel:system module_request;
diff --git a/shared/sepolicy/mediacodec.te b/shared/sepolicy/mediacodec.te
new file mode 100644
index 0000000..6119c90
--- /dev/null
+++ b/shared/sepolicy/mediacodec.te
@@ -0,0 +1 @@
+gpu_access(mediacodec)
diff --git a/shared/sepolicy/mediaserver.te b/shared/sepolicy/mediaserver.te
new file mode 100644
index 0000000..922af2c
--- /dev/null
+++ b/shared/sepolicy/mediaserver.te
@@ -0,0 +1 @@
+gpu_access(mediaserver)
diff --git a/shared/sepolicy/mediaswcodec.te b/shared/sepolicy/mediaswcodec.te
new file mode 100644
index 0000000..57fb75c
--- /dev/null
+++ b/shared/sepolicy/mediaswcodec.te
@@ -0,0 +1,2 @@
+gpu_access(mediaswcodec)
+allow mediaswcodec gpu_device:chr_file { getattr ioctl map open read write };
diff --git a/shared/sepolicy/memfd.te b/shared/sepolicy/memfd.te
new file mode 100644
index 0000000..be64644
--- /dev/null
+++ b/shared/sepolicy/memfd.te
@@ -0,0 +1,28 @@
+# audit2allow
+
+#============= audioserver ==============
+allow audioserver system_server_tmpfs:file { map read write };
+allow audioserver tmpfs:file { map read write };
+
+#============= hal_audio_default ==============
+allow hal_audio_default tmpfs:file { getattr map read write };
+
+#============= mediaextractor ==============
+allow mediaextractor logd:unix_stream_socket connectto;
+allow mediaextractor logdr_socket:sock_file write;
+
+#============= mediaserver ==============
+allow mediaserver audioserver_tmpfs:file { map read write };
+allow mediaserver tmpfs:file { map read write };
+
+#============= mediaswcodec ==============
+allow mediaswcodec appdomain_tmpfs:file { map read write };
+allow mediaswcodec logd:unix_stream_socket connectto;
+allow mediaswcodec logdr_socket:sock_file write;
+allow mediaswcodec mediaserver_tmpfs:file { map read write };
+allow mediaswcodec system_server_tmpfs:file { map read write };
+allow mediaswcodec tmpfs:file { getattr map read write };
+
+#============= system_server ==============
+allow system_server audioserver_tmpfs:file { map read write };
+allow system_server tmpfs:file { map read write };
diff --git a/shared/sepolicy/pd_mapper.te b/shared/sepolicy/pd_mapper.te
new file mode 100644
index 0000000..597d7db
--- /dev/null
+++ b/shared/sepolicy/pd_mapper.te
@@ -0,0 +1,8 @@
+type pd_mapper, domain;
+
+type pd_mapper_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(pd_mapper);
+
+allow pd_mapper self:qipcrtr_socket { create getattr read setopt write };
+allow pd_mapper sysfs_remoteproc:dir { open read search };
+allow pd_mapper sysfs_remoteproc:file { open read };
diff --git a/shared/sepolicy/platform_app.te b/shared/sepolicy/platform_app.te
new file mode 100644
index 0000000..125db4c
--- /dev/null
+++ b/shared/sepolicy/platform_app.te
@@ -0,0 +1,3 @@
+allow platform_app hal_graphics_allocator_default_tmpfs:file { read write };
+
+gpu_access(platform_app)
diff --git a/shared/sepolicy/priv_app.te b/shared/sepolicy/priv_app.te
new file mode 100644
index 0000000..be01a5a
--- /dev/null
+++ b/shared/sepolicy/priv_app.te
@@ -0,0 +1,3 @@
+allow priv_app hal_graphics_allocator_default_tmpfs:file { read write };
+
+gpu_access(priv_app)
diff --git a/shared/sepolicy/qrtr.te b/shared/sepolicy/qrtr.te
new file mode 100644
index 0000000..8344398
--- /dev/null
+++ b/shared/sepolicy/qrtr.te
@@ -0,0 +1,8 @@
+type qrtr, domain;
+type qrtr_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(qrtr)
+
+allow qrtr self:capability net_admin;
+allow qrtr self:capability sys_admin;
+allow qrtr self:qipcrtr_socket create_socket_perms_no_ioctl;
+allow qrtr self:netlink_route_socket { create nlmsg_write read write };
diff --git a/shared/sepolicy/rmtfs.te b/shared/sepolicy/rmtfs.te
new file mode 100644
index 0000000..b35b940
--- /dev/null
+++ b/shared/sepolicy/rmtfs.te
@@ -0,0 +1,15 @@
+type rmtfs, domain;
+type rmtfs_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(rmtfs)
+
+allow rmtfs block_device:dir search;
+allow rmtfs modem_block_device:blk_file { open read };
+allow rmtfs rmtfs_device:chr_file { open read write };
+allow rmtfs self:capability net_admin;
+allow rmtfs self:qipcrtr_socket { bind create getattr read setopt write };
+allow rmtfs sysfs_mss:dir { open read search };
+allow rmtfs sysfs_remoteproc:dir { open read search };
+allow rmtfs sysfs_remoteproc:file { open read write };
+allow rmtfs sysfs_rmtfs:dir search;
+allow rmtfs sysfs_rmtfs:file { open read };
diff --git a/shared/sepolicy/set_wlan_mac.te b/shared/sepolicy/set_wlan_mac.te
new file mode 100644
index 0000000..ff34638
--- /dev/null
+++ b/shared/sepolicy/set_wlan_mac.te
@@ -0,0 +1,15 @@
+type set_wlan_mac, domain, coredomain;
+type set_wlan_mac_exec, exec_type, system_file_type, file_type;
+init_daemon_domain(set_wlan_mac);
+
+allow set_wlan_mac proc_cmdline:file { open read };
+allow set_wlan_mac rootfs:dir { open read };
+allow set_wlan_mac self:capability net_admin;
+allow set_wlan_mac self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_readpriv nlmsg_write read setopt write };
+allow set_wlan_mac self:udp_socket { create ioctl };
+allow set_wlan_mac shell_exec:file { execute getattr map read };
+allow set_wlan_mac system_file:file execute_no_trans;
+allow set_wlan_mac toolbox_exec:file { execute execute_no_trans getattr map open read };
+allow set_wlan_mac system_data_root_file:file { getattr open read };
+allow set_wlan_mac net_data_file:dir search;
+allow set_wlan_mac self:capability sys_module;
\ No newline at end of file
diff --git a/shared/sepolicy/surfaceflinger.te b/shared/sepolicy/surfaceflinger.te
new file mode 100644
index 0000000..7b5d737
--- /dev/null
+++ b/shared/sepolicy/surfaceflinger.te
@@ -0,0 +1,2 @@
+gpu_access(surfaceflinger)
+allow surfaceflinger hal_graphics_allocator_default_tmpfs:file { read write };
diff --git a/shared/sepolicy/system_app.te b/shared/sepolicy/system_app.te
new file mode 100644
index 0000000..6a2112d
--- /dev/null
+++ b/shared/sepolicy/system_app.te
@@ -0,0 +1,3 @@
+allow system_app hal_graphics_allocator_default_tmpfs:file { read write };
+
+gpu_access(system_app)
diff --git a/shared/sepolicy/system_server.te b/shared/sepolicy/system_server.te
new file mode 100644
index 0000000..d9a25f9
--- /dev/null
+++ b/shared/sepolicy/system_server.te
@@ -0,0 +1,3 @@
+allow system_server hal_graphics_allocator_default_tmpfs:file { read write };
+
+gpu_access(system_server)
diff --git a/shared/sepolicy/te_macros b/shared/sepolicy/te_macros
new file mode 100644
index 0000000..a50bec1
--- /dev/null
+++ b/shared/sepolicy/te_macros
@@ -0,0 +1,10 @@
+#####################################
+# gpu_access(client_domain)
+# Allow client_domain to communicate with the GPU
+define(`gpu_access', `
+allow $1 dri_device:dir { open read search };
+allow $1 sysfs_gpu:dir search;
+allow $1 gpu_device:chr_file { getattr ioctl map open read write };
+allow $1 graphics_device:chr_file { getattr };
+allow $1 sysfs_gpu:file { getattr open read };
+')
diff --git a/shared/sepolicy/tinymix.te b/shared/sepolicy/tinymix.te
new file mode 100644
index 0000000..75dc071
--- /dev/null
+++ b/shared/sepolicy/tinymix.te
@@ -0,0 +1,7 @@
+type tinymix, domain, coredomain;
+type tinymix_exec, exec_type, system_file_type, file_type;
+
+init_daemon_domain(tinymix)
+
+allow tinymix audio_device:chr_file { ioctl open read write };
+allow tinymix audio_device:dir search;
diff --git a/shared/sepolicy/tqftpserv.te b/shared/sepolicy/tqftpserv.te
new file mode 100644
index 0000000..6838c12
--- /dev/null
+++ b/shared/sepolicy/tqftpserv.te
@@ -0,0 +1,10 @@
+type tqftpserv, domain;
+
+type tqftpserv_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(tqftpserv);
+
+allow tqftpserv self:qipcrtr_socket { connect create getattr read setopt write };
+allow tqftpserv sysfs_remoteproc:dir { open read search };
+allow tqftpserv sysfs_remoteproc:file { open read };
+allow tqftpserv tqftpserv_vendor_data_file:dir { add_name create open read search write };
+allow tqftpserv tqftpserv_vendor_data_file:file { create getattr open read write };
diff --git a/shared/ueventd.common.rc b/shared/ueventd.common.rc
new file mode 100644
index 0000000..1cd2a14
--- /dev/null
+++ b/shared/ueventd.common.rc
@@ -0,0 +1,16 @@
+modalias_handling enabled
+
+/dev/sw_sync              0660   root       graphics
+
+# gpu
+/dev/dri/card0 0660 system graphics
+/dev/dri/renderD128 0666 system graphics
+
+# media.codec2
+/dev/ion 0664 system system
+
+# Input devices
+/dev/input/* 0660 system input
+
+# Backlights
+/sys/class/backlight/* brightness 0660 system system
\ No newline at end of file
diff --git a/shared/vendor/init.vendor.rc b/shared/vendor/init.vendor.rc
new file mode 100644
index 0000000..f97b502
--- /dev/null
+++ b/shared/vendor/init.vendor.rc
@@ -0,0 +1,48 @@
+service qrtr-ns /vendor/bin/qrtr-ns -f 1
+    class core
+    user root
+    group system
+    disabled
+    oneshot
+
+service pd_mapper /vendor/bin/pd-mapper
+    class core
+    user root
+    group system
+    disabled
+    oneshot
+
+service tqftpserv /vendor/bin/tqftpserv
+    class core
+    user root
+    group system
+    disabled
+    oneshot
+
+service rmtfs /vendor/bin/rmtfs -o /dev/block/platform/soc@0/1d84000.ufshc/by-name -P -r -s
+    class core
+    user root
+    group system
+    disabled
+    oneshot
+
+on early-init
+    exec - root -- /vendor/bin/qrtr-cfg 1
+    start qrtr-ns
+
+on post-fs
+    start pd_mapper
+
+on post-fs-data
+    mkdir /data/vendor
+    mkdir /data/vendor/tmp
+    mkdir /data/vendor/readwrite
+    mkdir /data/vendor/readonly
+    mkdir /data/vendor/readonly/firmware
+    mkdir /data/vendor/readonly/firmware/image
+    write /sys/class/firmware/timeout 1
+    start tqftpserv
+    start rmtfs
+
+on shutdown
+    stop rmtfs
diff --git a/shared/vendor/pd-mapper/Android.bp b/shared/vendor/pd-mapper/Android.bp
new file mode 100644
index 0000000..3bdbc32
--- /dev/null
+++ b/shared/vendor/pd-mapper/Android.bp
@@ -0,0 +1,11 @@
+cc_binary {
+    name: "pd-mapper",
+    vendor: true,
+    srcs: [
+	"pd-mapper.c",
+	"assoc.c",
+	"json.c",
+	"servreg_loc.c",
+    ],
+    shared_libs: ["libqrtr"],
+}
diff --git a/shared/vendor/pd-mapper/LICENSE b/shared/vendor/pd-mapper/LICENSE
new file mode 100644
index 0000000..aa8cb35
--- /dev/null
+++ b/shared/vendor/pd-mapper/LICENSE
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ * Copyright (c) 2016, Bjorn Andersson <bjorn@kryo.se>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
diff --git a/shared/vendor/pd-mapper/Makefile b/shared/vendor/pd-mapper/Makefile
new file mode 100644
index 0000000..908dbfd
--- /dev/null
+++ b/shared/vendor/pd-mapper/Makefile
@@ -0,0 +1,28 @@
+PD_MAPPER := pd-mapper
+
+CFLAGS := -Wall -g -O2
+LDFLAGS := -lqrtr
+
+prefix ?= /usr/local
+bindir := $(prefix)/bin
+servicedir := $(prefix)/lib/systemd/system
+
+SRCS := pd-mapper.c \
+        assoc.c \
+        json.c \
+	servreg_loc.c
+
+OBJS := $(SRCS:.c=.o)
+
+$(PD_MAPPER): $(OBJS)
+	$(CC) -o $@ $^ $(LDFLAGS)
+
+pd-mapper.service: pd-mapper.service.in
+	@sed 's+PD_MAPPER_PATH+$(bindir)+g' $< > $@
+
+install: $(PD_MAPPER) pd-mapper.service
+	@install -D -m 755 $(PD_MAPPER) $(DESTDIR)$(bindir)/$(PD_MAPPER)
+	@install -D -m 644 pd-mapper.service $(DESTDIR)$(servicedir)/pd-mapper.service
+
+clean:
+	rm -f $(PD_MAPPER) $(OBJS) pd-mapper.service
diff --git a/shared/vendor/pd-mapper/assoc.c b/shared/vendor/pd-mapper/assoc.c
new file mode 100644
index 0000000..460f0d0
--- /dev/null
+++ b/shared/vendor/pd-mapper/assoc.c
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2013, Bjorn Andersson <bjorn@kryo.se>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "assoc.h"
+
+static unsigned long assoc_hash(const char *value)
+{
+	unsigned long hash = 0;
+	unsigned long g;
+	const char *v = value;
+
+	while (*v) {
+		hash = (hash << 4) + *(v++);
+		g = hash & 0xF0000000L;
+		if (g)
+			hash ^= g >> 24;
+		hash &= ~g;
+	}
+
+	return hash;
+}
+
+void assoc_init(struct assoc *assoc, unsigned long size)
+{
+	assert(size > 0);
+
+	assoc->size = size;
+	assoc->fill = 0;
+	assoc->keys = calloc(size, sizeof(const char *));
+	assoc->values = malloc(size * sizeof(void *));
+}
+
+void *assoc_get(struct assoc *assoc, const char *key)
+{
+	unsigned long hash;
+
+	hash = assoc_hash(key) % assoc->size;
+	while (assoc->keys[hash]) {
+		if (!strcmp(assoc->keys[hash], key))
+			return assoc->values[hash];
+
+		hash = (hash + 1) % assoc->size;
+	}
+
+	return NULL;
+}
+
+static void _assoc_set(struct assoc *assoc, const char *key, void *value)
+{
+	struct assoc new_set;
+	unsigned long hash;
+	unsigned long i;
+
+	assert(assoc->fill < assoc->size);
+
+	/* Grow set at 80% utilization */
+	if (5 * assoc->fill > 4 * assoc->size) {
+		assoc_init(&new_set, assoc->size * 5 / 4);
+
+		for (i = 0; i < assoc->size; i++)
+			if (assoc->keys[i])
+				assoc_set(&new_set, assoc->keys[i],
+					  assoc->values[i]);
+
+		free(assoc->keys);
+		free(assoc->values);
+
+		assoc->keys = new_set.keys;
+		assoc->values = new_set.values;
+		assoc->fill = new_set.fill;
+		assoc->size = new_set.size;
+	}
+
+	hash = assoc_hash(key) % assoc->size;
+	while (assoc->keys[hash]) {
+		if (!strcmp(assoc->keys[hash], key)) {
+			assoc->values[hash] = value;
+			return;
+		}
+
+		hash = (hash + 1) % assoc->size;
+	}
+
+	assoc->keys[hash] = key;
+	assoc->values[hash] = value;
+	assoc->fill++;
+}
+
+void assoc_set(struct assoc *assoc, const char *key, void *value)
+{
+	_assoc_set(assoc, strdup(key), value);
+}
+
+const char *assoc_next(struct assoc *assoc, void **value, unsigned long *iter)
+{
+	unsigned long it = *iter;
+
+	while (it < assoc->size && !assoc->keys[it])
+		it++;
+
+	if (it == assoc->size)
+		return NULL;
+
+	*iter = it + 1;
+
+	if (it < assoc->size) {
+		if (value)
+			*value = assoc->values[it];
+		return assoc->keys[it];
+	} else {
+		return NULL;
+	}
+}
+
+void assoc_destroy(struct assoc *assoc)
+{
+	unsigned long i;
+
+	for (i = 0; i < assoc->size; i++)
+		free((void*)assoc->keys[i]);
+
+	free(assoc->keys);
+	free(assoc->values);
+	assoc->size = 0;
+}
diff --git a/shared/vendor/pd-mapper/assoc.h b/shared/vendor/pd-mapper/assoc.h
new file mode 100644
index 0000000..25d00fa
--- /dev/null
+++ b/shared/vendor/pd-mapper/assoc.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2013, Bjorn Andersson <bjorn@kryo.se>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __ASSOC_H__
+#define __ASSOC_H__
+
+struct assoc {
+	unsigned long size;
+	unsigned long fill;
+
+	const char **keys;
+	void **values;
+};
+
+void assoc_init(struct assoc *assoc, unsigned long size);
+void *assoc_get(struct assoc *assoc, const char *key);
+void assoc_set(struct assoc *assoc, const char *key, void *value);
+const char *assoc_next(struct assoc *assoc, void **value, unsigned long *iter);
+void assoc_destroy(struct assoc *assoc);
+
+#define assoc_foreach(key, value, assoc, iter) \
+	for ((iter) = 0, (key) = assoc_next((assoc), (value), &(iter)); \
+	     (key); \
+	     (key) = assoc_next((assoc), (value), &(iter)))
+
+#endif
diff --git a/shared/vendor/pd-mapper/json.c b/shared/vendor/pd-mapper/json.c
new file mode 100644
index 0000000..e08afa4
--- /dev/null
+++ b/shared/vendor/pd-mapper/json.c
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2018-2019, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/stat.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "json.h"
+
+static const char *input_buf;
+static int input_pos;
+static int input_len;
+
+static int json_parse_array(struct json_value *array);
+static int json_parse_object(struct json_value *object);
+static int json_parse_property(struct json_value *value);
+
+static int input(void)
+{
+	if (input_pos >= input_len)
+		return 0;
+
+	return input_buf[input_pos++];
+}
+
+static void unput(void)
+{
+	input_pos--;
+}
+
+static void json_skip_whitespace(void)
+{
+	int ch;
+
+	while ((ch = input()) && isspace(ch))
+		;
+	unput();
+}
+
+static int json_parse_string(struct json_value *value)
+{
+	char buf[128];
+	char *b = buf;
+	int ch;
+
+	ch = input();
+	if (ch != '"') {
+		unput();
+		return 0;
+	}
+
+	while ((ch = input()) && ch != '"' && b - buf < sizeof(buf) - 1)
+		*b++ = ch;
+	*b = '\0';
+
+	if (!ch)
+		return -1;
+
+	value->type = JSON_TYPE_STRING;
+	value->u.string = strdup(buf);
+
+	return 1;
+}
+
+static int json_parse_number(struct json_value *value)
+{
+	char buf[20];
+	char *b = buf;
+	int ch;
+
+	while ((ch = input()) && isdigit(ch) && b - buf < sizeof(buf) - 1)
+		*b++ = ch;
+	*b = '\0';
+	unput();
+
+	if (b == buf)
+		return 0;
+
+	value->type = JSON_TYPE_NUMBER;
+	value->u.number = strtod(buf, NULL);
+
+	return 1;
+}
+
+static int json_parse_keyword(struct json_value *value)
+{
+	const char *match;
+	const char *m;
+	int ch;
+
+	ch = input();
+	switch (ch) {
+	case 't':
+		match = "true";
+		value->type = JSON_TYPE_TRUE;
+		break;
+	case 'f':
+		match = "false";
+		value->type = JSON_TYPE_FALSE;
+		break;
+	case 'n':
+		match = "null";
+		value->type = JSON_TYPE_NULL;
+		break;
+	default:
+		unput();
+		return 0;
+	}
+
+	m = match;
+	while (*m && *m++ == ch)
+		ch = input();
+	unput();
+
+	return *m == '\0' ? 1 : -1;
+}
+
+static int json_parse_value(struct json_value *value)
+{
+	int ret;
+
+	json_skip_whitespace();
+
+	ret = json_parse_object(value);
+	if (ret)
+		goto out;
+
+	ret = json_parse_array(value);
+	if (ret)
+		goto out;
+
+	ret = json_parse_string(value);
+	if (ret)
+		goto out;
+
+	ret = json_parse_number(value);
+	if (ret)
+		goto out;
+
+	ret = json_parse_keyword(value);
+	if (ret)
+		goto out;
+
+	fprintf(stderr, "unable to match a value\n");
+	return -1;
+
+out:
+	json_skip_whitespace();
+	return ret;
+}
+
+static int json_parse_array(struct json_value *array)
+{
+	struct json_value *value;
+	struct json_value *last = NULL;
+	int ret;
+	int ch;
+
+	ch = input();
+	if (ch != '[') {
+		unput();
+		return 0;
+	}
+
+	array->type = JSON_TYPE_ARRAY;
+	do {
+		value = calloc(1, sizeof(*value));
+		if (!value)
+			return -1;
+
+		ret = json_parse_value(value);
+		if (ret <= 0) {
+			free(value);
+			return -1;
+		}
+
+		if (!array->u.value)
+			array->u.value = value;
+		if (last)
+			last->next = value;
+		last = value;
+
+		ch = input();
+		if (ch == ']') {
+			return 1;
+		}
+
+	} while (ch == ',');
+
+	fprintf(stderr, "expected ',' got '%c'\n", ch);
+
+	return -1;
+}
+
+static int json_parse_object(struct json_value *object)
+{
+	struct json_value *value;
+	struct json_value *last = NULL;
+	int ret;
+	int ch;
+
+	ch = input();
+	if (ch != '{') {
+		unput();
+		return 0;
+	}
+
+	object->type = JSON_TYPE_OBJECT;
+
+	do {
+		value = calloc(1, sizeof(*value));
+		if (!value)
+			return -1;
+
+		ret = json_parse_property(value);
+		if (ret <= 0) {
+			free(value);
+			return -1;
+		}
+
+		if (!object->u.value)
+			object->u.value = value;
+		if (last)
+			last->next = value;
+		last = value;
+
+		ch = input();
+		if (ch == '}') {
+			return 1;
+		}
+	} while (ch == ',');
+
+	return -1;
+}
+
+static int json_parse_property(struct json_value *value)
+{
+	struct json_value key;
+	int ret;
+	int ch;
+
+	json_skip_whitespace();
+
+	ret = json_parse_string(&key);
+	if (ret <= 0)
+		return -1;
+
+	value->key = key.u.string;
+
+	json_skip_whitespace();
+
+	ch = input();
+	if (ch != ':')
+		return -1;
+
+	ret = json_parse_value(value);
+	if (ret <= 0)
+		return -1;
+
+	return 1;
+}
+
+struct json_value *json_parse(const char *json)
+{
+	struct json_value *root;
+	int ret;
+
+	input_buf = json;
+	input_pos = 0;
+	input_len = strlen(input_buf);
+
+	root = calloc(1, sizeof(*root));
+	if (!root)
+		return NULL;
+
+	ret = json_parse_value(root);
+	if (ret != 1) {
+		free(root);
+		return NULL;
+	}
+
+	return root;
+}
+
+struct json_value *json_parse_file(const char *file)
+{
+	struct json_value *root;
+	struct stat sb;
+	int ret;
+	int fd;
+
+	fd = open(file, O_RDONLY);
+	if (fd < 0) {
+		fprintf(stderr, "failed to open %s: %s\n", file, strerror(errno));
+		return NULL;
+	}
+
+	ret = fstat(fd, &sb);
+	if (ret < 0)
+		return NULL;
+
+	input_pos = 0;
+	input_len = sb.st_size;
+	input_buf = malloc(sb.st_size);
+
+	ret = read(fd, (char *)input_buf, input_len);
+
+	close(fd);
+
+	if (ret != input_len) {
+		fprintf(stderr, "failed to read %d bytes form %s\n", input_len, file);
+		return NULL;
+	}
+
+	root = calloc(1, sizeof(*root));
+	if (!root)
+		return NULL;
+
+	ret = json_parse_value(root);
+	if (ret != 1) {
+		json_free(root);
+		return NULL;
+	}
+
+	return root;
+}
+
+struct json_value *json_get_child(struct json_value *object, const char *key)
+{
+	struct json_value *it;
+
+	if(object->type != JSON_TYPE_OBJECT)
+		return NULL;
+
+	for (it = object->u.value; it; it = it->next) {
+		if (!strcmp(it->key, key))
+			return it;
+	}
+
+	return NULL;
+}
+
+int json_count_children(struct json_value *array)
+{
+	struct json_value *it;
+	int count = 0;
+
+	if (!array || array->type != JSON_TYPE_ARRAY)
+		return -1;
+
+	for (it = array->u.value; it; it = it->next)
+		count++;
+
+	return count;
+}
+
+int json_get_number(struct json_value *object, const char *key, double *number)
+{
+	struct json_value *it;
+
+	if (!object || object->type != JSON_TYPE_OBJECT)
+		return -1;
+
+	for (it = object->u.value; it; it = it->next) {
+		if (!strcmp(it->key, key)) {
+			if (it->type != JSON_TYPE_NUMBER)
+				return -1;
+
+			*number = it->u.number;
+			return 0;
+		}
+	}
+
+	return -1;
+}
+
+const char *json_get_string(struct json_value *object, const char *key)
+{
+	struct json_value *it;
+
+	if (!object || object->type != JSON_TYPE_OBJECT)
+		return NULL;
+
+	for (it = object->u.value; it; it = it->next) {
+		if (!strcmp(it->key, key)) {
+			if (it->type != JSON_TYPE_STRING)
+				return NULL;
+
+			return it->u.string;
+		}
+	}
+
+	return NULL;
+}
+
+void json_free(struct json_value *value)
+{
+	struct json_value *next;
+	struct json_value *it;
+
+	free((char *)value->key);
+
+	switch (value->type) {
+	case JSON_TYPE_OBJECT:
+	case JSON_TYPE_ARRAY:
+		it = value->u.value;
+		while (it) {
+			next = it->next;
+			json_free(it);
+			it = next;
+		}
+		break;
+	case JSON_TYPE_STRING:
+		free((char *)value->u.string);
+		break;
+	}
+
+	free(value);
+}
diff --git a/shared/vendor/pd-mapper/json.h b/shared/vendor/pd-mapper/json.h
new file mode 100644
index 0000000..91790a0
--- /dev/null
+++ b/shared/vendor/pd-mapper/json.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2019, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __JSON_H__
+#define __JSON_H__
+
+
+enum {
+	JSON_TYPE_UNKNOWN,
+	JSON_TYPE_TRUE,
+	JSON_TYPE_FALSE,
+	JSON_TYPE_NULL,
+	JSON_TYPE_NUMBER,
+	JSON_TYPE_STRING,
+	JSON_TYPE_ARRAY,
+	JSON_TYPE_OBJECT,
+};
+
+struct json_value {
+	const char *key;
+
+	int type;
+	union {
+		double number;
+		const char *string;
+		struct json_value *value;
+	} u;
+
+	struct json_value *next;
+};
+
+struct json_value *json_parse(const char *json);
+struct json_value *json_parse_file(const char *file);
+int json_count_children(struct json_value *array);
+struct json_value *json_get_child(struct json_value *object, const char *key);
+int json_get_number(struct json_value *object, const char *key, double *number);
+const char *json_get_string(struct json_value *object, const char *key);
+void json_free(struct json_value *value);
+
+#endif
diff --git a/shared/vendor/pd-mapper/pd-mapper.c b/shared/vendor/pd-mapper/pd-mapper.c
new file mode 100644
index 0000000..664b77d
--- /dev/null
+++ b/shared/vendor/pd-mapper/pd-mapper.c
@@ -0,0 +1,387 @@
+/*
+ * Copyright (c) 2018, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <err.h>
+#include <errno.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <libqrtr.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "assoc.h"
+#include "json.h"
+#include "servreg_loc.h"
+
+struct pd_map {
+	const char *service;
+	const char *domain;
+	int instance;
+};
+
+static struct pd_map *pd_maps;
+
+static void handle_get_domain_list(int sock, const struct qrtr_packet *pkt)
+{
+	struct servreg_loc_get_domain_list_resp resp = {};
+	struct servreg_loc_get_domain_list_req req = {};
+	struct servreg_loc_domain_list_entry *entry;
+	DEFINE_QRTR_PACKET(resp_buf, 256);
+	const struct pd_map *pd_map = pd_maps;
+	unsigned int txn;
+	ssize_t len;
+	int ret;
+
+	ret = qmi_decode_message(&req, &txn, pkt, QMI_REQUEST,
+				 SERVREG_LOC_GET_DOMAIN_LIST,
+				 servreg_loc_get_domain_list_req_ei);
+	if (ret < 0) {
+		resp.result.result = QMI_RESULT_FAILURE;
+		resp.result.error = QMI_ERR_MALFORMED_MSG;
+		goto respond;
+	}
+
+	req.name[sizeof(req.name)-1] = '\0';
+
+	resp.result.result = QMI_RESULT_SUCCESS;
+	resp.db_revision_valid = 1;
+	resp.db_revision = 1;
+
+	while (pd_map->service) {
+		if (!strcmp(pd_map->service, req.name)) {
+			entry = &resp.domain_list[resp.domain_list_len++];
+
+			strcpy(entry->name, pd_map->domain);
+			entry->name_len = strlen(pd_map->domain);
+			entry->instance_id = pd_map->instance;
+		}
+
+		pd_map++;
+	}
+
+	if (resp.domain_list_len)
+		resp.domain_list_valid = 1;
+
+	resp.total_domains_valid = 1;
+	resp.total_domains = resp.domain_list_len;
+
+respond:
+	len = qmi_encode_message(&resp_buf,
+				 QMI_RESPONSE, SERVREG_LOC_GET_DOMAIN_LIST,
+				 txn, &resp,
+				 servreg_loc_get_domain_list_resp_ei);
+	if (len < 0) {
+		fprintf(stderr,
+			"[PD-MAPPER] failed to encode get_domain_list response: %s\n",
+			strerror(-len));
+		return;
+	}
+
+	ret = qrtr_sendto(sock, pkt->node, pkt->port,
+			  resp_buf.data, resp_buf.data_len);
+	if (ret < 0) {
+		fprintf(stderr,
+			"[PD-MAPPER] failed to send get_domain_list response: %s\n",
+			strerror(-ret));
+	}
+}
+
+static int pd_load_map(const char *file)
+{
+	static int num_pd_maps;
+	struct json_value *sr_service;
+	struct json_value *sr_domain;
+	struct json_value *root;
+	struct json_value *it;
+	const char *subdomain;
+	const char *provider;
+	const char *service;
+	const char *domain;
+	const char *soc;
+	struct pd_map *newp;
+	struct pd_map *map;
+	double number;
+	int count;
+	int ret;
+
+	root = json_parse_file(file);
+	if (!root)
+		return -1;
+
+	sr_domain = json_get_child(root, "sr_domain");
+	soc = json_get_string(sr_domain, "soc");
+	domain = json_get_string(sr_domain, "domain");
+	subdomain = json_get_string(sr_domain, "subdomain");
+	ret = json_get_number(sr_domain, "qmi_instance_id", &number);
+	if (ret)
+		return ret;
+
+	if (!soc || !domain || !subdomain) {
+		fprintf(stderr, "failed to parse sr_domain\n");
+		return -1;
+	}
+
+	sr_service = json_get_child(root, "sr_service");
+	count = json_count_children(sr_service);
+	if (count < 0)
+		return count;
+
+	newp = realloc(pd_maps, (num_pd_maps + count + 1) * sizeof(*newp));
+	if (!newp)
+		return -1;
+	pd_maps = newp;
+
+	for (it = sr_service->u.value; it; it = it->next) {
+		provider = json_get_string(it, "provider");
+		service = json_get_string(it, "service");
+
+		if (!provider || !service) {
+			fprintf(stderr,
+				"failed to parse provdider or service from %s\n",
+				file);
+			return -1;
+		}
+
+		map = &pd_maps[num_pd_maps++];
+
+		map->service = malloc(strlen(provider) + strlen(service) + 2);
+		sprintf((char *)map->service, "%s/%s", provider, service);
+
+		map->domain = malloc(strlen(soc) + strlen(domain) + strlen(subdomain) + 3);
+		sprintf((char *)map->domain, "%s/%s/%s", soc, domain, subdomain);
+
+		map->instance = number;
+	}
+
+	pd_maps[num_pd_maps].service = NULL;
+
+	json_free(root);
+
+	return 0;
+}
+
+#ifndef ANDROID
+#define FIRMWARE_BASE	"/lib/firmware/"
+#else
+#define FIRMWARE_BASE	"/vendor/firmware/"
+#endif
+
+static int pd_enumerate_jsons(struct assoc *json_set)
+{
+	char firmware_value[PATH_MAX];
+	char json_path[PATH_MAX];
+	char firmware_attr[32];
+	struct dirent *fw_de;
+	char path[PATH_MAX];
+	struct dirent *de;
+	int firmware_fd;
+	DIR *class_dir;
+	int class_fd;
+	DIR *fw_dir;
+	size_t len;
+	size_t n;
+
+	class_fd = open("/sys/class/remoteproc", O_RDONLY | O_DIRECTORY);
+	if (class_fd < 0) {
+		warn("failed to open remoteproc class");
+		return -1;
+	}
+
+	class_dir = fdopendir(class_fd);
+	if (!class_dir) {
+		warn("failed to opendir");
+		goto close_class;
+	}
+
+	while ((de = readdir(class_dir)) != NULL) {
+		if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, ".."))
+			continue;
+
+		if (strlen(de->d_name) + sizeof("/firmware") > sizeof(firmware_attr))
+			continue;
+
+		strcpy(firmware_attr, de->d_name);
+		strcat(firmware_attr, "/firmware");
+
+		firmware_fd = openat(class_fd, firmware_attr, O_RDONLY);
+		if (firmware_fd < 0)
+			continue;
+
+		n = read(firmware_fd, firmware_value, sizeof(firmware_value));
+		close(firmware_fd);
+		if (n < 0) {
+			continue;
+		}
+
+		firmware_value[n] = '\0';
+
+		if (strlen(FIRMWARE_BASE) + strlen(firmware_value) + 1 > sizeof(path))
+			continue;
+
+		strcpy(path, FIRMWARE_BASE);
+		strcat(path, dirname(firmware_value));
+
+		fw_dir = opendir(path);
+		while ((fw_de = readdir(fw_dir)) != NULL) {
+			if (!strcmp(fw_de->d_name, ".") || !strcmp(fw_de->d_name, ".."))
+				continue;
+
+			len = strlen(fw_de->d_name);
+			if (len < 5 || strcmp(&fw_de->d_name[len - 4], ".jsn"))
+				continue;
+
+			if (strlen(FIRMWARE_BASE) + strlen(firmware_value) + 1 +
+			    strlen(fw_de->d_name) + 1 > sizeof(path))
+					continue;
+
+			strcpy(json_path, path);
+			strcat(json_path, "/");
+			strcat(json_path, fw_de->d_name);
+
+			assoc_set(json_set, json_path, NULL);
+		}
+
+		closedir(fw_dir);
+	}
+
+	closedir(class_dir);
+close_class:
+	close(class_fd);
+
+	return 0;
+}
+
+static int pd_load_maps(void)
+{
+	struct assoc json_set;
+	unsigned long it;
+	const char *jsn;
+	int ret = 0;
+
+	assoc_init(&json_set, 20);
+
+	pd_enumerate_jsons(&json_set);
+
+	assoc_foreach(jsn, NULL, &json_set, it) {
+		ret = pd_load_map(jsn);
+		if (ret < 0)
+			break;
+	}
+
+	assoc_destroy(&json_set);
+
+	return ret;
+}
+
+int main(int argc __unused, char **argv __unused)
+{
+	struct sockaddr_qrtr sq;
+	struct qrtr_packet pkt;
+	unsigned int msg_id;
+	socklen_t sl;
+	char buf[4096];
+	int ret;
+	int fd;
+
+	ret = pd_load_maps();
+	if (ret)
+		exit(1);
+
+	if (!pd_maps) {
+		fprintf(stderr, "no pd maps available\n");
+		exit(1);
+	}
+
+	fd = qrtr_open(0);
+	if (fd < 0) {
+		fprintf(stderr, "failed to open qrtr socket\n");
+		exit(1);
+	}
+
+	ret = qrtr_publish(fd, SERVREG_QMI_SERVICE,
+			   SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE);
+	if (ret < 0) {
+		fprintf(stderr, "failed to publish service registry service\n");
+		exit(1);
+	}
+
+	for (;;) {
+		ret = qrtr_poll(fd, -1);
+		if (ret < 0) {
+			if (errno == EINTR) {
+				continue;
+			} else {
+				fprintf(stderr, "qrtr_poll failed\n");
+				break;
+			}
+		}
+
+		sl = sizeof(sq);
+		ret = recvfrom(fd, buf, sizeof(buf), 0, (void *)&sq, &sl);
+		if (ret < 0) {
+			ret = -errno;
+			if (ret != -ENETRESET)
+				fprintf(stderr, "[PD-MAPPER] recvfrom failed: %d\n", ret);
+			return ret;
+		}
+
+		ret = qrtr_decode(&pkt, buf, ret, &sq);
+		if (ret < 0) {
+			fprintf(stderr, "[PD-MAPPER] unable to decode qrtr packet\n");
+			return ret;
+		}
+
+		switch (pkt.type) {
+		case QRTR_TYPE_DATA:
+			ret = qmi_decode_header(&pkt, &msg_id);
+			if (ret < 0)
+				continue;
+
+			switch (msg_id) {
+			case SERVREG_LOC_GET_DOMAIN_LIST:
+				handle_get_domain_list(fd, &pkt);
+				break;
+			case SERVREG_LOC_PFR:
+				printf("[PD-MAPPER] pfr\n");
+				break;
+			};
+			break;
+		};
+	}
+
+	close(fd);
+
+	return 0;
+}
diff --git a/shared/vendor/pd-mapper/pd-mapper.service.in b/shared/vendor/pd-mapper/pd-mapper.service.in
new file mode 100644
index 0000000..09b594b
--- /dev/null
+++ b/shared/vendor/pd-mapper/pd-mapper.service.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Qualcomm PD mapper service
+Requires=qrtr-ns.service
+After=qrtr-ns.service
+
+[Service]
+ExecStart=PD_MAPPER_PATH/pd-mapper
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/shared/vendor/pd-mapper/servreg_loc.c b/shared/vendor/pd-mapper/servreg_loc.c
new file mode 100644
index 0000000..6309498
--- /dev/null
+++ b/shared/vendor/pd-mapper/servreg_loc.c
@@ -0,0 +1,169 @@
+#include <errno.h>
+#include <string.h>
+#include "servreg_loc.h"
+
+struct qmi_elem_info servreg_loc_qmi_result_ei[] = {
+	{
+		.data_type = QMI_UNSIGNED_2_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint16_t),
+		.offset = offsetof(struct servreg_loc_qmi_result, result),
+	},
+	{
+		.data_type = QMI_UNSIGNED_2_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint16_t),
+		.offset = offsetof(struct servreg_loc_qmi_result, error),
+	},
+	{}
+};
+
+struct qmi_elem_info servreg_loc_domain_list_entry_ei[] = {
+	{
+		.data_type = QMI_STRING,
+		.elem_len = 256,
+		.elem_size = sizeof(char),
+		.offset = offsetof(struct servreg_loc_domain_list_entry, name)
+	},
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.offset = offsetof(struct servreg_loc_domain_list_entry, instance_id),
+	},
+	{
+		.data_type = QMI_UNSIGNED_1_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint8_t),
+		.offset = offsetof(struct servreg_loc_domain_list_entry, service_data_valid),
+	},
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.offset = offsetof(struct servreg_loc_domain_list_entry, service_data),
+	},
+	{}
+};
+
+struct qmi_elem_info servreg_loc_get_domain_list_req_ei[] = {
+	{
+		.data_type = QMI_STRING,
+		.elem_len = 256,
+		.elem_size = sizeof(char),
+		.array_type = VAR_LEN_ARRAY,
+		.tlv_type = 1,
+		.offset = offsetof(struct servreg_loc_get_domain_list_req, name)
+	},
+	{
+		.data_type = QMI_OPT_FLAG,
+		.elem_len = 1,
+		.elem_size = sizeof(bool),
+		.tlv_type = 16,
+		.offset = offsetof(struct servreg_loc_get_domain_list_req, offset_valid),
+	},
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.tlv_type = 16,
+		.offset = offsetof(struct servreg_loc_get_domain_list_req, offset),
+	},
+	{}
+};
+
+struct qmi_elem_info servreg_loc_get_domain_list_resp_ei[] = {
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 1,
+		.elem_size = sizeof(struct servreg_loc_qmi_result),
+		.tlv_type = 2,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, result),
+		.ei_array = servreg_loc_qmi_result_ei,
+	},
+	{
+		.data_type = QMI_OPT_FLAG,
+		.elem_len = 1,
+		.elem_size = sizeof(bool),
+		.tlv_type = 16,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, total_domains_valid),
+	},
+	{
+		.data_type = QMI_UNSIGNED_2_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint16_t),
+		.tlv_type = 16,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, total_domains),
+	},
+	{
+		.data_type = QMI_OPT_FLAG,
+		.elem_len = 1,
+		.elem_size = sizeof(bool),
+		.tlv_type = 17,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, db_revision_valid),
+	},
+	{
+		.data_type = QMI_UNSIGNED_2_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint16_t),
+		.tlv_type = 17,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, db_revision),
+	},
+	{
+		.data_type = QMI_OPT_FLAG,
+		.elem_len = 1,
+		.elem_size = sizeof(bool),
+		.tlv_type = 18,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, domain_list_valid),
+	},
+	{
+		.data_type = QMI_DATA_LEN,
+		.elem_len = 1,
+		.elem_size = sizeof(uint8_t),
+		.tlv_type = 18,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, domain_list_len),
+	},
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 255,
+		.elem_size = sizeof(struct servreg_loc_domain_list_entry),
+		.array_type = VAR_LEN_ARRAY,
+		.tlv_type = 18,
+		.offset = offsetof(struct servreg_loc_get_domain_list_resp, domain_list),
+		.ei_array = servreg_loc_domain_list_entry_ei,
+	},
+	{}
+};
+
+struct qmi_elem_info servreg_loc_pfr_req_ei[] = {
+	{
+		.data_type = QMI_STRING,
+		.elem_len = 256,
+		.elem_size = sizeof(char),
+		.array_type = VAR_LEN_ARRAY,
+		.tlv_type = 1,
+		.offset = offsetof(struct servreg_loc_pfr_req, service)
+	},
+	{
+		.data_type = QMI_STRING,
+		.elem_len = 256,
+		.elem_size = sizeof(char),
+		.array_type = VAR_LEN_ARRAY,
+		.tlv_type = 2,
+		.offset = offsetof(struct servreg_loc_pfr_req, reason)
+	},
+	{}
+};
+
+struct qmi_elem_info servreg_loc_pfr_resp_ei[] = {
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 1,
+		.elem_size = sizeof(struct servreg_loc_qmi_result),
+		.tlv_type = 2,
+		.offset = offsetof(struct servreg_loc_pfr_resp, result),
+		.ei_array = servreg_loc_qmi_result_ei,
+	},
+	{}
+};
+
diff --git a/shared/vendor/pd-mapper/servreg_loc.h b/shared/vendor/pd-mapper/servreg_loc.h
new file mode 100644
index 0000000..2ac5faa
--- /dev/null
+++ b/shared/vendor/pd-mapper/servreg_loc.h
@@ -0,0 +1,67 @@
+#ifndef __QMI_SERVREG_LOC_H__
+#define __QMI_SERVREG_LOC_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "libqrtr.h"
+
+#define SERVREG_QMI_SERVICE 64
+#define SERVREG_QMI_VERSION 257
+#define SERVREG_QMI_INSTANCE 0
+#define QMI_RESULT_SUCCESS 0
+#define QMI_RESULT_FAILURE 1
+#define QMI_ERR_NONE 0
+#define QMI_ERR_INTERNAL 1
+#define QMI_ERR_MALFORMED_MSG 2
+#define SERVREG_LOC_GET_DOMAIN_LIST 33
+#define SERVREG_LOC_PFR 36
+
+struct servreg_loc_qmi_result {
+	uint16_t result;
+	uint16_t error;
+};
+
+struct servreg_loc_domain_list_entry {
+	uint32_t name_len;
+	char name[256];
+	uint32_t instance_id;
+	uint8_t service_data_valid;
+	uint32_t service_data;
+};
+
+struct servreg_loc_get_domain_list_req {
+	uint32_t name_len;
+	char name[256];
+	bool offset_valid;
+	uint32_t offset;
+};
+
+struct servreg_loc_get_domain_list_resp {
+	struct servreg_loc_qmi_result result;
+	bool total_domains_valid;
+	uint16_t total_domains;
+	bool db_revision_valid;
+	uint16_t db_revision;
+	bool domain_list_valid;
+	uint32_t domain_list_len;
+	struct servreg_loc_domain_list_entry domain_list[255];
+};
+
+struct servreg_loc_pfr_req {
+	uint32_t service_len;
+	char service[256];
+	uint32_t reason_len;
+	char reason[256];
+};
+
+struct servreg_loc_pfr_resp {
+	struct servreg_loc_qmi_result result;
+};
+
+extern struct qmi_elem_info servreg_loc_get_domain_list_req_ei[];
+extern struct qmi_elem_info servreg_loc_get_domain_list_resp_ei[];
+extern struct qmi_elem_info servreg_loc_pfr_req_ei[];
+extern struct qmi_elem_info servreg_loc_pfr_resp_ei[];
+
+#endif
diff --git a/shared/vendor/pd-mapper/servreg_loc.qmi b/shared/vendor/pd-mapper/servreg_loc.qmi
new file mode 100644
index 0000000..4dc04e6
--- /dev/null
+++ b/shared/vendor/pd-mapper/servreg_loc.qmi
@@ -0,0 +1,48 @@
+package servreg_loc;
+
+const SERVREG_QMI_SERVICE = 0x40;
+const SERVREG_QMI_VERSION = 0x101;
+const SERVREG_QMI_INSTANCE = 0x0;
+
+const QMI_RESULT_SUCCESS = 0;
+const QMI_RESULT_FAILURE = 1;
+
+const QMI_ERR_NONE = 0;
+const QMI_ERR_INTERNAL = 1;
+const QMI_ERR_MALFORMED_MSG = 2;
+
+const SERVREG_LOC_GET_DOMAIN_LIST = 0x21;
+const SERVREG_LOC_PFR = 0x24;
+
+struct qmi_result {
+	u16 result;
+	u16 error;
+};
+
+struct domain_list_entry {
+	string name;
+	u32 instance_id;
+	u8 service_data_valid;
+	u32 service_data;
+};
+
+request get_domain_list_req {
+	required string name = 1;
+	optional u32 offset = 0x10;
+} = 0x20;
+
+response get_domain_list_resp {
+	required qmi_result result = 2;
+	optional u16 total_domains = 0x10;
+	optional u16 db_revision = 0x11;
+	optional domain_list_entry domain_list[255] = 0x12;
+} = 0x20;
+
+request pfr_req {
+	required string service = 1;
+	required string reason = 2;
+} = 0x24;
+
+response pfr_resp {
+	required qmi_result result = 2;
+} = 0x24;
diff --git a/shared/vendor/qrtr/Android.bp b/shared/vendor/qrtr/Android.bp
new file mode 100644
index 0000000..9544a75
--- /dev/null
+++ b/shared/vendor/qrtr/Android.bp
@@ -0,0 +1,49 @@
+cc_library {
+    name: "libqrtr",
+    vendor: true,
+    srcs: [
+        "lib/logging.c",
+        "lib/qrtr.c",
+        "lib/qmi.c",
+    ],
+    cflags: ["-fPIC"],
+    export_include_dirs: ["lib"],
+    local_include_dirs: ["src"],
+}
+
+cc_binary {
+    name: "qrtr-ns",
+    vendor: true,
+    srcs: [
+        "lib/logging.c",
+        "src/addr.c",
+        "src/ns.c",
+        "src/map.c",
+        "src/hash.c",
+        "src/waiter.c",
+        "src/util.c",
+    ],
+    local_include_dirs: ["lib"],
+}
+
+cc_binary {
+    name: "qrtr-cfg",
+    vendor: true,
+    srcs: [
+        "lib/logging.c",
+        "src/addr.c",
+        "src/cfg.c",
+    ],
+    local_include_dirs: ["lib"],
+}
+
+cc_binary {
+    name: "qrtr-lookup",
+    vendor: true,
+    srcs: [
+        "lib/logging.c",
+        "src/lookup.c",
+        "src/util.c",
+    ],
+    local_include_dirs: ["lib"],
+}
diff --git a/shared/vendor/qrtr/LICENSE b/shared/vendor/qrtr/LICENSE
new file mode 100644
index 0000000..afbafbe
--- /dev/null
+++ b/shared/vendor/qrtr/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2015, Sony Mobile Communications Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of the organization nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/shared/vendor/qrtr/Makefile b/shared/vendor/qrtr/Makefile
new file mode 100644
index 0000000..f814aa2
--- /dev/null
+++ b/shared/vendor/qrtr/Makefile
@@ -0,0 +1,150 @@
+proj := qrtr
+proj-major := 1
+proj-minor := 0
+proj-version := $(proj-major).$(proj-minor)
+
+CFLAGS := -Wall -g
+LDFLAGS :=
+
+prefix := /usr/local
+bindir := $(prefix)/bin
+libdir := $(prefix)/lib
+includedir := $(prefix)/include
+servicedir := $(prefix)/lib/systemd/system
+
+ifneq ($(CROSS_COMPILE),)
+CC := $(CROSS_COMPILE)gcc
+endif
+SFLAGS := -I$(shell $(CC) -print-file-name=include) -Wno-non-pointer-null
+
+$(proj)-cfg-srcs := \
+	lib/logging.c \
+	src/addr.c \
+	src/cfg.c \
+
+$(proj)-cfg-cflags := -Ilib
+
+$(proj)-ns-srcs := \
+	lib/logging.c \
+	src/addr.c \
+	src/ns.c \
+	src/map.c \
+	src/hash.c \
+	src/waiter.c \
+	src/util.c \
+
+$(proj)-ns-cflags := -Ilib
+
+$(proj)-lookup-srcs := \
+	lib/logging.c \
+	src/lookup.c \
+	src/util.c \
+
+$(proj)-lookup-cflags := -Ilib
+
+lib$(proj).so-srcs := \
+	lib/logging.c \
+	lib/qrtr.c \
+	lib/qmi.c
+
+lib$(proj).so-cflags := -fPIC -Isrc
+
+targets := $(proj)-ns $(proj)-cfg $(proj)-lookup lib$(proj).so
+
+out := out
+src_to_obj = $(patsubst %.c,$(out)/obj/%.o,$(1))
+src_to_dep = $(patsubst %.c,$(out)/dep/%.d,$(1))
+
+all-srcs :=
+all-objs :=
+all-deps :=
+all-clean := $(out)
+all-install :=
+
+all: $(targets)
+
+$(out)/obj/%.o: %.c
+ifneq ($C,)
+	@echo "CHECK	$<"
+	@sparse $< $(patsubst -iquote=%,-I%,$(CFLAGS)) $(SFLAGS)
+endif
+	@echo "CC	$<"
+	@$(CC) -MM -MF $(call src_to_dep,$<) -MP -MT "$@ $(call src_to_dep,$<)" $(CFLAGS) $(_CFLAGS) $<
+	@$(CC) -o $@ -c $< $(CFLAGS) $(_CFLAGS)
+
+define add-inc-target
+$(DESTDIR)$(includedir)/$2: $1/$2
+	@echo "INSTALL	$$<"
+	@install -D -m 755 $$< $$@
+
+all-install += $(DESTDIR)$(includedir)/$2
+endef
+
+define add-target-deps
+all-srcs += $($1-srcs)
+all-objs += $(call src_to_obj,$($1-srcs))
+all-deps += $(call src_to_dep,$($1-srcs))
+all-clean += $1
+$(call src_to_obj,$($1-srcs)): _CFLAGS := $($1-cflags)
+endef
+
+define add-bin-target
+
+$(call add-target-deps,$1)
+
+$1: $(call src_to_obj,$($1-srcs))
+	@echo "LD	$$@"
+	$$(CC) -o $$@ $$(filter %.o,$$^) $(LDFLAGS)
+
+$(DESTDIR)$(bindir)/$1: $1
+	@echo "INSTALL	$$<"
+	@install -D -m 755 $$< $$@
+
+all-install += $(DESTDIR)$(bindir)/$1
+endef
+
+define add-lib-target
+
+$(call add-target-deps,$1)
+
+$1: $(call src_to_obj,$($1-srcs))
+	@echo "LD	$$@"
+	$$(CC) -o $$@ $$(filter %.o,$$^) $(LDFLAGS) -shared -Wl,-soname,$1.$(proj-major)
+
+$(DESTDIR)$(libdir)/$1.$(proj-version): $1
+	@echo "INSTALL	$$<"
+	@install -D -m 755 $$< $$@
+	@ln -sf $1.$(proj-version) $(DESTDIR)$(libdir)/$1.$(proj-major)
+	@ln -sf $1.$(proj-major) $(DESTDIR)$(libdir)/$1
+
+all-install += $(DESTDIR)$(libdir)/$1.$(proj-version)
+endef
+
+define add-systemd-service-target
+$1: $1.in
+	sed 's+QRTR_NS_PATH+$(bindir)+g' $$< > $$@
+
+$(DESTDIR)$(servicedir)/$1: $1
+	@echo "INSTALL	$$<"
+	@install -D -m 755 $$< $$@
+
+all-install += $(DESTDIR)$(servicedir)/$1
+endef
+
+$(foreach v,$(filter-out %.so,$(targets)),$(eval $(call add-bin-target,$v)))
+$(foreach v,$(filter %.so,$(targets)),$(eval $(call add-lib-target,$v)))
+$(eval $(call add-inc-target,lib,libqrtr.h))
+$(eval $(call add-systemd-service-target,qrtr-ns.service))
+
+install: $(all-install)
+
+clean:
+	@echo CLEAN
+	@$(RM) -r $(all-clean)
+
+$(call src_to_obj,$(all-srcs)): Makefile
+
+ifneq ("$(MAKECMDGOALS)","clean")
+cmd-goal-1 := $(shell mkdir -p $(sort $(dir $(all-objs) $(all-deps))))
+-include $(all-deps)
+endif
diff --git a/shared/vendor/qrtr/lib/libqrtr.h b/shared/vendor/qrtr/lib/libqrtr.h
new file mode 100644
index 0000000..87433ed
--- /dev/null
+++ b/shared/vendor/qrtr/lib/libqrtr.h
@@ -0,0 +1,195 @@
+#ifndef _QRTR_LIB_H_
+#define _QRTR_LIB_H_
+
+#include <linux/qrtr.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef offsetof
+#define offsetof(type, md) ((unsigned long)&((type *)0)->md)
+#endif
+
+#ifndef container_of
+#define container_of(ptr, type, member) \
+  ((type *)((char *)(ptr) - offsetof(type, member)))
+#endif
+
+#ifndef AF_QIPCRTR
+#define AF_QIPCRTR 42
+#endif
+
+struct sockaddr_qrtr;
+
+struct qrtr_packet {
+	int type;
+
+	unsigned int node;
+	unsigned int port;
+
+	unsigned int service;
+	unsigned int instance;
+	unsigned int version;
+
+	void *data;
+	size_t data_len;
+};
+
+#define DEFINE_QRTR_PACKET(pkt, size) \
+	char pkt ## _buf[size]; \
+	struct qrtr_packet pkt = { .data = pkt ##_buf, \
+				   .data_len = sizeof(pkt ##_buf), }
+
+#define QMI_REQUEST     0
+#define QMI_RESPONSE    2
+#define QMI_INDICATION  4
+
+#define QMI_COMMON_TLV_TYPE 0
+
+enum qmi_elem_type {
+	QMI_EOTI,
+	QMI_OPT_FLAG,
+	QMI_DATA_LEN,
+	QMI_UNSIGNED_1_BYTE,
+	QMI_UNSIGNED_2_BYTE,
+	QMI_UNSIGNED_4_BYTE,
+	QMI_UNSIGNED_8_BYTE,
+	QMI_SIGNED_1_BYTE_ENUM,
+	QMI_SIGNED_2_BYTE_ENUM,
+	QMI_SIGNED_4_BYTE_ENUM,
+	QMI_STRUCT,
+	QMI_STRING,
+};
+
+enum qmi_array_type {
+	NO_ARRAY,
+	STATIC_ARRAY,
+	VAR_LEN_ARRAY,
+};
+
+/**
+ * struct qmi_elem_info - describes how to encode a single QMI element
+ * @data_type:  Data type of this element.
+ * @elem_len:   Array length of this element, if an array.
+ * @elem_size:  Size of a single instance of this data type.
+ * @array_type: Array type of this element.
+ * @tlv_type:   QMI message specific type to identify which element
+ *              is present in an incoming message.
+ * @offset:     Specifies the offset of the first instance of this
+ *              element in the data structure.
+ * @ei_array:   Null-terminated array of @qmi_elem_info to describe nested
+ *              structures.
+ */
+struct qmi_elem_info {
+	enum qmi_elem_type data_type;
+	uint32_t elem_len;
+	uint32_t elem_size;
+	enum qmi_array_type array_type;
+	uint8_t tlv_type;
+	uint32_t offset;
+	struct qmi_elem_info *ei_array;
+};
+
+#define QMI_RESULT_SUCCESS_V01                  0
+#define QMI_RESULT_FAILURE_V01                  1
+
+#define QMI_ERR_NONE_V01                        0
+#define QMI_ERR_MALFORMED_MSG_V01               1
+#define QMI_ERR_NO_MEMORY_V01                   2
+#define QMI_ERR_INTERNAL_V01                    3
+#define QMI_ERR_CLIENT_IDS_EXHAUSTED_V01        5
+#define QMI_ERR_INVALID_ID_V01                  41
+#define QMI_ERR_ENCODING_V01                    58
+#define QMI_ERR_INCOMPATIBLE_STATE_V01          90
+#define QMI_ERR_NOT_SUPPORTED_V01               94
+
+/**
+ * qmi_response_type_v01 - common response header (decoded)
+ * @result:     result of the transaction
+ * @error:      error value, when @result is QMI_RESULT_FAILURE_V01
+ */
+struct qmi_response_type_v01 {
+	uint16_t result;
+	uint16_t error;
+};
+
+extern struct qmi_elem_info qmi_response_type_v01_ei[];
+
+int qrtr_open(int rport);
+void qrtr_close(int sock);
+
+int qrtr_sendto(int sock, uint32_t node, uint32_t port, const void *data, unsigned int sz);
+int qrtr_recvfrom(int sock, void *buf, unsigned int bsz, uint32_t *node, uint32_t *port);
+int qrtr_recv(int sock, void *buf, unsigned int bsz);
+
+int qrtr_new_server(int sock, uint32_t service, uint16_t version, uint16_t instance);
+int qrtr_remove_server(int sock, uint32_t service, uint16_t version, uint16_t instance);
+
+int qrtr_publish(int sock, uint32_t service, uint16_t version, uint16_t instance);
+int qrtr_bye(int sock, uint32_t service, uint16_t version, uint16_t instance);
+
+int qrtr_new_lookup(int sock, uint32_t service, uint16_t version, uint16_t instance);
+int qrtr_remove_lookup(int sock, uint32_t service, uint16_t version, uint16_t instance);
+
+int qrtr_poll(int sock, unsigned int ms);
+
+int qrtr_decode(struct qrtr_packet *dest, void *buf, size_t len,
+		const struct sockaddr_qrtr *sq);
+
+int qmi_decode_header(const struct qrtr_packet *pkt, unsigned int *msg_id);
+int qmi_decode_message(void *c_struct, unsigned int *txn,
+		       const struct qrtr_packet *pkt,
+		       int type, int id, struct qmi_elem_info *ei);
+ssize_t qmi_encode_message(struct qrtr_packet *pkt, int type, int msg_id,
+			   int txn_id, const void *c_struct,
+			   struct qmi_elem_info *ei);
+
+/* Initial kernel header didn't expose these */
+#ifndef QRTR_NODE_BCAST
+
+#define QRTR_NODE_BCAST 0xffffffffu
+#define QRTR_PORT_CTRL  0xfffffffeu
+
+enum qrtr_pkt_type {
+        QRTR_TYPE_DATA          = 1,
+        QRTR_TYPE_HELLO         = 2,
+        QRTR_TYPE_BYE           = 3,
+        QRTR_TYPE_NEW_SERVER    = 4,
+        QRTR_TYPE_DEL_SERVER    = 5,
+        QRTR_TYPE_DEL_CLIENT    = 6,
+        QRTR_TYPE_RESUME_TX     = 7,
+        QRTR_TYPE_EXIT          = 8,
+        QRTR_TYPE_PING          = 9,
+        QRTR_TYPE_NEW_LOOKUP    = 10,
+        QRTR_TYPE_DEL_LOOKUP    = 11,
+};
+
+struct qrtr_ctrl_pkt {
+        __le32 cmd;
+
+        union {
+                struct {
+                        __le32 service;
+                        __le32 instance;
+                        __le32 node;
+                        __le32 port;
+                } server;
+
+                struct {
+                        __le32 node;
+                        __le32 port;
+                } client;
+        };
+} __attribute__((packed));
+
+#endif
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif
diff --git a/shared/vendor/qrtr/lib/logging.c b/shared/vendor/qrtr/lib/logging.c
new file mode 100644
index 0000000..0b0f103
--- /dev/null
+++ b/shared/vendor/qrtr/lib/logging.c
@@ -0,0 +1,73 @@
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <syslog.h>
+
+#define QLOG_BUF_SIZE 512
+
+static const char default_tag[] = "libqrtr";
+static const char *current_tag = default_tag;
+static int min_priority = LOG_INFO;
+
+static bool logging_to_syslog = false;
+
+void qlog_setup(const char *tag, bool use_syslog)
+{
+	current_tag = tag;
+	logging_to_syslog = use_syslog;
+
+	openlog(tag, LOG_PID, LOG_USER);
+}
+
+void qlog_set_min_priority(int priority)
+{
+	if (priority < LOG_EMERG || priority > LOG_DEBUG)
+		return;
+
+	min_priority = priority;
+}
+
+static const char *get_priority_string(int priority)
+{
+	switch (priority) {
+	case LOG_EMERG:
+		return "EMERG";
+	case LOG_ALERT:
+		return "ALERT";
+	case LOG_CRIT:
+		return "CRIT";
+	case LOG_ERR:
+		return "ERROR";
+	case LOG_WARNING:
+		return "WARNING";
+	case LOG_NOTICE:
+		return "NOTICE";
+	case LOG_INFO:
+		return "INFO";
+	case LOG_DEBUG:
+		return "DEBUG";
+	}
+	return "";
+}
+
+void qlog(int priority, const char *format, ...)
+{
+	va_list ap;
+
+	if (priority > min_priority)
+		return;
+
+	va_start(ap, format);
+
+	if (logging_to_syslog) {
+		vsyslog(priority, format, ap);
+	} else {
+		char buf[QLOG_BUF_SIZE];
+		vsnprintf(buf, QLOG_BUF_SIZE, format, ap);
+
+		fprintf(stderr, "%s %s: %s\n",
+		        get_priority_string(priority), current_tag, buf);
+	}
+
+	va_end(ap);
+}
diff --git a/shared/vendor/qrtr/lib/logging.h b/shared/vendor/qrtr/lib/logging.h
new file mode 100644
index 0000000..8372a8f
--- /dev/null
+++ b/shared/vendor/qrtr/lib/logging.h
@@ -0,0 +1,36 @@
+#ifndef _QRTR_LOGGING_H_
+#define _QRTR_LOGGING_H_
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <syslog.h>
+
+#if defined(__GNUC__) || defined(__clang__)
+#define __PRINTF__(fmt, args) __attribute__((format(__printf__, fmt, args)))
+#else
+#define __PRINTF__(fmt, args)
+#endif
+
+void qlog_setup(const char *tag, bool use_syslog);
+void qlog_set_min_priority(int priority);
+
+void qlog(int priority, const char *format, ...) __PRINTF__(2, 3);
+
+#define LOGD(fmt, ...) qlog(LOG_DEBUG, fmt, ##__VA_ARGS__)
+
+#define LOGW(fmt, ...) qlog(LOG_WARNING, fmt, ##__VA_ARGS__)
+#define PLOGW(fmt, ...) \
+	qlog(LOG_WARNING, fmt ": %s", ##__VA_ARGS__, strerror(errno))
+
+#define LOGE(fmt, ...) qlog(LOG_ERR, fmt, ##__VA_ARGS__)
+#define PLOGE(fmt, ...) qlog(LOG_ERR, fmt ": %s", ##__VA_ARGS__, strerror(errno))
+#define LOGE_AND_EXIT(fmt, ...) do {			\
+		qlog(LOG_ERR, fmt, ##__VA_ARGS__);	\
+		exit(1);				\
+	} while(0)
+#define PLOGE_AND_EXIT(fmt, ...) do {						\
+		qlog(LOG_ERR, fmt ": %s", ##__VA_ARGS__, strerror(errno));	\
+		exit(1);							\
+	} while(0)
+
+#endif
diff --git a/shared/vendor/qrtr/lib/qmi.c b/shared/vendor/qrtr/lib/qmi.c
new file mode 100644
index 0000000..f1c0293
--- /dev/null
+++ b/shared/vendor/qrtr/lib/qmi.c
@@ -0,0 +1,874 @@
+/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
+ * Copyright (C) 2017-2018 Linaro Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *	* Redistributions of source code must retain the above copyright
+ *	  notice, this list of conditions and the following disclaimer.
+ *	* Redistributions in binary form must reproduce the above
+ *	  copyright notice, this list of conditions and the following
+ *	  disclaimer in the documentation and/or other materials provided
+ *	  with the distribution.
+ *	* Neither the name of The Linux Foundation nor the names of its
+ *	  contributors may be used to endorse or promote products derived
+ *	  from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "libqrtr.h"
+#include "logging.h"
+
+/**
+ * qmi_header - wireformat header of QMI messages
+ * @type:       type of message
+ * @txn_id:     transaction id
+ * @msg_id:     message id
+ * @msg_len:    length of message payload following header
+ */
+struct qmi_header {
+	uint8_t type;
+	uint16_t txn_id;
+	uint16_t msg_id;
+	uint16_t msg_len;
+} __attribute__((packed));
+
+
+#define QMI_ENCDEC_ENCODE_TLV(type, length, p_dst) do { \
+	*p_dst++ = type; \
+	*p_dst++ = ((uint8_t)((length) & 0xFF)); \
+	*p_dst++ = ((uint8_t)(((length) >> 8) & 0xFF)); \
+} while (0)
+
+#define QMI_ENCDEC_DECODE_TLV(p_type, p_length, p_src) do { \
+	*p_type = (uint8_t)*p_src++; \
+	*p_length = (uint8_t)*p_src++; \
+	*p_length |= ((uint8_t)*p_src) << 8; \
+} while (0)
+
+#define QMI_ENCDEC_ENCODE_N_BYTES(p_dst, p_src, size) \
+do { \
+	memcpy(p_dst, p_src, size); \
+	p_dst = (uint8_t *)p_dst + size; \
+	p_src = (uint8_t *)p_src + size; \
+} while (0)
+
+#define QMI_ENCDEC_DECODE_N_BYTES(p_dst, p_src, size) \
+do { \
+	memcpy(p_dst, p_src, size); \
+	p_dst = (uint8_t *)p_dst + size; \
+	p_src = (uint8_t *)p_src + size; \
+} while (0)
+
+#define UPDATE_ENCODE_VARIABLES(temp_si, buf_dst, \
+				encoded_bytes, tlv_len, encode_tlv, rc) \
+do { \
+	buf_dst = (uint8_t *)buf_dst + rc; \
+	encoded_bytes += rc; \
+	tlv_len += rc; \
+	temp_si = temp_si + 1; \
+	encode_tlv = 1; \
+} while (0)
+
+#define UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc) \
+do { \
+	buf_src = (uint8_t *)buf_src + rc; \
+	decoded_bytes += rc; \
+} while (0)
+
+#define TLV_LEN_SIZE sizeof(uint16_t)
+#define TLV_TYPE_SIZE sizeof(uint8_t)
+#define OPTIONAL_TLV_TYPE_START 0x10
+
+static int qmi_encode(struct qmi_elem_info *ei_array, void *out_buf,
+		      const void *in_c_struct, uint32_t out_buf_len,
+		      int enc_level);
+
+static int qmi_decode(struct qmi_elem_info *ei_array, void *out_c_struct,
+		      const void *in_buf, uint32_t in_buf_len, int dec_level);
+
+/**
+ * skip_to_next_elem() - Skip to next element in the structure to be encoded
+ * @ei_array: Struct info describing the element to be skipped.
+ * @level: Depth level of encoding/decoding to identify nested structures.
+ *
+ * This function is used while encoding optional elements. If the flag
+ * corresponding to an optional element is not set, then encoding the
+ * optional element can be skipped. This function can be used to perform
+ * that operation.
+ *
+ * Return: struct info of the next element that can be encoded.
+ */
+static struct qmi_elem_info *skip_to_next_elem(struct qmi_elem_info *ei_array,
+					       int level)
+{
+	struct qmi_elem_info *temp_ei = ei_array;
+	uint8_t tlv_type;
+
+	if (level > 1) {
+		temp_ei = temp_ei + 1;
+	} else {
+		do {
+			tlv_type = temp_ei->tlv_type;
+			temp_ei = temp_ei + 1;
+		} while (tlv_type == temp_ei->tlv_type);
+	}
+
+	return temp_ei;
+}
+
+/**
+ * qmi_calc_min_msg_len() - Calculate the minimum length of a QMI message
+ * @ei_array: Struct info array describing the structure.
+ * @level: Level to identify the depth of the nested structures.
+ *
+ * Return: Expected minimum length of the QMI message or 0 on error.
+ */
+static int qmi_calc_min_msg_len(struct qmi_elem_info *ei_array,
+				int level)
+{
+	int min_msg_len = 0;
+	struct qmi_elem_info *temp_ei = ei_array;
+
+	if (!ei_array)
+		return min_msg_len;
+
+	while (temp_ei->data_type != QMI_EOTI) {
+		/* Optional elements do not count in minimum length */
+		if (temp_ei->data_type == QMI_OPT_FLAG) {
+			temp_ei = skip_to_next_elem(temp_ei, level);
+			continue;
+		}
+
+		if (temp_ei->data_type == QMI_DATA_LEN) {
+			min_msg_len += (temp_ei->elem_size == sizeof(uint8_t) ?
+					sizeof(uint8_t) : sizeof(uint16_t));
+			temp_ei++;
+			continue;
+		} else if (temp_ei->data_type == QMI_STRUCT) {
+			min_msg_len += qmi_calc_min_msg_len(temp_ei->ei_array,
+							    (level + 1));
+			temp_ei++;
+		} else if (temp_ei->data_type == QMI_STRING) {
+			if (level > 1)
+				min_msg_len += temp_ei->elem_len <= 256 ?
+					sizeof(uint8_t) : sizeof(uint16_t);
+			min_msg_len += temp_ei->elem_len * temp_ei->elem_size;
+			temp_ei++;
+		} else {
+			min_msg_len += (temp_ei->elem_len * temp_ei->elem_size);
+			temp_ei++;
+		}
+
+		/*
+		 * Type & Length info. not prepended for elements in the
+		 * nested structure.
+		 */
+		if (level == 1)
+			min_msg_len += (TLV_TYPE_SIZE + TLV_LEN_SIZE);
+	}
+
+	return min_msg_len;
+}
+
+/**
+ * qmi_encode_basic_elem() - Encodes elements of basic/primary data type
+ * @buf_dst: Buffer to store the encoded information.
+ * @buf_src: Buffer containing the elements to be encoded.
+ * @elem_len: Number of elements, in the buf_src, to be encoded.
+ * @elem_size: Size of a single instance of the element to be encoded.
+ *
+ * This function encodes the "elem_len" number of data elements, each of
+ * size "elem_size" bytes from the source buffer "buf_src" and stores the
+ * encoded information in the destination buffer "buf_dst". The elements are
+ * of primary data type which include uint8_t - u64 or similar. This
+ * function returns the number of bytes of encoded information.
+ *
+ * Return: The number of bytes of encoded information.
+ */
+static int qmi_encode_basic_elem(void *buf_dst, const void *buf_src,
+				 uint32_t elem_len, uint32_t elem_size)
+{
+	uint32_t i, rc = 0;
+
+	for (i = 0; i < elem_len; i++) {
+		QMI_ENCDEC_ENCODE_N_BYTES(buf_dst, buf_src, elem_size);
+		rc += elem_size;
+	}
+
+	return rc;
+}
+
+/**
+ * qmi_encode_struct_elem() - Encodes elements of struct data type
+ * @ei_array: Struct info array descibing the struct element.
+ * @buf_dst: Buffer to store the encoded information.
+ * @buf_src: Buffer containing the elements to be encoded.
+ * @elem_len: Number of elements, in the buf_src, to be encoded.
+ * @out_buf_len: Available space in the encode buffer.
+ * @enc_level: Depth of the nested structure from the main structure.
+ *
+ * This function encodes the "elem_len" number of struct elements, each of
+ * size "ei_array->elem_size" bytes from the source buffer "buf_src" and
+ * stores the encoded information in the destination buffer "buf_dst". The
+ * elements are of struct data type which includes any C structure. This
+ * function returns the number of bytes of encoded information.
+ *
+ * Return: The number of bytes of encoded information on success or negative
+ * errno on error.
+ */
+static int qmi_encode_struct_elem(struct qmi_elem_info *ei_array,
+				  void *buf_dst, const void *buf_src,
+				  uint32_t elem_len, uint32_t out_buf_len,
+				  int enc_level)
+{
+	int i, rc, encoded_bytes = 0;
+	struct qmi_elem_info *temp_ei = ei_array;
+
+	for (i = 0; i < elem_len; i++) {
+		rc = qmi_encode(temp_ei->ei_array, buf_dst, buf_src,
+				out_buf_len - encoded_bytes, enc_level);
+		if (rc < 0) {
+			LOGW("%s: STRUCT Encode failure\n", __func__);
+			return rc;
+		}
+		buf_dst = (char*)buf_dst + rc;
+		buf_src = (char*)buf_src + temp_ei->elem_size;
+		encoded_bytes += rc;
+	}
+
+	return encoded_bytes;
+}
+
+/**
+ * qmi_encode_string_elem() - Encodes elements of string data type
+ * @ei_array: Struct info array descibing the string element.
+ * @buf_dst: Buffer to store the encoded information.
+ * @buf_src: Buffer containing the elements to be encoded.
+ * @out_buf_len: Available space in the encode buffer.
+ * @enc_level: Depth of the string element from the main structure.
+ *
+ * This function encodes a string element of maximum length "ei_array->elem_len"
+ * bytes from the source buffer "buf_src" and stores the encoded information in
+ * the destination buffer "buf_dst". This function returns the number of bytes
+ * of encoded information.
+ *
+ * Return: The number of bytes of encoded information on success or negative
+ * errno on error.
+ */
+static int qmi_encode_string_elem(struct qmi_elem_info *ei_array,
+				  void *buf_dst, const void *buf_src,
+				  uint32_t out_buf_len, int enc_level)
+{
+	int rc;
+	int encoded_bytes = 0;
+	struct qmi_elem_info *temp_ei = ei_array;
+	uint32_t string_len = 0;
+	uint32_t string_len_sz = 0;
+
+	string_len = strlen(buf_src);
+	string_len_sz = temp_ei->elem_len <= 256 ?
+			sizeof(uint8_t) : sizeof(uint16_t);
+	if (string_len > temp_ei->elem_len) {
+		LOGW("%s: String to be encoded is longer - %d > %d\n",
+		     __func__, string_len, temp_ei->elem_len);
+		return -EINVAL;
+	}
+
+	if (enc_level == 1) {
+		if (string_len + TLV_LEN_SIZE + TLV_TYPE_SIZE >
+		    out_buf_len) {
+			LOGW("%s: Output len %d > Out Buf len %d\n",
+			     __func__, string_len, out_buf_len);
+			return -EINVAL;
+		}
+	} else {
+		if (string_len + string_len_sz > out_buf_len) {
+			LOGW("%s: Output len %d > Out Buf len %d\n",
+			     __func__, string_len, out_buf_len);
+			return -EINVAL;
+		}
+		rc = qmi_encode_basic_elem(buf_dst, &string_len,
+					   1, string_len_sz);
+		encoded_bytes += rc;
+	}
+
+	rc = qmi_encode_basic_elem((char*)buf_dst + encoded_bytes, buf_src,
+				   string_len, temp_ei->elem_size);
+	encoded_bytes += rc;
+
+	return encoded_bytes;
+}
+
+/**
+ * qmi_encode() - Core Encode Function
+ * @ei_array: Struct info array describing the structure to be encoded.
+ * @out_buf: Buffer to hold the encoded QMI message.
+ * @in_c_struct: Pointer to the C structure to be encoded.
+ * @out_buf_len: Available space in the encode buffer.
+ * @enc_level: Encode level to indicate the depth of the nested structure,
+ *             within the main structure, being encoded.
+ *
+ * Return: The number of bytes of encoded information on success or negative
+ * errno on error.
+ */
+static int qmi_encode(struct qmi_elem_info *ei_array, void *out_buf,
+		      const void *in_c_struct, uint32_t out_buf_len,
+		      int enc_level)
+{
+	struct qmi_elem_info *temp_ei = ei_array;
+	uint8_t opt_flag_value = 0;
+	uint32_t data_len_value = 0, data_len_sz;
+	uint8_t *buf_dst = (uint8_t *)out_buf;
+	uint8_t *tlv_pointer;
+	uint32_t tlv_len;
+	uint8_t tlv_type;
+	uint32_t encoded_bytes = 0;
+	const void *buf_src;
+	int encode_tlv = 0;
+	int rc;
+
+	if (!ei_array)
+		return 0;
+
+	tlv_pointer = buf_dst;
+	tlv_len = 0;
+	if (enc_level == 1)
+		buf_dst = buf_dst + (TLV_LEN_SIZE + TLV_TYPE_SIZE);
+
+	while (temp_ei->data_type != QMI_EOTI) {
+		buf_src = (char*)in_c_struct + temp_ei->offset;
+		tlv_type = temp_ei->tlv_type;
+
+		if (temp_ei->array_type == NO_ARRAY) {
+			data_len_value = 1;
+		} else if (temp_ei->array_type == STATIC_ARRAY) {
+			data_len_value = temp_ei->elem_len;
+		} else if (data_len_value <= 0 ||
+			    temp_ei->elem_len < data_len_value) {
+			LOGW("%s: Invalid data length\n", __func__);
+			return -EINVAL;
+		}
+
+		switch (temp_ei->data_type) {
+		case QMI_OPT_FLAG:
+			rc = qmi_encode_basic_elem(&opt_flag_value, buf_src,
+						   1, sizeof(uint8_t));
+			if (opt_flag_value)
+				temp_ei = temp_ei + 1;
+			else
+				temp_ei = skip_to_next_elem(temp_ei, enc_level);
+			break;
+
+		case QMI_DATA_LEN:
+			memcpy(&data_len_value, buf_src, temp_ei->elem_size);
+			data_len_sz = temp_ei->elem_size == sizeof(uint8_t) ?
+					sizeof(uint8_t) : sizeof(uint16_t);
+			/* Check to avoid out of range buffer access */
+			if ((data_len_sz + encoded_bytes + TLV_LEN_SIZE +
+			    TLV_TYPE_SIZE) > out_buf_len) {
+				LOGW("%s: Too Small Buffer @DATA_LEN\n",
+				       __func__);
+				return -EINVAL;
+			}
+			rc = qmi_encode_basic_elem(buf_dst, &data_len_value,
+						   1, data_len_sz);
+			UPDATE_ENCODE_VARIABLES(temp_ei, buf_dst,
+						encoded_bytes, tlv_len,
+						encode_tlv, rc);
+			if (!data_len_value)
+				temp_ei = skip_to_next_elem(temp_ei, enc_level);
+			else
+				encode_tlv = 0;
+			break;
+
+		case QMI_UNSIGNED_1_BYTE:
+		case QMI_UNSIGNED_2_BYTE:
+		case QMI_UNSIGNED_4_BYTE:
+		case QMI_UNSIGNED_8_BYTE:
+		case QMI_SIGNED_1_BYTE_ENUM:
+		case QMI_SIGNED_2_BYTE_ENUM:
+		case QMI_SIGNED_4_BYTE_ENUM:
+			/* Check to avoid out of range buffer access */
+			if (((data_len_value * temp_ei->elem_size) +
+			    encoded_bytes + TLV_LEN_SIZE + TLV_TYPE_SIZE) >
+			    out_buf_len) {
+				LOGW("%s: Too Small Buffer @data_type:%d\n",
+				     __func__, temp_ei->data_type);
+				return -EINVAL;
+			}
+			rc = qmi_encode_basic_elem(buf_dst, buf_src,
+						   data_len_value,
+						   temp_ei->elem_size);
+			UPDATE_ENCODE_VARIABLES(temp_ei, buf_dst,
+						encoded_bytes, tlv_len,
+						encode_tlv, rc);
+			break;
+
+		case QMI_STRUCT:
+			rc = qmi_encode_struct_elem(temp_ei, buf_dst, buf_src,
+						    data_len_value,
+						    out_buf_len - encoded_bytes,
+						    enc_level + 1);
+			if (rc < 0)
+				return rc;
+			UPDATE_ENCODE_VARIABLES(temp_ei, buf_dst,
+						encoded_bytes, tlv_len,
+						encode_tlv, rc);
+			break;
+
+		case QMI_STRING:
+			rc = qmi_encode_string_elem(temp_ei, buf_dst, buf_src,
+						    out_buf_len - encoded_bytes,
+						    enc_level);
+			if (rc < 0)
+				return rc;
+			UPDATE_ENCODE_VARIABLES(temp_ei, buf_dst,
+						encoded_bytes, tlv_len,
+						encode_tlv, rc);
+			break;
+		default:
+			LOGW("%s: Unrecognized data type\n", __func__);
+			return -EINVAL;
+		}
+
+		if (encode_tlv && enc_level == 1) {
+			QMI_ENCDEC_ENCODE_TLV(tlv_type, tlv_len, tlv_pointer);
+			encoded_bytes += (TLV_TYPE_SIZE + TLV_LEN_SIZE);
+			tlv_pointer = buf_dst;
+			tlv_len = 0;
+			buf_dst = buf_dst + TLV_LEN_SIZE + TLV_TYPE_SIZE;
+			encode_tlv = 0;
+		}
+	}
+
+	return encoded_bytes;
+}
+
+/**
+ * qmi_decode_basic_elem() - Decodes elements of basic/primary data type
+ * @buf_dst: Buffer to store the decoded element.
+ * @buf_src: Buffer containing the elements in QMI wire format.
+ * @elem_len: Number of elements to be decoded.
+ * @elem_size: Size of a single instance of the element to be decoded.
+ *
+ * This function decodes the "elem_len" number of elements in QMI wire format,
+ * each of size "elem_size" bytes from the source buffer "buf_src" and stores
+ * the decoded elements in the destination buffer "buf_dst". The elements are
+ * of primary data type which include uint8_t - u64 or similar. This
+ * function returns the number of bytes of decoded information.
+ *
+ * Return: The total size of the decoded data elements, in bytes.
+ */
+static int qmi_decode_basic_elem(void *buf_dst, const void *buf_src,
+				 uint32_t elem_len, uint32_t elem_size)
+{
+	uint32_t i, rc = 0;
+
+	for (i = 0; i < elem_len; i++) {
+		QMI_ENCDEC_DECODE_N_BYTES(buf_dst, buf_src, elem_size);
+		rc += elem_size;
+	}
+
+	return rc;
+}
+
+/**
+ * qmi_decode_struct_elem() - Decodes elements of struct data type
+ * @ei_array: Struct info array descibing the struct element.
+ * @buf_dst: Buffer to store the decoded element.
+ * @buf_src: Buffer containing the elements in QMI wire format.
+ * @elem_len: Number of elements to be decoded.
+ * @tlv_len: Total size of the encoded inforation corresponding to
+ *           this struct element.
+ * @dec_level: Depth of the nested structure from the main structure.
+ *
+ * This function decodes the "elem_len" number of elements in QMI wire format,
+ * each of size "(tlv_len/elem_len)" bytes from the source buffer "buf_src"
+ * and stores the decoded elements in the destination buffer "buf_dst". The
+ * elements are of struct data type which includes any C structure. This
+ * function returns the number of bytes of decoded information.
+ *
+ * Return: The total size of the decoded data elements on success, negative
+ * errno on error.
+ */
+static int qmi_decode_struct_elem(struct qmi_elem_info *ei_array,
+				  void *buf_dst, const void *buf_src,
+				  uint32_t elem_len, uint32_t tlv_len,
+				  int dec_level)
+{
+	int i, rc, decoded_bytes = 0;
+	struct qmi_elem_info *temp_ei = ei_array;
+
+	for (i = 0; i < elem_len && decoded_bytes < tlv_len; i++) {
+		rc = qmi_decode(temp_ei->ei_array, buf_dst, buf_src,
+				tlv_len - decoded_bytes, dec_level);
+		if (rc < 0)
+			return rc;
+		buf_src = (char*)buf_src + rc;
+		buf_dst = (char*)buf_dst + temp_ei->elem_size;
+		decoded_bytes += rc;
+	}
+
+	if ((dec_level <= 2 && decoded_bytes != tlv_len) ||
+	    (dec_level > 2 && (i < elem_len || decoded_bytes > tlv_len))) {
+		LOGW("%s: Fault in decoding: dl(%d), db(%d), tl(%d), i(%d), el(%d)\n",
+		     __func__, dec_level, decoded_bytes, tlv_len,
+		     i, elem_len);
+		return -EFAULT;
+	}
+
+	return decoded_bytes;
+}
+
+/**
+ * qmi_decode_string_elem() - Decodes elements of string data type
+ * @ei_array: Struct info array descibing the string element.
+ * @buf_dst: Buffer to store the decoded element.
+ * @buf_src: Buffer containing the elements in QMI wire format.
+ * @tlv_len: Total size of the encoded inforation corresponding to
+ *           this string element.
+ * @dec_level: Depth of the string element from the main structure.
+ *
+ * This function decodes the string element of maximum length
+ * "ei_array->elem_len" from the source buffer "buf_src" and puts it into
+ * the destination buffer "buf_dst". This function returns number of bytes
+ * decoded from the input buffer.
+ *
+ * Return: The total size of the decoded data elements on success, negative
+ * errno on error.
+ */
+static int qmi_decode_string_elem(struct qmi_elem_info *ei_array,
+				  void *buf_dst, const void *buf_src,
+				  uint32_t tlv_len, int dec_level)
+{
+	int rc;
+	int decoded_bytes = 0;
+	uint32_t string_len = 0;
+	uint32_t string_len_sz = 0;
+	struct qmi_elem_info *temp_ei = ei_array;
+
+	if (dec_level == 1) {
+		string_len = tlv_len;
+	} else {
+		string_len_sz = temp_ei->elem_len <= 256 ?
+				sizeof(uint8_t) : sizeof(uint16_t);
+		rc = qmi_decode_basic_elem(&string_len, buf_src,
+					   1, string_len_sz);
+		decoded_bytes += rc;
+	}
+
+	if (string_len > temp_ei->elem_len) {
+		LOGW("%s: String len %d > Max Len %d\n",
+		     __func__, string_len, temp_ei->elem_len);
+		return -EINVAL;
+	} else if (string_len > tlv_len) {
+		LOGW("%s: String len %d > Input Buffer Len %d\n",
+		     __func__, string_len, tlv_len);
+		return -EFAULT;
+	}
+
+	rc = qmi_decode_basic_elem(buf_dst, (char*)buf_src + decoded_bytes,
+				   string_len, temp_ei->elem_size);
+	*((char *)buf_dst + string_len) = '\0';
+	decoded_bytes += rc;
+
+	return decoded_bytes;
+}
+
+/**
+ * find_ei() - Find element info corresponding to TLV Type
+ * @ei_array: Struct info array of the message being decoded.
+ * @type: TLV Type of the element being searched.
+ *
+ * Every element that got encoded in the QMI message will have a type
+ * information associated with it. While decoding the QMI message,
+ * this function is used to find the struct info regarding the element
+ * that corresponds to the type being decoded.
+ *
+ * Return: Pointer to struct info, if found
+ */
+static struct qmi_elem_info *find_ei(struct qmi_elem_info *ei_array,
+				     uint32_t type)
+{
+	struct qmi_elem_info *temp_ei = ei_array;
+
+	while (temp_ei->data_type != QMI_EOTI) {
+		if (temp_ei->tlv_type == (uint8_t)type)
+			return temp_ei;
+		temp_ei = temp_ei + 1;
+	}
+
+	return NULL;
+}
+
+/**
+ * qmi_decode() - Core Decode Function
+ * @ei_array: Struct info array describing the structure to be decoded.
+ * @out_c_struct: Buffer to hold the decoded C struct
+ * @in_buf: Buffer containing the QMI message to be decoded
+ * @in_buf_len: Length of the QMI message to be decoded
+ * @dec_level: Decode level to indicate the depth of the nested structure,
+ *             within the main structure, being decoded
+ *
+ * Return: The number of bytes of decoded information on success, negative
+ * errno on error.
+ */
+static int qmi_decode(struct qmi_elem_info *ei_array, void *out_c_struct,
+		      const void *in_buf, uint32_t in_buf_len,
+		      int dec_level)
+{
+	struct qmi_elem_info *temp_ei = ei_array;
+	uint8_t opt_flag_value = 1;
+	uint32_t data_len_value = 0, data_len_sz = 0;
+	uint8_t *buf_dst = out_c_struct;
+	const uint8_t *tlv_pointer;
+	uint32_t tlv_len = 0;
+	uint32_t tlv_type;
+	uint32_t decoded_bytes = 0;
+	const void *buf_src = in_buf;
+	int rc;
+
+	while (decoded_bytes < in_buf_len) {
+		if (dec_level >= 2 && temp_ei->data_type == QMI_EOTI)
+			return decoded_bytes;
+
+		if (dec_level == 1) {
+			tlv_pointer = buf_src;
+			QMI_ENCDEC_DECODE_TLV(&tlv_type,
+					      &tlv_len, tlv_pointer);
+			buf_src = (uint8_t*)buf_src + (TLV_TYPE_SIZE + TLV_LEN_SIZE);
+			decoded_bytes += (TLV_TYPE_SIZE + TLV_LEN_SIZE);
+			temp_ei = find_ei(ei_array, tlv_type);
+			if (!temp_ei && tlv_type < OPTIONAL_TLV_TYPE_START) {
+				LOGW("%s: Inval element info\n", __func__);
+				return -EINVAL;
+			} else if (!temp_ei) {
+				UPDATE_DECODE_VARIABLES(buf_src,
+							decoded_bytes, tlv_len);
+				continue;
+			}
+		} else {
+			/*
+			 * No length information for elements in nested
+			 * structures. So use remaining decodable buffer space.
+			 */
+			tlv_len = in_buf_len - decoded_bytes;
+		}
+
+		buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
+		if (temp_ei->data_type == QMI_OPT_FLAG) {
+			memcpy(buf_dst, &opt_flag_value, sizeof(uint8_t));
+			temp_ei = temp_ei + 1;
+			buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
+		}
+
+		if (temp_ei->data_type == QMI_DATA_LEN) {
+			data_len_sz = temp_ei->elem_size == sizeof(uint8_t) ?
+					sizeof(uint8_t) : sizeof(uint16_t);
+			rc = qmi_decode_basic_elem(&data_len_value, buf_src,
+						   1, data_len_sz);
+			memcpy(buf_dst, &data_len_value, sizeof(uint32_t));
+			temp_ei = temp_ei + 1;
+			buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
+			tlv_len -= data_len_sz;
+			UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
+		}
+
+		if (temp_ei->array_type == NO_ARRAY) {
+			data_len_value = 1;
+		} else if (temp_ei->array_type == STATIC_ARRAY) {
+			data_len_value = temp_ei->elem_len;
+		} else if (data_len_value > temp_ei->elem_len) {
+			LOGW("%s: Data len %d > max spec %d\n",
+			     __func__, data_len_value, temp_ei->elem_len);
+			return -EINVAL;
+		}
+
+		switch (temp_ei->data_type) {
+		case QMI_UNSIGNED_1_BYTE:
+		case QMI_UNSIGNED_2_BYTE:
+		case QMI_UNSIGNED_4_BYTE:
+		case QMI_UNSIGNED_8_BYTE:
+		case QMI_SIGNED_1_BYTE_ENUM:
+		case QMI_SIGNED_2_BYTE_ENUM:
+		case QMI_SIGNED_4_BYTE_ENUM:
+			rc = qmi_decode_basic_elem(buf_dst, buf_src,
+						   data_len_value,
+						   temp_ei->elem_size);
+			UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
+			break;
+
+		case QMI_STRUCT:
+			rc = qmi_decode_struct_elem(temp_ei, buf_dst, buf_src,
+						    data_len_value, tlv_len,
+						    dec_level + 1);
+			if (rc < 0)
+				return rc;
+			UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
+			break;
+
+		case QMI_STRING:
+			rc = qmi_decode_string_elem(temp_ei, buf_dst, buf_src,
+						    tlv_len, dec_level);
+			if (rc < 0)
+				return rc;
+			UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
+			break;
+
+		default:
+			LOGW("%s: Unrecognized data type\n", __func__);
+			return -EINVAL;
+		}
+		temp_ei = temp_ei + 1;
+	}
+
+	return decoded_bytes;
+}
+
+/**
+ * qmi_encode_message() - Encode C structure as QMI encoded message
+ * @type:	Type of QMI message
+ * @msg_id:	Message ID of the message
+ * @len:	Passed as max length of the message, updated to actual size
+ * @txn_id:	Transaction ID
+ * @ei:		QMI message descriptor
+ * @c_struct:	Reference to structure to encode
+ *
+ * Return: Buffer with encoded message, or negative ERR_PTR() on error
+ */
+ssize_t qmi_encode_message(struct qrtr_packet *pkt, int type, int msg_id,
+			   int txn_id, const void *c_struct,
+			   struct qmi_elem_info *ei)
+{
+	struct qmi_header *hdr = pkt->data;
+	ssize_t msglen = 0;
+	int ret;
+
+	/* Check the possibility of a zero length QMI message */
+	if (!c_struct) {
+		ret = qmi_calc_min_msg_len(ei, 1);
+		if (ret) {
+			LOGW("%s: Calc. len %d != 0, but NULL c_struct\n",
+			     __func__, ret);
+			return -EINVAL;
+		}
+	}
+
+	if (pkt->data_len < sizeof(*hdr))
+		return -EMSGSIZE;
+
+	/* Encode message, if we have a message */
+	if (c_struct) {
+		msglen = qmi_encode(ei, (char*)pkt->data + sizeof(*hdr), c_struct,
+				    pkt->data_len - sizeof(*hdr), 1);
+		if (msglen < 0)
+			return msglen;
+	}
+
+	hdr->type = type;
+	hdr->txn_id = txn_id;
+	hdr->msg_id = msg_id;
+	hdr->msg_len = msglen;
+
+	pkt->type = QRTR_TYPE_DATA;
+	pkt->data_len = sizeof(*hdr) + msglen;
+
+	return pkt->data_len;
+}
+
+int qmi_decode_header(const struct qrtr_packet *pkt, unsigned int *msg_id)
+{
+	const struct qmi_header *qmi = pkt->data;
+
+	if (qmi->msg_len != pkt->data_len - sizeof(*qmi)) {
+		LOGW("[RMTFS] Invalid length of incoming qmi request\n");
+		return -EINVAL;
+	}
+
+	*msg_id = qmi->msg_id;
+
+	return 0;
+}
+
+/**
+ * qmi_decode_message() - Decode QMI encoded message to C structure
+ * @buf:	Buffer with encoded message
+ * @len:	Amount of data in @buf
+ * @ei:		QMI message descriptor
+ * @c_struct:	Reference to structure to decode into
+ *
+ * Return: The number of bytes of decoded information on success, negative
+ * errno on error.
+ */
+int qmi_decode_message(void *c_struct, unsigned int *txn,
+		       const struct qrtr_packet *pkt,
+		       int type, int id, struct qmi_elem_info *ei)
+{
+	const struct qmi_header *hdr = pkt->data;
+
+	if (!ei)
+		return -EINVAL;
+
+	if (!c_struct || !pkt->data || !pkt->data_len)
+		return -EINVAL;
+
+	if (hdr->type != type)
+		return -EINVAL;
+
+	if (hdr->msg_id != id)
+		return -EINVAL;
+
+	if (txn)
+		*txn = hdr->txn_id;
+
+	return qmi_decode(ei, c_struct, (char*)pkt->data + sizeof(*hdr), pkt->data_len - sizeof(*hdr), 1);
+}
+
+/* Common header in all QMI responses */
+struct qmi_elem_info qmi_response_type_v01_ei[] = {
+	{
+		.data_type	= QMI_SIGNED_2_BYTE_ENUM,
+		.elem_len	= 1,
+		.elem_size	= sizeof(uint16_t),
+		.array_type	= NO_ARRAY,
+		.tlv_type	= QMI_COMMON_TLV_TYPE,
+		.offset		= offsetof(struct qmi_response_type_v01, result),
+		.ei_array	= NULL,
+	},
+	{
+		.data_type	= QMI_SIGNED_2_BYTE_ENUM,
+		.elem_len	= 1,
+		.elem_size	= sizeof(uint16_t),
+		.array_type	= NO_ARRAY,
+		.tlv_type	= QMI_COMMON_TLV_TYPE,
+		.offset		= offsetof(struct qmi_response_type_v01, error),
+		.ei_array	= NULL,
+	},
+	{
+		.data_type	= QMI_EOTI,
+		.elem_len	= 0,
+		.elem_size	= 0,
+		.array_type	= NO_ARRAY,
+		.tlv_type	= QMI_COMMON_TLV_TYPE,
+		.offset		= 0,
+		.ei_array	= NULL,
+	},
+};
diff --git a/shared/vendor/qrtr/lib/qrtr.c b/shared/vendor/qrtr/lib/qrtr.c
new file mode 100644
index 0000000..7c1c389
--- /dev/null
+++ b/shared/vendor/qrtr/lib/qrtr.c
@@ -0,0 +1,258 @@
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <linux/qrtr.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <poll.h>
+
+#include "libqrtr.h"
+#include "logging.h"
+#include "ns.h"
+
+static int qrtr_getname(int sock, struct sockaddr_qrtr *sq)
+{
+	socklen_t sl = sizeof(*sq);
+	int rc;
+
+	rc = getsockname(sock, (void *)sq, &sl);
+	if (rc) {
+		PLOGE("getsockname()");
+		return -1;
+	}
+
+	if (sq->sq_family != AF_QIPCRTR || sl != sizeof(*sq))
+		return -1;
+
+	return 0;
+}
+
+int qrtr_open(int rport)
+{
+	struct timeval tv;
+	int sock;
+	int rc;
+
+	sock = socket(AF_QIPCRTR, SOCK_DGRAM, 0);
+	if (sock < 0) {
+		PLOGE("socket(AF_QIPCRTR)");
+		return -1;
+	}
+
+	tv.tv_sec = 1;
+	tv.tv_usec = 0;
+
+	rc = setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+	if (rc) {
+		PLOGE("setsockopt(SO_RCVTIMEO)");
+		goto err;
+	}
+
+	if (rport != 0) {
+		struct sockaddr_qrtr sq;
+
+		sq.sq_family = AF_QIPCRTR;
+		sq.sq_node = 1;
+		sq.sq_port = rport;
+
+		rc = bind(sock, (void *)&sq, sizeof(sq));
+		if (rc < 0) {
+			PLOGE("bind(%d)", rport);
+			goto err;
+		}
+	}
+
+	return sock;
+err:
+	close(sock);
+	return -1;
+}
+
+void qrtr_close(int sock)
+{
+	close(sock);
+}
+
+int qrtr_sendto(int sock, uint32_t node, uint32_t port, const void *data, unsigned int sz)
+{
+	struct sockaddr_qrtr sq;
+	int rc;
+
+	sq.sq_family = AF_QIPCRTR;
+	sq.sq_node = node;
+	sq.sq_port = port;
+
+	rc = sendto(sock, data, sz, 0, (void *)&sq, sizeof(sq));
+	if (rc < 0) {
+		PLOGE("sendto()");
+		return -1;
+	}
+
+	return 0;
+}
+
+int qrtr_new_server(int sock, uint32_t service, uint16_t version, uint16_t instance)
+{
+	struct qrtr_ctrl_pkt pkt;
+	struct sockaddr_qrtr sq;
+
+	if (qrtr_getname(sock, &sq))
+		return -1;
+
+	memset(&pkt, 0, sizeof(pkt));
+
+	pkt.cmd = cpu_to_le32(QRTR_TYPE_NEW_SERVER);
+	pkt.server.service = cpu_to_le32(service);
+	pkt.server.instance = cpu_to_le32(instance << 8 | version);
+
+	return qrtr_sendto(sock, sq.sq_node, QRTR_PORT_CTRL, &pkt, sizeof(pkt));
+}
+
+int qrtr_remove_server(int sock, uint32_t service, uint16_t version, uint16_t instance)
+{
+	struct qrtr_ctrl_pkt pkt;
+	struct sockaddr_qrtr sq;
+
+	if (qrtr_getname(sock, &sq))
+		return -1;
+
+	memset(&pkt, 0, sizeof(pkt));
+
+	pkt.cmd = cpu_to_le32(QRTR_TYPE_DEL_SERVER);
+	pkt.server.service = cpu_to_le32(service);
+	pkt.server.instance = cpu_to_le32(instance << 8 | version);
+	pkt.server.node = cpu_to_le32(sq.sq_node);
+	pkt.server.port = cpu_to_le32(sq.sq_port);
+
+	return qrtr_sendto(sock, sq.sq_node, QRTR_PORT_CTRL, &pkt, sizeof(pkt));
+}
+
+int qrtr_publish(int sock, uint32_t service, uint16_t version, uint16_t instance)
+{
+	return qrtr_new_server(sock, service, version, instance);
+}
+
+int qrtr_bye(int sock, uint32_t service, uint16_t version, uint16_t instance)
+{
+	return qrtr_remove_server(sock, service, version, instance);
+}
+
+int qrtr_new_lookup(int sock, uint32_t service, uint16_t version, uint16_t instance)
+{
+	struct qrtr_ctrl_pkt pkt;
+	struct sockaddr_qrtr sq;
+
+	if (qrtr_getname(sock, &sq))
+		return -1;
+
+	memset(&pkt, 0, sizeof(pkt));
+
+	pkt.cmd = cpu_to_le32(QRTR_TYPE_NEW_LOOKUP);
+	pkt.server.service = cpu_to_le32(service);
+	pkt.server.instance = cpu_to_le32(instance << 8 | version);
+
+	return qrtr_sendto(sock, sq.sq_node, QRTR_PORT_CTRL, &pkt, sizeof(pkt));
+}
+
+int qrtr_remove_lookup(int sock, uint32_t service, uint16_t version, uint16_t instance)
+{
+	struct qrtr_ctrl_pkt pkt;
+	struct sockaddr_qrtr sq;
+
+	if (qrtr_getname(sock, &sq))
+		return -1;
+
+	memset(&pkt, 0, sizeof(pkt));
+
+	pkt.cmd = cpu_to_le32(QRTR_TYPE_DEL_LOOKUP);
+	pkt.server.service = cpu_to_le32(service);
+	pkt.server.instance = cpu_to_le32(instance << 8 | version);
+	pkt.server.node = cpu_to_le32(sq.sq_node);
+	pkt.server.port = cpu_to_le32(sq.sq_port);
+
+	return qrtr_sendto(sock, sq.sq_node, QRTR_PORT_CTRL, &pkt, sizeof(pkt));
+}
+
+int qrtr_poll(int sock, unsigned int ms)
+{
+	struct pollfd fds;
+
+	fds.fd = sock;
+	fds.revents = 0;
+	fds.events = POLLIN | POLLERR;
+
+	return poll(&fds, 1, ms);
+}
+
+int qrtr_recv(int sock, void *buf, unsigned int bsz)
+{
+	int rc;
+
+	rc = recv(sock, buf, bsz, 0);
+	if (rc < 0)
+		PLOGE("recv()");
+	return rc;
+}
+
+int qrtr_recvfrom(int sock, void *buf, unsigned int bsz, uint32_t *node, uint32_t *port)
+{
+	struct sockaddr_qrtr sq;
+	socklen_t sl;
+	int rc;
+
+	sl = sizeof(sq);
+	rc = recvfrom(sock, buf, bsz, 0, (void *)&sq, &sl);
+	if (rc < 0) {
+		PLOGE("recvfrom()");
+		return rc;
+	}
+	if (node)
+		*node = sq.sq_node;
+	if (port)
+		*port = sq.sq_port;
+	return rc;
+}
+
+int qrtr_decode(struct qrtr_packet *dest, void *buf, size_t len,
+		const struct sockaddr_qrtr *sq)
+{
+	const struct qrtr_ctrl_pkt *ctrl = buf;
+
+	if (sq->sq_port == QRTR_PORT_CTRL){
+		if (len < sizeof(*ctrl))
+			return -EMSGSIZE;
+
+		dest->type = le32_to_cpu(ctrl->cmd);
+		switch (dest->type) {
+		case QRTR_TYPE_BYE:
+			dest->node = le32_to_cpu(ctrl->client.node);
+			break;
+		case QRTR_TYPE_DEL_CLIENT:
+			dest->node = le32_to_cpu(ctrl->client.node);
+			dest->port = le32_to_cpu(ctrl->client.port);
+			break;
+		case QRTR_TYPE_NEW_SERVER:
+		case QRTR_TYPE_DEL_SERVER:
+			dest->node = le32_to_cpu(ctrl->server.node);
+			dest->port = le32_to_cpu(ctrl->server.port);
+			dest->service = le32_to_cpu(ctrl->server.service);
+			dest->version = le32_to_cpu(ctrl->server.instance) & 0xff;
+			dest->instance = le32_to_cpu(ctrl->server.instance) >> 8;
+			break;
+		default:
+			dest->type = 0;
+		}
+	} else {
+		dest->type = QRTR_TYPE_DATA;
+		dest->node = sq->sq_node;
+		dest->port = sq->sq_port;
+
+		dest->data = buf;
+		dest->data_len = len;
+	}
+
+	return 0;
+}
diff --git a/shared/vendor/qrtr/qrtr-ns.service.in b/shared/vendor/qrtr/qrtr-ns.service.in
new file mode 100644
index 0000000..eaa791a
--- /dev/null
+++ b/shared/vendor/qrtr/qrtr-ns.service.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=QIPCRTR Name Service
+
+[Service]
+ExecStart=QRTR_NS_PATH/qrtr-ns -f 1
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
diff --git a/shared/vendor/qrtr/qrtr.py b/shared/vendor/qrtr/qrtr.py
new file mode 100755
index 0000000..ab6189a
--- /dev/null
+++ b/shared/vendor/qrtr/qrtr.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python2.7
+
+import ctypes
+import collections
+
+from ctypes import CDLL, CFUNCTYPE, POINTER, cast, py_object
+from ctypes import c_char_p, c_void_p, c_int, pointer
+
+_qrtr = CDLL("./libqrtr.so")
+
+class qrtr:
+    Result = collections.namedtuple('Result', ['service', 'instance', 'addr'])
+    _cbtype = CFUNCTYPE(None, c_void_p, c_int, c_int, c_int, c_int)
+    def __init__(self, port=0):
+        self.sock = _qrtr.qrtr_open(port)
+        if self.sock < 0:
+            raise RuntimeError("unable to open qrtr socket")
+        self.service = None
+        self._qrtr = _qrtr
+
+    def __del__(self):
+        self._qrtr.qrtr_close(self.sock)
+
+    def _lookup_list_add(self, ptr, srv, instance, node, port):
+        res = qrtr.Result(srv, instance, (node, port))
+        cast(ptr, POINTER(py_object)).contents.value.append(res)
+
+    def lookup(self, srv, instance=0, ifilter=0):
+        results = []
+        err = _qrtr.qrtr_lookup(self.sock, srv, instance, ifilter,
+                qrtr._cbtype(self._lookup_list_add), cast(pointer(py_object(results)), c_void_p))
+        if err:
+            raise RuntimeError("query failed")
+        return results
+
+    def publish(self, service, version, instance):
+        err = _qrtr.qrtr_publish(self.sock, service, version, instance)
+        if err:
+            raise RuntimeError("publish failed")
+        self.service = (service, version, instance)
+
+    def new_server(self, service, version, instance):
+        err = _qrtr.qrtr_new_server(self.sock, service, version, instance)
+        if err:
+            raise RuntimeError("new_server failed")
+        self.service = (service, version, instance)
+
+        return self.service
+
+    def remove_server(self, service):
+        err = _qrtr.qrtr_remove_server(self.sock, *service)
+        if err:
+            raise RuntimeError("remove_server failed")
+        self.service = None
+
+    def new_lookup(self, service, version, instance):
+        err = _qrtr.qrtr_new_lookup(self.sock, service, version, instance)
+        if err:
+            raise RuntimeError("new_lookup failed")
+        return (service, version, instance)
+
+    def remove_lookup(self, lookup):
+        err = _qrtr.qrtr_remove_lookup(self.sock, *lookup)
+        if err:
+            raise RuntimeError("remove_lookup failed")
+
+    def send(self, addr, data):
+        node, port = addr
+        n = _qrtr.qrtr_sendto(self.sock, node, port, c_char_p(data), len(data))
+        if n:
+            raise RuntimeError("sendto failed")
+
+    def recv(self, sz=65536):
+        buf = ctypes.create_string_buffer(sz)
+        n = _qrtr.qrtr_recv(self.sock, c_char_p(ctypes.addressof(buf)), sz)
+        if n <= 0:
+            raise RuntimeError("recv failed")
+        return buf[0:n]
+
+    def recvfrom(self, sz=65536):
+        node = ctypes.c_int()
+        port = ctypes.c_int()
+        buf = ctypes.create_string_buffer(sz)
+        n = _qrtr.qrtr_recvfrom(self.sock, c_char_p(ctypes.addressof(buf)),
+                ctypes.byref(node), ctypes.byref(port))
+        if n <= 0:
+            raise RuntimeError("recvfrom failed")
+        return (buf[0:n], (node.value, port.value))
+
+    def poll(self, tout=0):
+        return _qrtr.qrtr_poll(self.sock, tout)
+
+if __name__ == "__main__":
+    svcs = qrtr().lookup(15) # 15 is the test service
+    print " service  instance  addr"
+    for svc in svcs:
+        print "% 8d  % 8d  %s" % (svc.service, svc.instance, svc.addr)
diff --git a/shared/vendor/qrtr/src/addr.c b/shared/vendor/qrtr/src/addr.c
new file mode 100644
index 0000000..61417dd
--- /dev/null
+++ b/shared/vendor/qrtr/src/addr.c
@@ -0,0 +1,77 @@
+#include <err.h>
+#include <errno.h>
+#include <linux/qrtr.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include "libqrtr.h"
+#include "logging.h"
+
+void qrtr_set_address(uint32_t addr)
+{
+	struct {
+		struct nlmsghdr nh;
+		struct ifaddrmsg ifa;
+		char attrbuf[32];
+	} req;
+	struct {
+		struct nlmsghdr nh;
+		struct nlmsgerr err;
+	} resp;
+	struct sockaddr_qrtr sq;
+	struct rtattr *rta;
+	socklen_t sl = sizeof(sq);
+	int sock;
+	int ret;
+
+	/* Trigger loading of the qrtr kernel module */
+	sock = socket(AF_QIPCRTR, SOCK_DGRAM, 0);
+	if (sock < 0)
+		PLOGE_AND_EXIT("failed to create AF_QIPCRTR socket");
+
+	ret = getsockname(sock, (void*)&sq, &sl);
+	if (ret < 0)
+		PLOGE_AND_EXIT("getsockname()");
+	close(sock);
+
+	/* Skip configuring the address, if it's same as current */
+	if (sl == sizeof(sq) && sq.sq_node == addr)
+		return;
+
+	sock = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
+	if (sock < 0)
+		PLOGE_AND_EXIT("failed to create netlink socket");
+
+	memset(&req, 0, sizeof(req));
+	req.nh.nlmsg_len = NLMSG_SPACE(sizeof(struct ifaddrmsg));
+	req.nh.nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
+	req.nh.nlmsg_type = RTM_NEWADDR;
+	req.ifa.ifa_family = AF_QIPCRTR;
+
+	rta = (struct rtattr *)(((char *) &req) + req.nh.nlmsg_len);
+	rta->rta_type = IFA_LOCAL;
+	rta->rta_len = RTA_LENGTH(sizeof(addr));
+	memcpy(RTA_DATA(rta), &addr, sizeof(addr));
+
+	req.nh.nlmsg_len += rta->rta_len;
+
+	ret = send(sock, &req, req.nh.nlmsg_len, 0);
+	if (ret < 0)
+		PLOGE_AND_EXIT("failed to send netlink request");
+
+	ret = recv(sock, &resp, sizeof(resp), 0);
+	if (ret < 0)
+		PLOGE_AND_EXIT("failed to receive netlink response");
+
+	if (resp.nh.nlmsg_type == NLMSG_ERROR && resp.err.error != 0) {
+		errno = -resp.err.error;
+		PLOGE_AND_EXIT("failed to configure node id");
+	}
+
+	close(sock);
+}
diff --git a/shared/vendor/qrtr/src/addr.h b/shared/vendor/qrtr/src/addr.h
new file mode 100644
index 0000000..524e335
--- /dev/null
+++ b/shared/vendor/qrtr/src/addr.h
@@ -0,0 +1,8 @@
+#ifndef __ADDR_H_
+#define __ADDR_H_
+
+#include <stdint.h>
+
+void qrtr_set_address(uint32_t addr);
+
+#endif
diff --git a/shared/vendor/qrtr/src/cfg.c b/shared/vendor/qrtr/src/cfg.c
new file mode 100644
index 0000000..97a8352
--- /dev/null
+++ b/shared/vendor/qrtr/src/cfg.c
@@ -0,0 +1,44 @@
+#include <err.h>
+#include <errno.h>
+#include <libgen.h>
+#include <limits.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <linux/qrtr.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "addr.h"
+#include "libqrtr.h"
+#include "logging.h"
+
+static void usage(const char *progname)
+{
+	fprintf(stderr, "%s <node-id>\n", progname);
+	exit(1);
+}
+
+int main(int argc, char **argv)
+{
+	unsigned long addrul;
+	uint32_t addr;
+	char *ep;
+	const char *progname = basename(argv[0]);
+
+	qlog_setup(progname, false);
+
+	if (argc != 2)
+		usage(progname);
+
+	addrul = strtoul(argv[1], &ep, 10);
+	if (argv[1][0] == '\0' || *ep != '\0' || addrul >= UINT_MAX)
+		usage(progname);
+	addr = addrul;
+	qrtr_set_address(addr);
+
+	return 0;
+}
diff --git a/shared/vendor/qrtr/src/hash.c b/shared/vendor/qrtr/src/hash.c
new file mode 100644
index 0000000..ecfbc0a
--- /dev/null
+++ b/shared/vendor/qrtr/src/hash.c
@@ -0,0 +1,37 @@
+#include <string.h>
+#include "hash.h"
+
+unsigned int hash_mem(const void *data, unsigned int len)
+{
+	unsigned int h;
+	unsigned int i;
+
+	h = len;
+
+	for (i = 0; i < len; ++i)
+		h = ((h >> 27) ^ (h << 5)) ^ ((const unsigned char *)data)[i];
+
+	return h;
+}
+
+unsigned int hash_string(const char *value)
+{
+	return hash_mem(value, strlen(value));
+}
+
+unsigned int hash_u32(uint32_t value)
+{
+	return value * 2654435761UL;
+}
+
+unsigned int hash_u64(uint64_t value)
+{
+	return hash_u32(value & 0xffffffff) ^ hash_u32(value >> 32);
+}
+
+unsigned int hash_pointer(void *value)
+{
+	if (sizeof(value) == sizeof(uint64_t))
+		return hash_u64((long)value);
+	return hash_u32((long)value);
+}
diff --git a/shared/vendor/qrtr/src/hash.h b/shared/vendor/qrtr/src/hash.h
new file mode 100644
index 0000000..5b004b5
--- /dev/null
+++ b/shared/vendor/qrtr/src/hash.h
@@ -0,0 +1,12 @@
+#ifndef _HASH_H_
+#define _HASH_H_
+
+#include <stdint.h>
+
+unsigned int hash_mem(const void *data, unsigned int len);
+unsigned int hash_string(const char *value);
+unsigned int hash_u32(uint32_t value);
+unsigned int hash_u64(uint64_t value);
+unsigned int hash_pointer(void *value);
+
+#endif
diff --git a/shared/vendor/qrtr/src/list.h b/shared/vendor/qrtr/src/list.h
new file mode 100644
index 0000000..d740743
--- /dev/null
+++ b/shared/vendor/qrtr/src/list.h
@@ -0,0 +1,128 @@
+#ifndef _LIST_H_
+#define _LIST_H_
+
+#ifndef offsetof
+#define offsetof(type, md) ((unsigned long)&((type *)0)->md)
+#endif
+
+#ifndef container_of
+#define container_of(ptr, type, member) \
+  ((type *)((char *)(ptr) - offsetof(type, member)))
+#endif
+
+struct list_item {
+	struct list_item *next;
+	struct list_item *prev;
+};
+
+struct list {
+	struct list_item *head;
+	struct list_item *tail;
+};
+
+#define LIST_INIT(name) { 0, 0 }
+
+#define LIST(name) \
+	struct list name = LIST_INIT(name)
+
+#define list_entry(ptr, type, member) \
+	container_of(ptr, type, member)
+
+static inline void list_init(struct list *list)
+{
+	list->head = 0;
+	list->tail = 0;
+}
+
+static inline void list_append(struct list *list, struct list_item *item)
+{
+	item->next = 0;
+	item->prev = list->tail;
+	if (list->tail != 0)
+		list->tail->next = item;
+	else
+		list->head = item;
+	list->tail = item;
+}
+
+static inline void list_prepend(struct list *list, struct list_item *item)
+{
+	item->prev = 0;
+	item->next = list->head;
+	if (list->head == 0)
+		list->tail = item;
+	list->head = item;
+}
+
+static inline void list_insert(struct list *list, struct list_item *after, struct list_item *item)
+{
+	if (after == 0) {
+		list_prepend(list, item);
+		return;
+	}
+	item->prev = after;
+	item->next = after->next;
+	after->next = item;
+	if (item->next)
+		item->next->prev = item;
+	if (list->tail == after)
+		list->tail = item;
+}
+
+static inline void list_remove(struct list *list, struct list_item *item)
+{
+	if (item->next)
+		item->next->prev = item->prev;
+	if (list->head == item) {
+		list->head = item->next;
+		if (list->head == 0)
+			list->tail = 0;
+	} else {
+		item->prev->next = item->next;
+		if (list->tail == item)
+			list->tail = item->prev;
+	}
+	item->prev = item->next = 0;
+}
+
+static inline struct list_item *list_pop(struct list *list)
+{
+	struct list_item *item;
+	item = list->head;
+	if (item == 0)
+		return 0;
+	list_remove(list, item);
+	return item;
+}
+
+static inline struct list_item *list_last(struct list *list)
+{
+	return list->tail;
+}
+
+static inline struct list_item *list_first(struct list *list)
+{
+	return list->head;
+}
+
+
+static inline struct list_item *list_next(struct list_item *item)
+{
+	return item->next;
+}
+
+#define list_push list_append
+
+#define list_for_each(_list, _iter) \
+  for (_iter = (_list)->head; (_iter) != 0; _iter = (_iter)->next)
+
+#define list_for_each_after(_node, _iter) \
+  for (_iter = (_node)->next; (_iter) != 0; _iter = (_iter)->next)
+
+#define list_for_each_safe(_list, _iter, _bkup) \
+  for (_iter = (_list)->head; (_iter) != 0 && ((_bkup = (_iter)->next) || 1); _iter = (_bkup))
+
+#define list_for_each_safe_after(_node, _iter, _bkup) \
+  for (_iter = (_node)->next; (_iter) != 0 && ((_bkup = (_iter)->next) || 1); _iter = (_bkup))
+
+#endif
diff --git a/shared/vendor/qrtr/src/lookup.c b/shared/vendor/qrtr/src/lookup.c
new file mode 100644
index 0000000..3312e40
--- /dev/null
+++ b/shared/vendor/qrtr/src/lookup.c
@@ -0,0 +1,237 @@
+#include <err.h>
+#include <errno.h>
+#include <libgen.h>
+#include <linux/qrtr.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "libqrtr.h"
+#include "logging.h"
+#include "ns.h"
+#include "util.h"
+
+#define DIAG_SERVICE 4097
+
+static const struct {
+	unsigned int service;
+	unsigned int ifilter;
+	const char *name;
+} common_names[] = {
+	{ 0, 0, "Control service" },
+	{ 1, 0, "Wireless Data Service" },
+	{ 2, 0, "Device Management Service" },
+	{ 3, 0, "Network Access Service" },
+	{ 4, 0, "Quality Of Service service" },
+	{ 5, 0, "Wireless Messaging Service" },
+	{ 6, 0, "Position Determination Service" },
+	{ 7, 0, "Authentication service" },
+	{ 8, 0, "AT service" },
+	{ 9, 0, "Voice service" },
+	{ 10, 0, "Card Application Toolkit service (v2)" },
+	{ 11, 0, "User Identity Module service" },
+	{ 12, 0, "Phonebook Management service" },
+	{ 13, 0, "QCHAT service" },
+	{ 14, 0, "Remote file system service" },
+	{ 15, 0, "Test service" },
+	{ 16, 0, "Location service (~ PDS v2)" },
+	{ 17, 0, "Specific absorption rate service" },
+	{ 18, 0, "IMS settings service" },
+	{ 19, 0, "Analog to digital converter driver service" },
+	{ 20, 0, "Core sound driver service" },
+	{ 21, 0, "Modem embedded file system service" },
+	{ 22, 0, "Time service" },
+	{ 23, 0, "Thermal sensors service" },
+	{ 24, 0, "Thermal mitigation device service" },
+	{ 25, 0, "Service access proxy service" },
+	{ 26, 0, "Wireless data administrative service" },
+	{ 27, 0, "TSYNC control service" },
+	{ 28, 0, "Remote file system access service" },
+	{ 29, 0, "Circuit switched videotelephony service" },
+	{ 30, 0, "Qualcomm mobile access point service" },
+	{ 31, 0, "IMS presence service" },
+	{ 32, 0, "IMS videotelephony service" },
+	{ 33, 0, "IMS application service" },
+	{ 34, 0, "Coexistence service" },
+	{ 36, 0, "Persistent device configuration service" },
+	{ 38, 0, "Simultaneous transmit service" },
+	{ 39, 0, "Bearer independent transport service" },
+	{ 40, 0, "IMS RTP service" },
+	{ 41, 0, "RF radiated performance enhancement service" },
+	{ 42, 0, "Data system determination service" },
+	{ 43, 0, "Subsystem control service" },
+	{ 49, 0, "IPA control service" },
+	{ 51, 0, "CoreSight remote tracing service" },
+	{ 52, 0, "Dynamic Heap Memory Sharing" },
+	{ 64, 0, "Service registry locator service" },
+	{ 66, 0, "Service registry notification service" },
+	{ 69, 0, "ATH10k WLAN firmware service" },
+	{ 224, 0, "Card Application Toolkit service (v1)" },
+	{ 225, 0, "Remote Management Service" },
+	{ 226, 0, "Open Mobile Alliance device management service" },
+	{ 312, 0, "QBT1000 Ultrasonic Fingerprint Sensor service" },
+	{ 769, 0, "SLIMbus control service" },
+	{ 771, 0, "Peripheral Access Control Manager service" },
+	{ DIAG_SERVICE, 0, "DIAG service" },
+};
+
+static const char *diag_instance_base_str(unsigned int instance_base)
+{
+	switch (instance_base) {
+		case 0: return "MODEM";
+		case 1: return "LPASS";
+		case 2: return "WCNSS";
+		case 3: return "SENSORS";
+		case 4: return "CDSP";
+		case 5: return "WDSP";
+		default: return "<unk>";
+	}
+}
+
+static const char *diag_instance_str(unsigned int instance)
+{
+	switch (instance) {
+		case 0: return "CNTL";
+		case 1: return "CMD";
+		case 2: return "DATA";
+		case 3: return "DCI_CMD";
+		case 4: return "DCI";
+		default: return "<unk>";
+	}
+}
+
+static int get_diag_instance_info(char *str, size_t size, unsigned int instance)
+{
+	return snprintf(str, size, "%s:%s",
+			diag_instance_base_str(instance >> 6),
+			diag_instance_str(instance & 0x3f));
+}
+
+static unsigned int read_num_le(const char *str, int *rcp)
+{
+	unsigned int ret;
+	char *e;
+
+	if (*rcp)
+		return 0;
+
+	errno = 0;
+	ret = strtoul(str, &e, 0);
+	*rcp = -(errno || *e);
+
+	return cpu_to_le32(ret);
+}
+
+int main(int argc, char **argv)
+{
+	struct qrtr_ctrl_pkt pkt;
+	struct sockaddr_qrtr sq;
+	unsigned int instance;
+	unsigned int service;
+	unsigned int version;
+	unsigned int node;
+	unsigned int port;
+	socklen_t sl = sizeof(sq);
+	struct timeval tv;
+	int sock;
+	int len;
+	int rc;
+	const char *progname = basename(argv[0]);
+
+	qlog_setup(progname, false);
+
+	rc = 0;
+	memset(&pkt, 0, sizeof(pkt));
+
+	switch (argc) {
+	default:
+		rc = -1;
+		break;
+	case 3: pkt.server.instance = read_num_le(argv[2], &rc);
+	case 2: pkt.server.service = read_num_le(argv[1], &rc);
+	case 1: break;
+	}
+	if (rc) {
+		fprintf(stderr, "Usage: %s [<service> [<instance> [<filter>]]]\n", progname);
+		exit(1);
+	}
+
+	sock = socket(AF_QIPCRTR, SOCK_DGRAM, 0);
+	if (sock < 0)
+		PLOGE_AND_EXIT("sock(AF_QIPCRTR)");
+
+	rc = getsockname(sock, (void *)&sq, &sl);
+	if (rc || sq.sq_family != AF_QIPCRTR || sl != sizeof(sq))
+		PLOGE_AND_EXIT("getsockname()");
+
+	sq.sq_port = QRTR_PORT_CTRL;
+
+	tv.tv_sec = 1;
+	tv.tv_usec = 0;
+
+	pkt.cmd = cpu_to_le32(QRTR_TYPE_NEW_LOOKUP);
+
+	rc = setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
+	if (rc)
+		PLOGE_AND_EXIT("setsockopt(SO_RCVTIMEO)");
+
+	rc = sendto(sock, &pkt, sizeof(pkt), 0, (void *)&sq, sizeof(sq));
+	if (rc < 0)
+		PLOGE_AND_EXIT("sendto()");
+
+	printf("  Service Version Instance Node  Port\n");
+
+	while ((len = recv(sock, &pkt, sizeof(pkt), 0)) > 0) {
+		unsigned int type = le32_to_cpu(pkt.cmd);
+		const char *name = NULL;
+		unsigned int i;
+
+		if (len < sizeof(pkt) || type != QRTR_TYPE_NEW_SERVER) {
+			PLOGW("invalid/short packet");
+			continue;
+		}
+
+		if (!pkt.server.service && !pkt.server.instance &&
+		    !pkt.server.node && !pkt.server.port)
+			break;
+
+		service = le32_to_cpu(pkt.server.service);
+		version = le32_to_cpu(pkt.server.instance) & 0xff;
+		instance = le32_to_cpu(pkt.server.instance) >> 8;
+		node = le32_to_cpu(pkt.server.node);
+		port = le32_to_cpu(pkt.server.port);
+
+		for (i = 0; i < sizeof(common_names)/sizeof(common_names[0]); ++i) {
+			if (service != common_names[i].service)
+				continue;
+			if (instance &&
+			   (instance & common_names[i].ifilter) != common_names[i].ifilter)
+				continue;
+			name = common_names[i].name;
+		}
+		if (!name)
+			name = "<unknown>";
+
+		if (service == DIAG_SERVICE) {
+			char buf[24];
+			instance = le32_to_cpu(pkt.server.instance);
+			get_diag_instance_info(buf, sizeof(buf), instance);
+			printf("%9d %7s %8d %4d %5d %s (%s)\n",
+				service, "N/A", instance, node, port, name, buf);
+		} else {
+			printf("%9d %7d %8d %4d %5d %s\n",
+				service, version, instance, node, port, name);
+		}
+	}
+
+	if (len < 0)
+		PLOGE_AND_EXIT("recv()");
+
+	close(sock);
+
+	return 0;
+}
diff --git a/shared/vendor/qrtr/src/map.c b/shared/vendor/qrtr/src/map.c
new file mode 100644
index 0000000..eed3488
--- /dev/null
+++ b/shared/vendor/qrtr/src/map.c
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2008-2009, Courtney Cavin
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *  this list of conditions and the following disclaimer in the documentation
+ *  and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+#include "map.h"
+
+struct map_entry {
+	struct map_item *item;
+};
+
+/* Marker for deleted items */
+static struct map_item deleted;
+
+void map_destroy(struct map *map)
+{
+	free(map->data);
+}
+
+void map_clear(struct map *map, void (*release)(struct map_item *))
+{
+	int i;
+
+	for (i = 0; i < map->size; ++i){
+		if (!map->data[i].item)
+			continue;
+		if (map->data[i].item != &deleted)
+			(* release)(map->data[i].item);
+		map->data[i].item = NULL;
+	}
+	map->count = 0;
+}
+
+int map_create(struct map *map)
+{
+	map->size = 0;
+	map->data = 0;
+	map->count = 0;
+	return 0;
+}
+
+static int map_hash(struct map *map, unsigned int key)
+{
+	struct map_entry *e;
+	int idx, i;
+
+	if (map->count == map->size)
+		return -1;
+
+	idx = key % map->size;
+
+	for (i = 0; i < map->size; ++i) {
+		e = &map->data[idx];
+		if (!e->item || e->item == &deleted) {
+			++map->count;
+			return idx;
+		}
+		if (e->item->key == key)
+			return idx;
+
+		idx = (idx + 1) % map->size;
+	}
+
+	return -2;
+}
+
+static int map_rehash(struct map *map);
+
+int map_reput(struct map *map, unsigned int key, struct map_item *value,
+		struct map_item **old)
+{
+	int rc;
+
+	while ((rc = map_hash(map, key)) < 0) {
+		if ((rc = map_rehash(map)) < 0)
+			return rc;
+	}
+
+	if (old) {
+		if (map->data[rc].item == &deleted)
+			*old = NULL;
+		else
+			*old = map->data[rc].item;
+	}
+	map->data[rc].item = value;
+	if (value)
+		map->data[rc].item->key = key;
+
+	return 0;
+}
+
+int map_put(struct map *map, unsigned int key, struct map_item *value)
+{
+	return map_reput(map, key, value, NULL);
+}
+
+static int map_rehash(struct map *map)
+{
+	struct map_entry *oldt, *newt;
+	int o_size, i;
+	int rc;
+
+	newt = calloc(sizeof(struct map_entry), map->size + 256);
+	if (!newt)
+		return -1;
+
+	oldt = map->data;
+	map->data = newt;
+
+	o_size = map->size;
+	map->size += 256;
+	map->count = 0;
+
+	for (i = 0; i < o_size; ++i){
+		if (!oldt[i].item || oldt[i].item == &deleted)
+			continue;
+		rc = map_put(map, oldt[i].item->key, oldt[i].item);
+		if (rc < 0)
+			return rc;
+	}
+
+	free(oldt);
+
+	return 0;
+}
+
+static struct map_entry *map_find(const struct map *map, unsigned int key)
+{
+	struct map_entry *e;
+	int idx, i;
+
+	if (map->size == 0)
+		return NULL;
+
+	idx = key % map->size;
+
+	for (i = 0; i < map->size; ++i) {
+		e = &map->data[idx];
+		idx = (idx + 1) % map->size;
+
+		if (!e->item)
+			break;
+		if (e->item == &deleted)
+			continue;
+		if (e->item->key == key)
+			return e;
+	}
+	return NULL;
+}
+
+int map_contains(const struct map *map, unsigned int key)
+{
+	return (map_find(map, key) == NULL) ? 0 : 1;
+}
+
+struct map_item *map_get(const struct map *map, unsigned int key)
+{
+	struct map_entry *e;
+
+	e = map_find(map, key);
+	if (e == NULL)
+		return NULL;
+	return e->item;
+}
+
+int map_remove(struct map *map, unsigned int key)
+{
+	struct map_entry *e;
+
+	e = map_find(map, key);
+	if (e) {
+		e->item = &deleted;
+		--map->count;
+	}
+	return !e;
+}
+
+unsigned int map_length(struct map *map)
+{
+	return map ? map->count : 0;
+}
+
+static struct map_entry *map_iter_from(const struct map *map, unsigned int start)
+{
+	unsigned int i = start;
+
+	for (; i < map->size; ++i) {
+		if (map->data[i].item && map->data[i].item != &deleted)
+			return &map->data[i];
+	}
+	return NULL;
+}
+
+struct map_entry *map_iter_next(const struct map *map, struct map_entry *iter)
+{
+	if (iter == NULL)
+		return NULL;
+
+	return map_iter_from(map, (iter - map->data) + 1);
+}
+
+struct map_entry *map_iter_first(const struct map *map)
+{
+	return map_iter_from(map, 0);
+}
+
+
+struct map_item *map_iter_item(struct map_entry *iter)
+{
+	return iter->item;
+}
diff --git a/shared/vendor/qrtr/src/map.h b/shared/vendor/qrtr/src/map.h
new file mode 100644
index 0000000..de68e19
--- /dev/null
+++ b/shared/vendor/qrtr/src/map.h
@@ -0,0 +1,38 @@
+#ifndef _MAP_H_
+#define _MAP_H_
+
+struct map_item {
+	unsigned int key;
+};
+
+struct map_entry;
+
+struct map {
+	unsigned int size;
+	unsigned int count;
+	struct map_entry *data;
+};
+
+int map_create(struct map *map);
+void map_destroy(struct map *map);
+void map_clear(struct map *map, void (*release)(struct map_item *));
+
+int map_put(struct map *map, unsigned int key, struct map_item *v);
+int map_reput(struct map *map, unsigned int key, struct map_item *v,
+		struct map_item **old);
+int map_contains(const struct map *map, unsigned int key);
+struct map_item *map_get(const struct map *map, unsigned int key);
+int map_remove(struct map *map, unsigned int key);
+unsigned int map_length(struct map *map);
+
+struct map_entry *map_iter_first(const struct map *map);
+struct map_entry *map_iter_next(const struct map *map, struct map_entry *iter);
+struct map_item *map_iter_item(struct map_entry *iter);
+
+#define map_for_each(map, iter) \
+  for (iter = map_iter_first(map); iter; iter = map_iter_next(map, iter))
+
+#define map_iter_data(iter, type, member) \
+  container_of(map_iter_item(iter), type, member)
+
+#endif
diff --git a/shared/vendor/qrtr/src/ns.c b/shared/vendor/qrtr/src/ns.c
new file mode 100644
index 0000000..393cc68
--- /dev/null
+++ b/shared/vendor/qrtr/src/ns.c
@@ -0,0 +1,808 @@
+#include <err.h>
+#include <errno.h>
+#include <libgen.h>
+#include <limits.h>
+#include <linux/qrtr.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+
+#include "addr.h"
+#include "hash.h"
+#include "list.h"
+#include "map.h"
+#include "ns.h"
+#include "util.h"
+#include "waiter.h"
+
+#include "libqrtr.h"
+#include "logging.h"
+
+static const char *ctrl_pkt_strings[] = {
+	[QRTR_TYPE_HELLO]	= "hello",
+	[QRTR_TYPE_BYE]		= "bye",
+	[QRTR_TYPE_NEW_SERVER]	= "new-server",
+	[QRTR_TYPE_DEL_SERVER]	= "del-server",
+	[QRTR_TYPE_DEL_CLIENT]	= "del-client",
+	[QRTR_TYPE_RESUME_TX]	= "resume-tx",
+	[QRTR_TYPE_EXIT]	= "exit",
+	[QRTR_TYPE_PING]	= "ping",
+	[QRTR_TYPE_NEW_LOOKUP]	= "new-lookup",
+	[QRTR_TYPE_DEL_LOOKUP]	= "del-lookup",
+};
+
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
+
+struct context {
+	int sock;
+
+	int local_node;
+
+	struct sockaddr_qrtr bcast_sq;
+
+	struct list lookups;
+};
+
+struct server_filter {
+	unsigned int service;
+	unsigned int instance;
+	unsigned int ifilter;
+};
+
+struct lookup {
+	unsigned int service;
+	unsigned int instance;
+
+	struct sockaddr_qrtr sq;
+	struct list_item li;
+};
+
+struct server {
+	unsigned int service;
+	unsigned int instance;
+
+	unsigned int node;
+	unsigned int port;
+	struct map_item mi;
+	struct list_item qli;
+};
+
+struct node {
+	unsigned int id;
+
+	struct map_item mi;
+	struct map services;
+};
+
+static struct map nodes;
+
+static void server_mi_free(struct map_item *mi);
+
+static struct node *node_get(unsigned int node_id)
+{
+	struct map_item *mi;
+	struct node *node;
+	int rc;
+
+	mi = map_get(&nodes, hash_u32(node_id));
+	if (mi)
+		return container_of(mi, struct node, mi);
+
+	node = calloc(1, sizeof(*node));
+	if (!node)
+		return NULL;
+
+	node->id = node_id;
+
+	rc = map_create(&node->services);
+	if (rc)
+		LOGE_AND_EXIT("unable to create map");
+
+	rc = map_put(&nodes, hash_u32(node_id), &node->mi);
+	if (rc) {
+		map_destroy(&node->services);
+		free(node);
+		return NULL;
+	}
+
+	return node;
+}
+
+static int server_match(const struct server *srv, const struct server_filter *f)
+{
+	unsigned int ifilter = f->ifilter;
+
+	if (f->service != 0 && srv->service != f->service)
+		return 0;
+	if (!ifilter && f->instance)
+		ifilter = ~0;
+	return (srv->instance & ifilter) == f->instance;
+}
+
+static int server_query(const struct server_filter *f, struct list *list)
+{
+	struct map_entry *node_me;
+	struct map_entry *me;
+	struct node *node;
+	int count = 0;
+
+	list_init(list);
+	map_for_each(&nodes, node_me) {
+		node = map_iter_data(node_me, struct node, mi);
+
+		map_for_each(&node->services, me) {
+			struct server *srv;
+
+			srv = map_iter_data(me, struct server, mi);
+			if (!server_match(srv, f))
+				continue;
+
+			list_append(list, &srv->qli);
+			++count;
+		}
+	}
+
+	return count;
+}
+
+static int service_announce_new(struct context *ctx,
+				struct sockaddr_qrtr *dest,
+				struct server *srv)
+{
+	struct qrtr_ctrl_pkt cmsg;
+	int rc;
+
+	LOGD("advertising new server [%d:%x]@[%d:%d]\n",
+		srv->service, srv->instance, srv->node, srv->port);
+
+	cmsg.cmd = cpu_to_le32(QRTR_TYPE_NEW_SERVER);
+	cmsg.server.service = cpu_to_le32(srv->service);
+	cmsg.server.instance = cpu_to_le32(srv->instance);
+	cmsg.server.node = cpu_to_le32(srv->node);
+	cmsg.server.port = cpu_to_le32(srv->port);
+
+	rc = sendto(ctx->sock, &cmsg, sizeof(cmsg), 0,
+		    (struct sockaddr *)dest, sizeof(*dest));
+	if (rc < 0)
+		PLOGW("sendto()");
+
+	return rc;
+}
+
+static int service_announce_del(struct context *ctx,
+				struct sockaddr_qrtr *dest,
+				struct server *srv)
+{
+	struct qrtr_ctrl_pkt cmsg;
+	int rc;
+
+	LOGD("advertising removal of server [%d:%x]@[%d:%d]\n",
+		srv->service, srv->instance, srv->node, srv->port);
+
+	cmsg.cmd = cpu_to_le32(QRTR_TYPE_DEL_SERVER);
+	cmsg.server.service = cpu_to_le32(srv->service);
+	cmsg.server.instance = cpu_to_le32(srv->instance);
+	cmsg.server.node = cpu_to_le32(srv->node);
+	cmsg.server.port = cpu_to_le32(srv->port);
+
+	rc = sendto(ctx->sock, &cmsg, sizeof(cmsg), 0,
+		    (struct sockaddr *)dest, sizeof(*dest));
+	if (rc < 0)
+		PLOGW("sendto()");
+
+	return rc;
+}
+
+static int lookup_notify(struct context *ctx, struct sockaddr_qrtr *to,
+			 struct server *srv, bool new)
+{
+	struct qrtr_ctrl_pkt pkt = {};
+	int rc;
+
+	pkt.cmd = new ? QRTR_TYPE_NEW_SERVER : QRTR_TYPE_DEL_SERVER;
+	if (srv) {
+		pkt.server.service = cpu_to_le32(srv->service);
+		pkt.server.instance = cpu_to_le32(srv->instance);
+		pkt.server.node = cpu_to_le32(srv->node);
+		pkt.server.port = cpu_to_le32(srv->port);
+	}
+
+	rc = sendto(ctx->sock, &pkt, sizeof(pkt), 0,
+		    (struct sockaddr *)to, sizeof(*to));
+	if (rc < 0)
+		PLOGW("send lookup result failed");
+	return rc;
+}
+
+static int annouce_servers(struct context *ctx, struct sockaddr_qrtr *sq)
+{
+	struct map_entry *me;
+	struct server *srv;
+	struct node *node;
+	int rc;
+
+	node = node_get(ctx->local_node);
+	if (!node)
+		return 0;
+
+	map_for_each(&node->services, me) {
+		srv = map_iter_data(me, struct server, mi);
+
+		rc = service_announce_new(ctx, sq, srv);
+		if (rc < 0)
+			return rc;
+	}
+
+	return 0;
+}
+
+static struct server *server_add(unsigned int service, unsigned int instance,
+	unsigned int node_id, unsigned int port)
+{
+	struct map_item *mi;
+	struct server *srv;
+	struct node *node;
+	int rc;
+
+	if (!service || !port)
+		return NULL;
+
+	srv = calloc(1, sizeof(*srv));
+	if (srv == NULL)
+		return NULL;
+
+	srv->service = service;
+	srv->instance = instance;
+	srv->node = node_id;
+	srv->port = port;
+
+	node = node_get(node_id);
+	if (!node)
+		goto err;
+
+	rc = map_reput(&node->services, hash_u32(port), &srv->mi, &mi);
+	if (rc)
+		goto err;
+
+	LOGD("add server [%d:%x]@[%d:%d]\n", srv->service, srv->instance,
+		srv->node, srv->port);
+
+	if (mi) { /* we replaced someone */
+		struct server *old = container_of(mi, struct server, mi);
+		free(old);
+	}
+
+	return srv;
+
+err:
+	free(srv);
+	return NULL;
+}
+
+static int server_del(struct context *ctx, struct node *node, unsigned int port)
+{
+	struct lookup *lookup;
+	struct list_item *li;
+	struct map_item *mi;
+	struct server *srv;
+
+	mi = map_get(&node->services, hash_u32(port));
+	if (!mi)
+		return -ENOENT;
+
+	srv = container_of(mi, struct server, mi);
+	map_remove(&node->services, srv->mi.key);
+
+	/* Broadcast the removal of local services */
+	if (srv->node == ctx->local_node)
+		service_announce_del(ctx, &ctx->bcast_sq, srv);
+
+	/* Announce the service's disappearance to observers */
+	list_for_each(&ctx->lookups, li) {
+		lookup = container_of(li, struct lookup, li);
+		if (lookup->service && lookup->service != srv->service)
+			continue;
+		if (lookup->instance && lookup->instance != srv->instance)
+			continue;
+
+		lookup_notify(ctx, &lookup->sq, srv, false);
+	}
+
+	free(srv);
+
+	return 0;
+}
+
+static int ctrl_cmd_hello(struct context *ctx, struct sockaddr_qrtr *sq,
+			  const void *buf, size_t len)
+{
+	int rc;
+
+	rc = sendto(ctx->sock, buf, len, 0, (void *)sq, sizeof(*sq));
+	if (rc > 0)
+		rc = annouce_servers(ctx, sq);
+
+	return rc;
+}
+
+static int ctrl_cmd_bye(struct context *ctx, struct sockaddr_qrtr *from)
+{
+	struct qrtr_ctrl_pkt pkt;
+	struct sockaddr_qrtr sq;
+	struct node *local_node;
+	struct map_entry *me;
+	struct server *srv;
+	struct node *node;
+	int rc;
+
+	node = node_get(from->sq_node);
+	if (!node)
+		return 0;
+
+	map_for_each(&node->services, me) {
+		srv = map_iter_data(me, struct server, mi);
+
+		server_del(ctx, node, srv->port);
+	}
+
+	/* Advertise the removal of this client to all local services */
+	local_node = node_get(ctx->local_node);
+	if (!local_node)
+		return 0;
+
+	memset(&pkt, 0, sizeof(pkt));
+	pkt.cmd = QRTR_TYPE_BYE;
+	pkt.client.node = from->sq_node;
+
+	map_for_each(&local_node->services, me) {
+		srv = map_iter_data(me, struct server, mi);
+
+		sq.sq_family = AF_QIPCRTR;
+		sq.sq_node = srv->node;
+		sq.sq_port = srv->port;
+
+		rc = sendto(ctx->sock, &pkt, sizeof(pkt), 0,
+				(struct sockaddr *)&sq, sizeof(sq));
+		if (rc < 0)
+			PLOGW("bye propagation failed");
+	}
+
+	return 0;
+}
+
+static int ctrl_cmd_del_client(struct context *ctx, struct sockaddr_qrtr *from,
+			       unsigned node_id, unsigned port)
+{
+	struct qrtr_ctrl_pkt pkt;
+	struct sockaddr_qrtr sq;
+	struct node *local_node;
+	struct list_item *tmp;
+	struct lookup *lookup;
+	struct list_item *li;
+	struct map_entry *me;
+	struct server *srv;
+	struct node *node;
+	int rc;
+
+	/* Don't accept spoofed messages */
+	if (from->sq_node != node_id)
+		return -EINVAL;
+
+	/* Local DEL_CLIENT messages comes from the port being closed */
+	if (from->sq_node == ctx->local_node && from->sq_port != port)
+		return -EINVAL;
+
+	/* Remove any lookups by this client */
+	list_for_each_safe(&ctx->lookups, li, tmp) {
+		lookup = container_of(li, struct lookup, li);
+		if (lookup->sq.sq_node != node_id)
+			continue;
+		if (lookup->sq.sq_port != port)
+			continue;
+
+		list_remove(&ctx->lookups, &lookup->li);
+		free(lookup);
+	}
+
+	/* Remove the server belonging to this port*/
+	node = node_get(node_id);
+	if (node)
+		server_del(ctx, node, port);
+
+	/* Advertise the removal of this client to all local services */
+	local_node = node_get(ctx->local_node);
+	if (!local_node)
+		return 0;
+
+	pkt.cmd = QRTR_TYPE_DEL_CLIENT;
+	pkt.client.node = node_id;
+	pkt.client.port = port;
+
+	map_for_each(&local_node->services, me) {
+		srv = map_iter_data(me, struct server, mi);
+
+		sq.sq_family = AF_QIPCRTR;
+		sq.sq_node = srv->node;
+		sq.sq_port = srv->port;
+
+		rc = sendto(ctx->sock, &pkt, sizeof(pkt), 0,
+				(struct sockaddr *)&sq, sizeof(sq));
+		if (rc < 0)
+			PLOGW("del_client propagation failed");
+	}
+
+	return 0;
+}
+
+static int ctrl_cmd_new_server(struct context *ctx, struct sockaddr_qrtr *from,
+			       unsigned int service, unsigned int instance,
+			       unsigned int node_id, unsigned int port)
+{
+	struct lookup *lookup;
+	struct list_item *li;
+	struct server *srv;
+	int rc = 0;
+
+	/* Ignore specified node and port for local servers*/
+	if (from->sq_node == ctx->local_node) {
+		node_id = from->sq_node;
+		port = from->sq_port;
+	}
+
+	/* Don't accept spoofed messages */
+	if (from->sq_node != node_id)
+		return -EINVAL;
+
+	srv = server_add(service, instance, node_id, port);
+	if (!srv)
+		return -EINVAL;
+
+	if (srv->node == ctx->local_node)
+		rc = service_announce_new(ctx, &ctx->bcast_sq, srv);
+
+	list_for_each(&ctx->lookups, li) {
+		lookup = container_of(li, struct lookup, li);
+		if (lookup->service && lookup->service != service)
+			continue;
+		if (lookup->instance && lookup->instance != instance)
+			continue;
+
+		lookup_notify(ctx, &lookup->sq, srv, true);
+	}
+
+	return rc;
+}
+
+static int ctrl_cmd_del_server(struct context *ctx, struct sockaddr_qrtr *from,
+			       unsigned int service __unused,
+			       unsigned int instance __unused,
+			       unsigned int node_id, unsigned int port)
+{
+	struct node *node;
+
+	/* Ignore specified node and port for local servers*/
+	if (from->sq_node == ctx->local_node) {
+		node_id = from->sq_node;
+		port = from->sq_port;
+	}
+
+	/* Don't accept spoofed messages */
+	if (from->sq_node != node_id)
+		return -EINVAL;
+
+	/* Local servers may only unregister themselves */
+	if (from->sq_node == ctx->local_node && from->sq_port != port)
+		return -EINVAL;
+
+	node = node_get(node_id);
+	if (!node)
+		return -ENOENT;
+
+	return server_del(ctx, node, port);
+}
+
+static int ctrl_cmd_new_lookup(struct context *ctx, struct sockaddr_qrtr *from,
+			       unsigned int service, unsigned int instance)
+{
+	struct server_filter filter;
+	struct list reply_list;
+	struct lookup *lookup;
+	struct list_item *li;
+	struct server *srv;
+
+	/* Accept only local observers */
+	if (from->sq_node != ctx->local_node)
+		return -EINVAL;
+
+	lookup = calloc(1, sizeof(*lookup));
+	if (!lookup)
+		return -EINVAL;
+
+	lookup->sq = *from;
+	lookup->service = service;
+	lookup->instance = instance;
+	list_append(&ctx->lookups, &lookup->li);
+
+	memset(&filter, 0, sizeof(filter));
+	filter.service = service;
+	filter.instance = instance;
+
+	server_query(&filter, &reply_list);
+	list_for_each(&reply_list, li) {
+		srv = container_of(li, struct server, qli);
+
+		lookup_notify(ctx, from, srv, true);
+	}
+
+	lookup_notify(ctx, from, NULL, true);
+
+	return 0;
+}
+
+static int ctrl_cmd_del_lookup(struct context *ctx, struct sockaddr_qrtr *from,
+			       unsigned int service, unsigned int instance)
+{
+	struct lookup *lookup;
+	struct list_item *tmp;
+	struct list_item *li;
+
+	list_for_each_safe(&ctx->lookups, li, tmp) {
+		lookup = container_of(li, struct lookup, li);
+		if (lookup->sq.sq_node != from->sq_node)
+			continue;
+		if (lookup->sq.sq_port != from->sq_port)
+			continue;
+		if (lookup->service != service)
+			continue;
+		if (lookup->instance && lookup->instance != instance)
+			continue;
+
+		list_remove(&ctx->lookups, &lookup->li);
+		free(lookup);
+	}
+
+	return 0;
+}
+
+static void ctrl_port_fn(void *vcontext, struct waiter_ticket *tkt)
+{
+	struct context *ctx = vcontext;
+	struct sockaddr_qrtr sq;
+	int sock = ctx->sock;
+	struct qrtr_ctrl_pkt *msg;
+	unsigned int cmd;
+	char buf[4096];
+	socklen_t sl;
+	ssize_t len;
+	int rc;
+
+	sl = sizeof(sq);
+	len = recvfrom(sock, buf, sizeof(buf), 0, (void *)&sq, &sl);
+	if (len <= 0) {
+		PLOGW("recvfrom()");
+		close(sock);
+		ctx->sock = -1;
+		goto out;
+	}
+	msg = (void *)buf;
+
+	if (len < 4) {
+		LOGW("short packet from %d:%d", sq.sq_node, sq.sq_port);
+		goto out;
+	}
+
+	cmd = le32_to_cpu(msg->cmd);
+	if (cmd < ARRAY_SIZE(ctrl_pkt_strings) && ctrl_pkt_strings[cmd])
+		LOGD("%s from %d:%d\n", ctrl_pkt_strings[cmd], sq.sq_node, sq.sq_port);
+	else
+		LOGD("UNK (%08x) from %d:%d\n", cmd, sq.sq_node, sq.sq_port);
+
+	rc = 0;
+	switch (cmd) {
+	case QRTR_TYPE_HELLO:
+		rc = ctrl_cmd_hello(ctx, &sq, buf, len);
+		break;
+	case QRTR_TYPE_BYE:
+		rc = ctrl_cmd_bye(ctx, &sq);
+		break;
+	case QRTR_TYPE_DEL_CLIENT:
+		rc = ctrl_cmd_del_client(ctx, &sq,
+					 le32_to_cpu(msg->client.node),
+					 le32_to_cpu(msg->client.port));
+		break;
+	case QRTR_TYPE_NEW_SERVER:
+		rc = ctrl_cmd_new_server(ctx, &sq,
+					 le32_to_cpu(msg->server.service),
+					 le32_to_cpu(msg->server.instance),
+					 le32_to_cpu(msg->server.node),
+					 le32_to_cpu(msg->server.port));
+		break;
+	case QRTR_TYPE_DEL_SERVER:
+		rc = ctrl_cmd_del_server(ctx, &sq,
+					 le32_to_cpu(msg->server.service),
+					 le32_to_cpu(msg->server.instance),
+					 le32_to_cpu(msg->server.node),
+					 le32_to_cpu(msg->server.port));
+		break;
+	case QRTR_TYPE_EXIT:
+	case QRTR_TYPE_PING:
+	case QRTR_TYPE_RESUME_TX:
+		break;
+	case QRTR_TYPE_NEW_LOOKUP:
+		rc = ctrl_cmd_new_lookup(ctx, &sq,
+					 le32_to_cpu(msg->server.service),
+					 le32_to_cpu(msg->server.instance));
+		break;
+	case QRTR_TYPE_DEL_LOOKUP:
+		rc = ctrl_cmd_del_lookup(ctx, &sq,
+					 le32_to_cpu(msg->server.service),
+					 le32_to_cpu(msg->server.instance));
+		break;
+	}
+
+	if (rc < 0)
+		LOGW("failed while handling packet from %d:%d",
+		      sq.sq_node, sq.sq_port);
+out:
+	waiter_ticket_clear(tkt);
+}
+
+static int say_hello(struct context *ctx)
+{
+	struct qrtr_ctrl_pkt pkt;
+	int rc;
+
+	memset(&pkt, 0, sizeof(pkt));
+	pkt.cmd = cpu_to_le32(QRTR_TYPE_HELLO);
+
+	rc = sendto(ctx->sock, &pkt, sizeof(pkt), 0,
+		    (struct sockaddr *)&ctx->bcast_sq, sizeof(ctx->bcast_sq));
+	if (rc < 0)
+		return rc;
+
+	return 0;
+}
+
+static void server_mi_free(struct map_item *mi)
+{
+	free(container_of(mi, struct server, mi));
+}
+
+static void node_mi_free(struct map_item *mi)
+{
+	struct node *node = container_of(mi, struct node, mi);
+
+	map_clear(&node->services, server_mi_free);
+	map_destroy(&node->services);
+
+	free(node);
+}
+
+static void go_dormant(int sock)
+{
+	close(sock);
+
+	for (;;)
+		sleep(UINT_MAX);
+}
+
+static void usage(const char *progname)
+{
+	fprintf(stderr, "%s [-f] [-s] [<node-id>]\n", progname);
+	exit(1);
+}
+
+int main(int argc, char **argv)
+{
+	struct waiter_ticket *tkt;
+	struct sockaddr_qrtr sq;
+	struct context ctx;
+	unsigned long addr = (unsigned long)-1;
+	struct waiter *w;
+	socklen_t sl = sizeof(sq);
+	bool foreground = false;
+	bool use_syslog = false;
+	bool verbose_log = false;
+	char *ep;
+	int opt;
+	int rc;
+	const char *progname = basename(argv[0]);
+
+	while ((opt = getopt(argc, argv, "fsv")) != -1) {
+		switch (opt) {
+		case 'f':
+			foreground = true;
+			break;
+		case 's':
+			use_syslog = true;
+			break;
+		case 'v':
+			verbose_log = true;
+			break;
+		default:
+			usage(progname);
+		}
+	}
+
+	qlog_setup(progname, use_syslog);
+	if (verbose_log)
+		qlog_set_min_priority(LOG_DEBUG);
+
+	if (optind < argc) {
+		addr = strtoul(argv[optind], &ep, 10);
+		if (argv[1][0] == '\0' || *ep != '\0' || addr >= UINT_MAX)
+			usage(progname);
+
+		qrtr_set_address(addr);
+		optind++;
+	}
+
+	if (optind != argc)
+		usage(progname);
+
+	w = waiter_create();
+	if (w == NULL)
+		LOGE_AND_EXIT("unable to create waiter");
+
+	list_init(&ctx.lookups);
+
+	rc = map_create(&nodes);
+	if (rc)
+		LOGE_AND_EXIT("unable to create node map");
+
+	ctx.sock = socket(AF_QIPCRTR, SOCK_DGRAM, 0);
+	if (ctx.sock < 0)
+		PLOGE_AND_EXIT("unable to create control socket");
+
+	rc = getsockname(ctx.sock, (void*)&sq, &sl);
+	if (rc < 0)
+		PLOGE_AND_EXIT("getsockname()");
+	sq.sq_port = QRTR_PORT_CTRL;
+	ctx.local_node = sq.sq_node;
+
+	rc = bind(ctx.sock, (void *)&sq, sizeof(sq));
+	if (rc < 0) {
+		if (errno == EADDRINUSE) {
+			PLOGE("nameserver already running, going dormant");
+			go_dormant(ctx.sock);
+		}
+
+		PLOGE_AND_EXIT("bind control socket");
+	}
+
+	ctx.bcast_sq.sq_family = AF_QIPCRTR;
+	ctx.bcast_sq.sq_node = QRTR_NODE_BCAST;
+	ctx.bcast_sq.sq_port = QRTR_PORT_CTRL;
+
+	rc = say_hello(&ctx);
+	if (rc)
+		PLOGE_AND_EXIT("unable to say hello");
+
+	/* If we're going to background, fork and exit parent */
+	if (!foreground && fork() != 0) {
+		close(ctx.sock);
+		exit(0);
+	}
+
+	tkt = waiter_add_fd(w, ctx.sock);
+	waiter_ticket_callback(tkt, ctrl_port_fn, &ctx);
+
+	while (ctx.sock >= 0)
+		waiter_wait(w);
+
+	puts("exiting cleanly");
+
+	waiter_destroy(w);
+
+	map_clear(&nodes, node_mi_free);
+	map_destroy(&nodes);
+
+	return 0;
+}
diff --git a/shared/vendor/qrtr/src/ns.h b/shared/vendor/qrtr/src/ns.h
new file mode 100644
index 0000000..d661ac8
--- /dev/null
+++ b/shared/vendor/qrtr/src/ns.h
@@ -0,0 +1,10 @@
+#ifndef __NS_H_
+#define __NS_H_
+
+#include <endian.h>
+#include <stdint.h>
+
+static inline __le32 cpu_to_le32(uint32_t x) { return htole32(x); }
+static inline uint32_t le32_to_cpu(__le32 x) { return le32toh(x); }
+
+#endif
diff --git a/shared/vendor/qrtr/src/util.c b/shared/vendor/qrtr/src/util.c
new file mode 100644
index 0000000..48d9d27
--- /dev/null
+++ b/shared/vendor/qrtr/src/util.c
@@ -0,0 +1,18 @@
+#include <string.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include "util.h"
+
+uint64_t time_ms(void)
+{
+	struct timeval tv;
+	gettimeofday(&tv, NULL);
+	return (uint64_t)tv.tv_sec*1000 + tv.tv_usec/1000;
+}
+
+void util_sleep(int ms)
+{
+	usleep(ms * 1000);
+}
diff --git a/shared/vendor/qrtr/src/util.h b/shared/vendor/qrtr/src/util.h
new file mode 100644
index 0000000..3f371cd
--- /dev/null
+++ b/shared/vendor/qrtr/src/util.h
@@ -0,0 +1,9 @@
+#ifndef __UTIL_H_
+#define __UTIL_H_
+
+#include <stdint.h>
+
+uint64_t time_ms(void);
+void util_sleep(int ms);
+
+#endif
diff --git a/shared/vendor/qrtr/src/waiter.c b/shared/vendor/qrtr/src/waiter.c
new file mode 100644
index 0000000..f21896f
--- /dev/null
+++ b/shared/vendor/qrtr/src/waiter.c
@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 2013-2014, Sony Mobile Communications Inc.
+ * Copyright (c) 2014, Courtney Cavin
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *  this list of conditions and the following disclaimer in the documentation
+ *  and/or other materials provided with the distribution.
+ *
+ *  - Neither the name of the organization nor the names of its contributors
+ *  may be used to endorse or promote products derived from this software
+ *  without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <poll.h>
+
+#include "list.h"
+#include "waiter.h"
+#include "util.h"
+
+struct pollset {
+	int nfds;
+	int cause;
+};
+
+static struct pollset *pollset_create(int count)
+{
+	struct pollset *ps;
+
+	ps = calloc(1, sizeof(*ps) + sizeof(struct pollfd) * count);
+	if (ps == NULL)
+		return NULL;
+
+	return ps;
+}
+
+static void pollset_destroy(struct pollset *ps)
+{
+	free(ps);
+}
+
+static void pollset_reset(struct pollset *ps)
+{
+	ps->nfds = 0;
+}
+
+static void pollset_add_fd(struct pollset *ps, int fd)
+{
+	struct pollfd *pfd = (struct pollfd *)(ps + 1);
+	pfd[ps->nfds].fd = fd;
+	pfd[ps->nfds].events = POLLERR | POLLIN;
+	ps->nfds++;
+}
+
+static int pollset_wait(struct pollset *ps, int ms)
+{
+	struct pollfd *pfd = (struct pollfd *)(ps + 1);
+	int rc;
+	int i;
+
+	rc = poll(pfd, ps->nfds, ms);
+	if (rc <= 0)
+		return rc;
+
+	ps->cause = -1;
+	for (i = 0; i < ps->nfds; ++i) {
+		if (pfd[i].revents & (POLLERR | POLLIN)) {
+			ps->cause = i;
+			break;
+		}
+	}
+	return rc;
+
+}
+
+static int pollset_cause_fd(struct pollset *ps, int fd)
+{
+	struct pollfd *pfd = (struct pollfd *)(ps + 1);
+	return (ps->cause >= 0 && pfd[ps->cause].fd == fd);
+}
+
+enum waiter_type {
+	WATCH_TYPE_NULL,
+	WATCH_TYPE_FD,
+	WATCH_TYPE_TIMEOUT,
+};
+
+struct waiter_ticket {
+	enum waiter_type type;
+	union {
+		int filedes;
+		unsigned int event;
+		unsigned int interval;
+	};
+	struct {
+		void (* fn)(void *data, struct waiter_ticket *);
+		void *data;
+	} callback;
+
+	uint64_t start;
+	int updated;
+	struct waiter *waiter;
+	struct list_item list_item;
+};
+
+struct waiter {
+	struct list tickets;
+	struct pollset *pollset;
+	int count;
+};
+
+struct waiter *waiter_create(void)
+{
+	struct waiter *w;
+
+	w = calloc(1, sizeof(*w));
+	if (w == NULL)
+		return NULL;
+
+	list_init(&w->tickets);
+	return w;
+}
+
+void waiter_destroy(struct waiter *w)
+{
+	struct waiter_ticket *ticket;
+	struct list_item *safe;
+	struct list_item *node;
+
+	list_for_each_safe(&w->tickets, node, safe) {
+		ticket = list_entry(node, struct waiter_ticket, list_item);
+		free(ticket);
+	}
+
+	if (w->pollset)
+		pollset_destroy(w->pollset);
+	free(w);
+}
+
+void waiter_synchronize(struct waiter *w)
+{
+	struct waiter_ticket *oticket;
+	struct waiter_ticket *ticket;
+	struct list_item *node;
+
+	list_for_each(&w->tickets, node) {
+		struct list_item *onode;
+		ticket = list_entry(node, struct waiter_ticket, list_item);
+
+		if (ticket->type != WATCH_TYPE_TIMEOUT)
+			continue;
+
+		list_for_each_after(node, onode) {
+			oticket = list_entry(onode, struct waiter_ticket, list_item);
+			if (oticket->type != WATCH_TYPE_TIMEOUT)
+				continue;
+
+			if (oticket->interval == ticket->interval) {
+				oticket->start = ticket->start;
+				break;
+			}
+		}
+	}
+}
+
+void waiter_wait(struct waiter *w)
+{
+	struct pollset *ps = w->pollset;
+	struct waiter_ticket *ticket;
+	struct list_item *node;
+	uint64_t term_time;
+	uint64_t now;
+	int rc;
+
+	pollset_reset(ps);
+
+	term_time = (uint64_t)-1;
+	list_for_each(&w->tickets, node) {
+		ticket = list_entry(node, struct waiter_ticket, list_item);
+		switch (ticket->type) {
+		case WATCH_TYPE_TIMEOUT:
+			if (ticket->start + ticket->interval < term_time)
+				term_time = ticket->start + ticket->interval;
+			break;
+		case WATCH_TYPE_FD:
+			pollset_add_fd(ps, ticket->filedes);
+			break;
+		case WATCH_TYPE_NULL:
+			break;
+		}
+	}
+
+	if (term_time == (uint64_t)-1) { /* wait forever */
+		rc = pollset_wait(ps, -1);
+	} else {
+		now = time_ms();
+		if (now >= term_time) { /* already past timeout, skip poll */
+			rc = 0;
+		} else {
+			uint64_t delta;
+
+			delta = term_time - now;
+			if (delta > ((1u << 31) - 1))
+				delta = ((1u << 31) - 1);
+			rc = pollset_wait(ps, (int)delta);
+		}
+	}
+
+	if (rc < 0)
+		return;
+
+	now = time_ms();
+	list_for_each(&w->tickets, node) {
+		int fresh = 0;
+
+		ticket = list_entry(node, struct waiter_ticket, list_item);
+		switch (ticket->type) {
+		case WATCH_TYPE_TIMEOUT:
+			if (now >= ticket->start + ticket->interval) {
+				ticket->start = now;
+				fresh = !ticket->updated;
+			}
+			break;
+		case WATCH_TYPE_FD:
+			if (rc == 0) /* timed-out */
+				break;
+			if (pollset_cause_fd(ps, ticket->filedes))
+				fresh = !ticket->updated;
+			break;
+		case WATCH_TYPE_NULL:
+			break;
+		}
+		if (fresh) {
+			ticket->updated = 1;
+			if (ticket->callback.fn)
+				(* ticket->callback.fn)(
+						ticket->callback.data,
+						ticket
+				);
+		}
+	}
+}
+
+int waiter_wait_timeout(struct waiter *w, unsigned int ms)
+{
+	struct waiter_ticket ticket;
+	int rc;
+
+	memset(&ticket, 0, sizeof(ticket));
+	waiter_ticket_set_timeout(&ticket, ms);
+	list_append(&w->tickets, &ticket.list_item);
+	w->count++;
+
+	waiter_wait(w);
+	rc = waiter_ticket_check(&ticket);
+
+	list_remove(&w->tickets, &ticket.list_item);
+	w->count--;
+
+	return -!rc;
+}
+
+void waiter_ticket_set_null(struct waiter_ticket *ticket)
+{
+	ticket->type = WATCH_TYPE_NULL;
+}
+
+void waiter_ticket_set_fd(struct waiter_ticket *ticket, int fd)
+{
+	ticket->type = WATCH_TYPE_FD;
+	ticket->filedes = fd;
+}
+
+void waiter_ticket_set_timeout(struct waiter_ticket *ticket, unsigned int ms)
+{
+	ticket->type = WATCH_TYPE_TIMEOUT;
+	ticket->interval = ms;
+	ticket->start = time_ms();
+}
+
+struct waiter_ticket *waiter_add_null(struct waiter *w)
+{
+	struct waiter_ticket *ticket;
+
+	ticket = calloc(1, sizeof(*ticket));
+	if (ticket == NULL)
+		return NULL;
+	ticket->waiter = w;
+
+	list_append(&w->tickets, &ticket->list_item);
+	if ((w->count % 32) == 0) {
+		if (w->pollset)
+			pollset_destroy(w->pollset);
+		w->pollset = pollset_create(w->count + 33);
+		if (w->pollset == NULL)
+			return NULL;
+	}
+	w->count++;
+
+	waiter_ticket_set_null(ticket);
+
+	return ticket;
+}
+
+struct waiter_ticket *waiter_add_fd(struct waiter *w, int fd)
+{
+	struct waiter_ticket *ticket;
+
+	ticket = waiter_add_null(w);
+	if (ticket == NULL)
+		return NULL;
+
+	waiter_ticket_set_fd(ticket, fd);
+
+	return ticket;
+}
+
+struct waiter_ticket *waiter_add_timeout(struct waiter *w, unsigned int ms)
+{
+	struct waiter_ticket *ticket;
+
+	ticket = waiter_add_null(w);
+	if (ticket == NULL)
+		return NULL;
+
+	waiter_ticket_set_timeout(ticket, ms);
+
+	return ticket;
+}
+
+void waiter_ticket_delete(struct waiter_ticket *ticket)
+{
+	struct waiter *w = ticket->waiter;
+	list_remove(&w->tickets, &ticket->list_item);
+	w->count--;
+	free(ticket);
+}
+
+void waiter_ticket_callback(struct waiter_ticket *ticket, waiter_ticket_cb_t cb_fn, void *data)
+{
+	ticket->callback.fn = cb_fn;
+	ticket->callback.data = data;
+}
+
+int waiter_ticket_check(const struct waiter_ticket *ticket)
+{
+	return -(ticket->updated == 0);
+}
+
+int waiter_ticket_clear(struct waiter_ticket *ticket)
+{
+	int ret;
+
+	ret = waiter_ticket_check(ticket);
+	ticket->updated = 0;
+
+	return ret;
+}
diff --git a/shared/vendor/qrtr/src/waiter.h b/shared/vendor/qrtr/src/waiter.h
new file mode 100644
index 0000000..e311453
--- /dev/null
+++ b/shared/vendor/qrtr/src/waiter.h
@@ -0,0 +1,103 @@
+#ifndef _WAITER_H_
+#define _WAITER_H_
+
+/** Waiter type. */
+struct waiter;
+
+/** Create a new waiter.
+ * @return Newly created waiter on success, NULL on failure.
+ */
+struct waiter *waiter_create(void);
+
+/** Destroy existing waiter.
+ * @param w waiter to destroy.
+ */
+void waiter_destroy(struct waiter *w);
+
+/** Wait for next ticket.
+ * @param w waiter.
+ */
+void waiter_wait(struct waiter *w);
+
+/** Wait for next ticket or timeout.
+ * @param w waiter.
+ * @param ms timeout in milliseconds.
+ * @return 0 on ticket; !0 on timeout.
+ */
+int waiter_wait_timeout(struct waiter *w, unsigned int ms);
+
+/** Synchronize timer-based tickets.
+ * @param w waiter.
+ */
+void waiter_synchronize(struct waiter *w);
+
+/** Waiter ticket type. */
+struct waiter_ticket;
+
+/** Add a null wait ticket to pool.
+ * @param w waiter
+ * @return wait ticket on success; NULL on failure.
+ */
+struct waiter_ticket *waiter_add_null(struct waiter *w);
+
+/** Add a file descriptor to the pool.
+ * @param w waiter.
+ * @param fd file descriptor.
+ * @return wait ticket on success; NULL on failure.
+ */
+struct waiter_ticket *waiter_add_fd(struct waiter *w, int fd);
+
+/** Add a timeout to the pool.
+ * @param w waiter.
+ * @param ms duration of timeout in milliseconds.
+ * @return wait ticket on success; NULL on failure.
+ */
+struct waiter_ticket *waiter_add_timeout(struct waiter *w, unsigned int ms);
+
+/** Set ticket type to null.
+ * @param tkt wait ticket.
+ */
+void waiter_ticket_set_null(struct waiter_ticket *tkt);
+
+/** Set ticket type to file descriptor.
+ * @param tkt wait ticket.
+ * @param fd file descriptor.
+ */
+void waiter_ticket_set_fd(struct waiter_ticket *tkt, int fd);
+
+/** Set ticket type to timeout.
+ * @param tkt wait ticket.
+ * @param ms timeout in milliseconds.
+ */
+void waiter_ticket_set_timeout(struct waiter_ticket *tkt, unsigned int ms);
+
+/** Destroy ticket.
+ * @param tkt wait ticket.
+ */
+void waiter_ticket_delete(struct waiter_ticket *tkt);
+
+/** Check to see if ticket has triggered.
+ * @param tkt wait ticket.
+ * @return 0 if triggered, !0 otherwise.
+ */
+int waiter_ticket_check(const struct waiter_ticket *tkt);
+
+
+/** Clear ticket trigger status.
+ * @param tkt wait ticket.
+ * @return 0 if triggered, !0 otherwise.
+ */
+int waiter_ticket_clear(struct waiter_ticket *tkt);
+
+/** Wait ticket callback function type. */
+typedef void (* waiter_ticket_cb_t)(void *, struct waiter_ticket *);
+
+/** Register callback function for ticket trigger.
+ * @param tkt wait ticket.
+ * @param cb_fn callback function.
+ * @param data private data to pass to callback function.
+ */
+void waiter_ticket_callback(struct waiter_ticket *tkt,
+		waiter_ticket_cb_t cb_fn, void *data);
+
+#endif
diff --git a/shared/vendor/rmtfs/.gitignore b/shared/vendor/rmtfs/.gitignore
new file mode 100644
index 0000000..eab0e81
--- /dev/null
+++ b/shared/vendor/rmtfs/.gitignore
@@ -0,0 +1,3 @@
+rmtfs
+*.o
+rmtfs.service
diff --git a/shared/vendor/rmtfs/Android.bp b/shared/vendor/rmtfs/Android.bp
new file mode 100644
index 0000000..7865a99
--- /dev/null
+++ b/shared/vendor/rmtfs/Android.bp
@@ -0,0 +1,13 @@
+cc_binary {
+    name: "rmtfs",
+    vendor: true,
+    srcs: [
+        "qmi_rmtfs.c",
+        "rmtfs.c",
+        "rproc.c",
+        "sharedmem.c",
+        "storage.c",
+        "util.c",
+    ],
+    shared_libs: ["libqrtr"],
+}
diff --git a/shared/vendor/rmtfs/LICENSE b/shared/vendor/rmtfs/LICENSE
new file mode 100644
index 0000000..42c13e9
--- /dev/null
+++ b/shared/vendor/rmtfs/LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2016, Linaro Ltd
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+   may be used to endorse or promote products derived from this software
+   without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/shared/vendor/rmtfs/Makefile b/shared/vendor/rmtfs/Makefile
new file mode 100644
index 0000000..54ae35f
--- /dev/null
+++ b/shared/vendor/rmtfs/Makefile
@@ -0,0 +1,27 @@
+OUT := rmtfs
+
+CFLAGS += -Wall -g -O2
+LDFLAGS += -lqrtr -ludev -lpthread
+prefix = /usr/local
+bindir := $(prefix)/bin
+servicedir := $(prefix)/lib/systemd/system
+
+SRCS := qmi_rmtfs.c rmtfs.c rproc.c sharedmem.c storage.c util.c
+OBJS := $(SRCS:.c=.o)
+
+$(OUT): $(OBJS)
+	$(CC) -o $@ $^ $(LDFLAGS)
+
+%.c: %.qmi
+	qmic -k < $<
+
+rmtfs.service: rmtfs.service.in
+	@sed 's+RMTFS_PATH+$(bindir)+g' $< > $@
+
+install: $(OUT) rmtfs.service
+	@install -D -m 755 $(OUT) $(DESTDIR)$(prefix)/bin/$(OUT)
+	@install -D -m 644 rmtfs.service $(DESTDIR)$(servicedir)/rmtfs.service
+
+clean:
+	rm -f $(OUT) $(OBJS) rmtfs.service
+
diff --git a/shared/vendor/rmtfs/qmi_rmtfs.c b/shared/vendor/rmtfs/qmi_rmtfs.c
new file mode 100644
index 0000000..bda2b78
--- /dev/null
+++ b/shared/vendor/rmtfs/qmi_rmtfs.c
@@ -0,0 +1,256 @@
+#include <errno.h>
+#include <string.h>
+#include "qmi_rmtfs.h"
+
+struct qmi_elem_info rmtfs_qmi_result_ei[] = {
+	{
+		.data_type = QMI_UNSIGNED_2_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint16_t),
+		.offset = offsetof(struct rmtfs_qmi_result, result),
+	},
+	{
+		.data_type = QMI_UNSIGNED_2_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint16_t),
+		.offset = offsetof(struct rmtfs_qmi_result, error),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_iovec_entry_ei[] = {
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.offset = offsetof(struct rmtfs_iovec_entry, sector_addr),
+	},
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.offset = offsetof(struct rmtfs_iovec_entry, phys_offset),
+	},
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.offset = offsetof(struct rmtfs_iovec_entry, num_sector),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_open_req_ei[] = {
+	{
+		.data_type = QMI_STRING,
+		.elem_len = 256,
+		.elem_size = sizeof(char),
+		.array_type = VAR_LEN_ARRAY,
+		.tlv_type = 1,
+		.offset = offsetof(struct rmtfs_open_req, path)
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_open_resp_ei[] = {
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 1,
+		.elem_size = sizeof(struct rmtfs_qmi_result),
+		.tlv_type = 2,
+		.offset = offsetof(struct rmtfs_open_resp, result),
+		.ei_array = rmtfs_qmi_result_ei,
+	},
+	{
+		.data_type = QMI_OPT_FLAG,
+		.elem_len = 1,
+		.elem_size = sizeof(bool),
+		.tlv_type = 16,
+		.offset = offsetof(struct rmtfs_open_resp, caller_id_valid),
+	},
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.tlv_type = 16,
+		.offset = offsetof(struct rmtfs_open_resp, caller_id),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_close_req_ei[] = {
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.tlv_type = 1,
+		.offset = offsetof(struct rmtfs_close_req, caller_id),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_close_resp_ei[] = {
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 1,
+		.elem_size = sizeof(struct rmtfs_qmi_result),
+		.tlv_type = 2,
+		.offset = offsetof(struct rmtfs_close_resp, result),
+		.ei_array = rmtfs_qmi_result_ei,
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_iovec_req_ei[] = {
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.tlv_type = 1,
+		.offset = offsetof(struct rmtfs_iovec_req, caller_id),
+	},
+	{
+		.data_type = QMI_UNSIGNED_1_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint8_t),
+		.tlv_type = 2,
+		.offset = offsetof(struct rmtfs_iovec_req, direction),
+	},
+	{
+		.data_type = QMI_DATA_LEN,
+		.elem_len = 1,
+		.elem_size = sizeof(uint8_t),
+		.tlv_type = 3,
+		.offset = offsetof(struct rmtfs_iovec_req, iovec_len),
+	},
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 255,
+		.elem_size = sizeof(struct rmtfs_iovec_entry),
+		.array_type = VAR_LEN_ARRAY,
+		.tlv_type = 3,
+		.offset = offsetof(struct rmtfs_iovec_req, iovec),
+		.ei_array = rmtfs_iovec_entry_ei,
+	},
+	{
+		.data_type = QMI_UNSIGNED_1_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint8_t),
+		.tlv_type = 4,
+		.offset = offsetof(struct rmtfs_iovec_req, is_force_sync),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_iovec_resp_ei[] = {
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 1,
+		.elem_size = sizeof(struct rmtfs_qmi_result),
+		.tlv_type = 2,
+		.offset = offsetof(struct rmtfs_iovec_resp, result),
+		.ei_array = rmtfs_qmi_result_ei,
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_alloc_buf_req_ei[] = {
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.tlv_type = 1,
+		.offset = offsetof(struct rmtfs_alloc_buf_req, caller_id),
+	},
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.tlv_type = 2,
+		.offset = offsetof(struct rmtfs_alloc_buf_req, buff_size),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_alloc_buf_resp_ei[] = {
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 1,
+		.elem_size = sizeof(struct rmtfs_qmi_result),
+		.tlv_type = 2,
+		.offset = offsetof(struct rmtfs_alloc_buf_resp, result),
+		.ei_array = rmtfs_qmi_result_ei,
+	},
+	{
+		.data_type = QMI_OPT_FLAG,
+		.elem_len = 1,
+		.elem_size = sizeof(bool),
+		.tlv_type = 16,
+		.offset = offsetof(struct rmtfs_alloc_buf_resp, buff_address_valid),
+	},
+	{
+		.data_type = QMI_UNSIGNED_8_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint64_t),
+		.tlv_type = 16,
+		.offset = offsetof(struct rmtfs_alloc_buf_resp, buff_address),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_dev_error_req_ei[] = {
+	{
+		.data_type = QMI_UNSIGNED_4_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint32_t),
+		.tlv_type = 1,
+		.offset = offsetof(struct rmtfs_dev_error_req, caller_id),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_dev_error_resp_ei[] = {
+	{
+		.data_type = QMI_STRUCT,
+		.elem_len = 1,
+		.elem_size = sizeof(struct rmtfs_qmi_result),
+		.tlv_type = 2,
+		.offset = offsetof(struct rmtfs_dev_error_resp, result),
+		.ei_array = rmtfs_qmi_result_ei,
+	},
+	{
+		.data_type = QMI_OPT_FLAG,
+		.elem_len = 1,
+		.elem_size = sizeof(bool),
+		.tlv_type = 16,
+		.offset = offsetof(struct rmtfs_dev_error_resp, status_valid),
+	},
+	{
+		.data_type = QMI_UNSIGNED_1_BYTE,
+		.elem_len = 1,
+		.elem_size = sizeof(uint8_t),
+		.tlv_type = 16,
+		.offset = offsetof(struct rmtfs_dev_error_resp, status),
+	},
+	{}
+};
+
+struct qmi_elem_info rmtfs_force_sync_ei[] = {
+	{
+		.data_type = QMI_DATA_LEN,
+		.elem_len = 1,
+		.elem_size = sizeof(uint8_t),
+		.tlv_type = 1,
+		.offset = offsetof(struct rmtfs_force_sync, caller_id_len),
+	},
+	{
+		.data_type = QMI_UNSIGNED_1_BYTE,
+		.elem_len = 10,
+		.elem_size = sizeof(uint32_t),
+		.array_type = VAR_LEN_ARRAY,
+		.tlv_type = 1,
+		.offset = offsetof(struct rmtfs_force_sync, caller_id),
+	},
+	{}
+};
+
diff --git a/shared/vendor/rmtfs/qmi_rmtfs.h b/shared/vendor/rmtfs/qmi_rmtfs.h
new file mode 100644
index 0000000..03cbc8f
--- /dev/null
+++ b/shared/vendor/rmtfs/qmi_rmtfs.h
@@ -0,0 +1,101 @@
+#ifndef __QMI_RMTFS_H__
+#define __QMI_RMTFS_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "libqrtr.h"
+
+#define QMI_RMTFS_RESULT_SUCCESS 0
+#define QMI_RMTFS_RESULT_FAILURE 1
+#define QMI_RMTFS_ERR_NONE 0
+#define QMI_RMTFS_ERR_INTERNAL 1
+#define QMI_RMTFS_ERR_MALFORMED_MSG 2
+#define QMI_RMTFS_OPEN 1
+#define QMI_RMTFS_CLOSE 2
+#define QMI_RMTFS_RW_IOVEC 3
+#define QMI_RMTFS_ALLOC_BUFF 4
+#define QMI_RMTFS_GET_DEV_ERROR 5
+#define QMI_RMTFS_FORCE_SYNC_IND 6
+
+struct rmtfs_qmi_result {
+	uint16_t result;
+	uint16_t error;
+};
+
+struct rmtfs_iovec_entry {
+	uint32_t sector_addr;
+	uint32_t phys_offset;
+	uint32_t num_sector;
+};
+
+struct rmtfs_open_req {
+	uint32_t path_len;
+	char path[256];
+};
+
+struct rmtfs_open_resp {
+	struct rmtfs_qmi_result result;
+	bool caller_id_valid;
+	uint32_t caller_id;
+};
+
+struct rmtfs_close_req {
+	uint32_t caller_id;
+};
+
+struct rmtfs_close_resp {
+	struct rmtfs_qmi_result result;
+};
+
+struct rmtfs_iovec_req {
+	uint32_t caller_id;
+	uint8_t direction;
+	size_t iovec_len;
+	struct rmtfs_iovec_entry iovec[255];
+	uint8_t is_force_sync;
+};
+
+struct rmtfs_iovec_resp {
+	struct rmtfs_qmi_result result;
+};
+
+struct rmtfs_alloc_buf_req {
+	uint32_t caller_id;
+	uint32_t buff_size;
+};
+
+struct rmtfs_alloc_buf_resp {
+	struct rmtfs_qmi_result result;
+	bool buff_address_valid;
+	uint64_t buff_address;
+};
+
+struct rmtfs_dev_error_req {
+	uint32_t caller_id;
+};
+
+struct rmtfs_dev_error_resp {
+	struct rmtfs_qmi_result result;
+	bool status_valid;
+	uint8_t status;
+};
+
+struct rmtfs_force_sync {
+	size_t caller_id_len;
+	uint32_t caller_id[10];
+};
+
+extern struct qmi_elem_info rmtfs_open_req_ei[];
+extern struct qmi_elem_info rmtfs_open_resp_ei[];
+extern struct qmi_elem_info rmtfs_close_req_ei[];
+extern struct qmi_elem_info rmtfs_close_resp_ei[];
+extern struct qmi_elem_info rmtfs_iovec_req_ei[];
+extern struct qmi_elem_info rmtfs_iovec_resp_ei[];
+extern struct qmi_elem_info rmtfs_alloc_buf_req_ei[];
+extern struct qmi_elem_info rmtfs_alloc_buf_resp_ei[];
+extern struct qmi_elem_info rmtfs_dev_error_req_ei[];
+extern struct qmi_elem_info rmtfs_dev_error_resp_ei[];
+extern struct qmi_elem_info rmtfs_force_sync_ei[];
+
+#endif
diff --git a/shared/vendor/rmtfs/qmi_rmtfs.qmi b/shared/vendor/rmtfs/qmi_rmtfs.qmi
new file mode 100644
index 0000000..ca350d7
--- /dev/null
+++ b/shared/vendor/rmtfs/qmi_rmtfs.qmi
@@ -0,0 +1,77 @@
+package rmtfs;
+
+const QMI_RMTFS_RESULT_SUCCESS = 0;
+const QMI_RMTFS_RESULT_FAILURE = 1;
+
+const QMI_RMTFS_ERR_NONE = 0;
+const QMI_RMTFS_ERR_INTERNAL = 1;
+const QMI_RMTFS_ERR_MALFORMED_MSG = 2;
+
+const QMI_RMTFS_OPEN = 1;
+const QMI_RMTFS_CLOSE = 2;
+const QMI_RMTFS_RW_IOVEC = 3;
+const QMI_RMTFS_ALLOC_BUFF = 4;
+const QMI_RMTFS_GET_DEV_ERROR = 5;
+const QMI_RMTFS_FORCE_SYNC_IND = 6;
+
+struct qmi_result {
+	u16 result;
+	u16 error;
+};
+
+struct iovec_entry {
+	u32 sector_addr;
+	u32 phys_offset;
+	u32 num_sector;
+};
+
+request open_req {
+	required string path = 1;
+} = 1;
+
+response open_resp {
+	required qmi_result result = 2;
+	optional u32 caller_id = 0x10;
+} = 1;
+
+request close_req {
+	required u32 caller_id = 1;
+} = 2;
+
+response close_resp {
+	required qmi_result result = 2;
+} = 2;
+
+request iovec_req {
+	required u32 caller_id = 1;
+	required u8 direction = 2;
+	required iovec_entry iovec(255) = 3;
+	required u8 is_force_sync = 4;
+} = 3;
+
+response iovec_resp {
+	required qmi_result result = 2;
+} = 3;
+
+request alloc_buf_req {
+	required u32 caller_id = 1;
+	required u32 buff_size = 2;
+} = 4;
+
+response alloc_buf_resp {
+	required qmi_result result = 2;
+	optional u64 buff_address = 0x10;
+} = 4;
+
+request dev_error_req {
+	required u32 caller_id = 1;
+} = 5;
+
+response dev_error_resp {
+	required qmi_result result = 2;
+	optional u8 status = 0x10;
+} = 5;
+
+indication force_sync {
+	required u32 caller_id(10) = 1;
+} = 6;
diff --git a/shared/vendor/rmtfs/qmi_tlv.c b/shared/vendor/rmtfs/qmi_tlv.c
new file mode 100644
index 0000000..c6d8207
--- /dev/null
+++ b/shared/vendor/rmtfs/qmi_tlv.c
@@ -0,0 +1,233 @@
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+#include "qmi_rmtfs.h"
+
+struct qmi_packet {
+	uint8_t flags;
+	uint16_t txn_id;
+	uint16_t msg_id;
+	uint16_t msg_len;
+	uint8_t data[];
+} __attribute__((__packed__));
+
+struct qmi_tlv {
+	void *allocated;
+	void *buf;
+	size_t size;
+	int error;
+};
+
+struct qmi_tlv_item {
+	uint8_t key;
+	uint16_t len;
+	uint8_t data[];
+} __attribute__((__packed__));
+
+struct qmi_tlv *qmi_tlv_init(unsigned txn, unsigned msg_id, unsigned msg_type)
+{
+	struct qmi_packet *pkt;
+	struct qmi_tlv *tlv;
+
+	tlv = malloc(sizeof(struct qmi_tlv));
+	memset(tlv, 0, sizeof(struct qmi_tlv));
+
+	tlv->size = sizeof(struct qmi_packet);
+	tlv->allocated = malloc(tlv->size);
+	tlv->buf = tlv->allocated;
+
+	pkt = tlv->buf;
+	pkt->flags = msg_type;
+	pkt->txn_id = txn;
+	pkt->msg_id = msg_id;
+	pkt->msg_len = 0;
+
+	return tlv;
+}
+
+struct qmi_tlv *qmi_tlv_decode(void *buf, size_t len, unsigned *txn, unsigned msg_type)
+{
+	struct qmi_packet *pkt = buf;
+	struct qmi_tlv *tlv;
+
+	if (pkt->flags != msg_type)
+		return NULL;
+
+	tlv = malloc(sizeof(struct qmi_tlv));
+	memset(tlv, 0, sizeof(struct qmi_tlv));
+
+	tlv->buf = buf;
+	tlv->size = len;
+
+	if (txn)
+		*txn = pkt->txn_id;
+
+	return tlv;
+}
+
+void *qmi_tlv_encode(struct qmi_tlv *tlv, size_t *len)
+{
+
+	struct qmi_packet *pkt;
+
+	if (!tlv || tlv->error)
+		return NULL;
+
+	pkt = tlv->buf;
+	pkt->msg_len = tlv->size - sizeof(struct qmi_packet);
+
+	*len = tlv->size;
+	return tlv->buf;
+}
+
+void qmi_tlv_free(struct qmi_tlv *tlv)
+{
+	free(tlv->allocated);
+	free(tlv);
+}
+
+static struct qmi_tlv_item *qmi_tlv_get_item(struct qmi_tlv *tlv, unsigned id)
+{
+	struct qmi_tlv_item *item;
+	struct qmi_packet *pkt;
+	unsigned offset = 0;
+	void *pkt_data;
+
+	pkt = tlv->buf;
+	pkt_data = pkt->data;
+
+	while (offset < tlv->size) {
+		item = pkt_data + offset;
+		if (item->key == id)
+			return pkt_data + offset;
+
+		offset += sizeof(struct qmi_tlv_item) + item->len;
+	}
+	return NULL;
+}
+
+void *qmi_tlv_get(struct qmi_tlv *tlv, unsigned id, size_t *len)
+{
+	struct qmi_tlv_item *item;
+
+	item = qmi_tlv_get_item(tlv, id);
+	if (!item)
+		return NULL;
+
+	*len = item->len;
+	return item->data;
+}
+
+void *qmi_tlv_get_array(struct qmi_tlv *tlv, unsigned id, unsigned len_size, size_t *len, size_t *size)
+{
+	struct qmi_tlv_item *item;
+	unsigned count;
+	void *ptr;
+
+	item = qmi_tlv_get_item(tlv, id);
+	if (!item)
+		return NULL;
+
+	ptr = item->data;
+	switch (len_size) {
+	case 4:
+		count = *(uint32_t*)ptr++;
+		break;
+	case 2:
+		count = *(uint16_t*)ptr++;
+		break;
+	case 1:
+		count = *(uint8_t*)ptr++;
+		break;
+	}
+
+	*len = count;
+	*size = (item->len - len_size) / count;
+
+	return ptr;
+}
+
+static struct qmi_tlv_item *qmi_tlv_alloc_item(struct qmi_tlv *tlv, unsigned id, size_t len)
+{
+	struct qmi_tlv_item *item;
+	size_t new_size;
+	bool migrate;
+	void *newp;
+
+	/* If using user provided buffer, migrate data */
+	migrate = !tlv->allocated;
+
+	new_size = tlv->size + sizeof(struct qmi_tlv_item) + len;
+	newp = realloc(tlv->allocated, new_size);
+	if (!newp)
+		return NULL;
+
+	if (migrate)
+		memcpy(newp, tlv->buf, tlv->size);
+
+	item = newp + tlv->size;
+	item->key = id;
+	item->len = len;
+
+	tlv->buf = tlv->allocated = newp;
+	tlv->size = new_size;
+
+	return item;
+}
+
+int qmi_tlv_set(struct qmi_tlv *tlv, unsigned id, void *buf, size_t len)
+{
+	struct qmi_tlv_item *item;
+
+	if (!tlv)
+		return -EINVAL;
+
+	item = qmi_tlv_alloc_item(tlv, id, len);
+	if (!item) {
+		tlv->error = ENOMEM;
+		return -ENOMEM;
+	}
+
+	memcpy(item->data, buf, len);
+
+	return 0;
+}
+
+int qmi_tlv_set_array(struct qmi_tlv *tlv, unsigned id, unsigned len_size, void *buf, size_t len, size_t size)
+{
+	struct qmi_tlv_item *item;
+	size_t array_size;
+	void *ptr;
+
+	if (!tlv)
+		return -EINVAL;
+
+	array_size = len * size;
+	item = qmi_tlv_alloc_item(tlv, id, len_size + array_size);
+	if (!item) {
+		tlv->error = ENOMEM;
+		return -ENOMEM;
+	}
+
+	ptr = item->data;
+
+	switch (len_size) {
+	case 4:
+		*(uint32_t*)ptr++ = len;
+		break;
+	case 2:
+		*(uint16_t*)ptr++ = len;
+		break;
+	case 1:
+		*(uint8_t*)ptr++ = len;
+		break;
+	}
+	memcpy(ptr, buf, array_size);
+
+	return 0;
+}
+
+
diff --git a/shared/vendor/rmtfs/rmtfs.c b/shared/vendor/rmtfs/rmtfs.c
new file mode 100644
index 0000000..ffca070
--- /dev/null
+++ b/shared/vendor/rmtfs/rmtfs.c
@@ -0,0 +1,575 @@
+#include <sys/mman.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libqrtr.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "qmi_rmtfs.h"
+#include "util.h"
+#include "rmtfs.h"
+
+#define RMTFS_QMI_SERVICE	14
+#define RMTFS_QMI_VERSION	1
+#define RMTFS_QMI_INSTANCE	0
+
+static struct rmtfs_mem *rmem;
+static sig_atomic_t sig_int_count;
+
+static bool dbgprintf_enabled;
+static void dbgprintf(const char *fmt, ...)
+{
+	va_list ap;
+
+	if (!dbgprintf_enabled)
+		return;
+
+	va_start(ap, fmt);
+	vprintf(fmt, ap);
+	va_end(ap);
+}
+
+static void qmi_result_error(struct rmtfs_qmi_result *result, unsigned error)
+{
+	/* Only propagate initial error */
+	if (result->result == QMI_RMTFS_RESULT_FAILURE)
+		return;
+
+	result->result = QMI_RMTFS_RESULT_FAILURE;
+	result->error = error;
+}
+
+static void rmtfs_open(int sock, const struct qrtr_packet *pkt)
+{
+	struct rmtfs_open_resp resp = {};
+	struct rmtfs_open_req req = {};
+	DEFINE_QRTR_PACKET(resp_buf, 256);
+	struct rmtfd *rmtfd;
+	unsigned int txn;
+	ssize_t len;
+	int caller_id = -1;
+	int ret;
+
+	ret = qmi_decode_message(&req, &txn, pkt, QMI_REQUEST,
+				 QMI_RMTFS_OPEN, rmtfs_open_req_ei);
+	if (ret < 0) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_MALFORMED_MSG);
+		goto respond;
+	}
+
+	rmtfd = storage_open(pkt->node, req.path);
+	if (!rmtfd) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL);
+		goto respond;
+	}
+
+	caller_id = storage_get_caller_id(rmtfd);
+	resp.caller_id = caller_id;
+	resp.caller_id_valid = true;
+
+respond:
+	dbgprintf("[RMTFS] open %s => %d (%d:%d)\n",
+		  req.path, caller_id, resp.result.result, resp.result.error);
+
+	len = qmi_encode_message(&resp_buf,
+				 QMI_RESPONSE, QMI_RMTFS_OPEN, txn, &resp,
+				 rmtfs_open_resp_ei);
+	if (len < 0) {
+		fprintf(stderr, "[RMTFS] failed to encode open-response: %s\n",
+			strerror(-len));
+		return;
+	}
+
+	ret = qrtr_sendto(sock, pkt->node, pkt->port,
+			  resp_buf.data, resp_buf.data_len);
+	if (ret < 0)
+		fprintf(stderr, "[RMTFS] failed to send open-response: %s\n",
+			strerror(-ret));
+}
+
+static void rmtfs_close(int sock, const struct qrtr_packet *pkt)
+{
+	struct rmtfs_close_resp resp = {};
+	struct rmtfs_close_req req = {};
+	DEFINE_QRTR_PACKET(resp_buf, 256);
+	struct rmtfd *rmtfd;
+	unsigned int txn;
+	ssize_t len;
+	int ret;
+
+	ret = qmi_decode_message(&req, &txn, pkt, QMI_REQUEST,
+				 QMI_RMTFS_CLOSE, rmtfs_close_req_ei);
+	if (ret < 0) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_MALFORMED_MSG);
+		goto respond;
+	}
+
+	rmtfd = storage_get(pkt->node, req.caller_id);
+	if (!rmtfd) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL);
+		goto respond;
+	}
+
+	storage_close(rmtfd);
+	rmtfs_mem_free(rmem);
+
+respond:
+	dbgprintf("[RMTFS] close %s => %d (%d:%d)\n",
+		  req.caller_id, resp.result.result, resp.result.error);
+
+	len = qmi_encode_message(&resp_buf,
+				 QMI_RESPONSE, QMI_RMTFS_CLOSE, txn, &resp,
+				 rmtfs_close_resp_ei);
+	if (len < 0) {
+		fprintf(stderr, "[RMTFS] failed to encode close-response: %s\n",
+			strerror(-len));
+		return;
+	}
+
+	ret = qrtr_sendto(sock, pkt->node, pkt->port,
+			  resp_buf.data, resp_buf.data_len);
+	if (ret < 0)
+		fprintf(stderr, "[RMTFS] failed to send close-response: %s\n",
+			strerror(-ret));
+}
+
+static void rmtfs_iovec(int sock, struct qrtr_packet *pkt)
+{
+	struct rmtfs_iovec_entry *entries;
+	struct rmtfs_iovec_resp resp = {};
+	struct rmtfs_iovec_req req = {};
+	DEFINE_QRTR_PACKET(resp_buf, 256);
+	struct rmtfd *rmtfd;
+	uint32_t caller_id = 0;
+	size_t num_entries = 0;
+	off_t sector_base;
+	uint8_t is_write;
+	off_t phys_base;
+	uint8_t force = 0;
+	unsigned txn;
+	off_t offset;
+	ssize_t len;
+	ssize_t n;
+	char buf[SECTOR_SIZE];
+	int ret;
+	int i;
+	int j;
+
+	ret = qmi_decode_message(&req, &txn, pkt, QMI_REQUEST,
+				 QMI_RMTFS_RW_IOVEC, rmtfs_iovec_req_ei);
+	if (ret < 0) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_MALFORMED_MSG);
+		goto respond;
+	}
+
+	caller_id = req.caller_id;
+	is_write = req.direction;
+	entries = req.iovec;
+	num_entries = req.iovec_len;
+	force = req.is_force_sync;
+
+	rmtfd = storage_get(pkt->node, caller_id);
+	if (!rmtfd) {
+		fprintf(stderr, "[RMTFS] iovec request for non-existing caller\n");
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL);
+		goto respond;
+	}
+
+	for (i = 0; i < num_entries; i++) {
+		phys_base = entries[i].phys_offset;
+		sector_base = entries[i].sector_addr * SECTOR_SIZE;
+		offset = 0;
+
+		for (j = 0; j < entries[i].num_sector; j++) {
+			if (is_write) {
+				n = rmtfs_mem_read(rmem, phys_base + offset, buf, SECTOR_SIZE);
+				if (n == SECTOR_SIZE)
+					n = storage_pwrite(rmtfd, buf, n, sector_base + offset);
+			} else {
+				n = storage_pread(rmtfd, buf, SECTOR_SIZE, sector_base + offset);
+				if (n >= 0) {
+					if (n < SECTOR_SIZE)
+						memset(buf + n, 0, SECTOR_SIZE - n);
+					n = rmtfs_mem_write(rmem, phys_base + offset, buf, SECTOR_SIZE);
+				}
+			}
+
+			if (n != SECTOR_SIZE) {
+				fprintf(stderr, "[RMTFS] failed to %s sector %d\n",
+					is_write ? "write" : "read", entries[i].sector_addr + j);
+				qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL);
+				goto respond;
+			}
+
+			offset += SECTOR_SIZE;
+		}
+	}
+
+respond:
+	dbgprintf("[RMTFS] iovec %d, %sforced => (%d:%d)\n", caller_id, force ? "" : "not ",
+							     resp.result.result, resp.result.error);
+
+	if (is_write)
+		storage_sync(rmtfd);
+
+	for (i = 0; i < num_entries; i++) {
+		dbgprintf("[RMTFS]       %s %d:%d 0x%x\n", is_write ? "write" : "read",
+							   entries[i].sector_addr,
+							   entries[i].num_sector,
+							   entries[i].phys_offset);
+	}
+
+	len = qmi_encode_message(&resp_buf,
+				 QMI_RESPONSE, QMI_RMTFS_RW_IOVEC, txn, &resp,
+				 rmtfs_iovec_resp_ei);
+	if (len < 0) {
+		fprintf(stderr, "[RMTFS] failed to encode iovec-response: %s\n",
+			strerror(-len));
+		return;
+	}
+
+	ret = qrtr_sendto(sock, pkt->node, pkt->port,
+			  resp_buf.data, resp_buf.data_len);
+	if (ret < 0)
+		fprintf(stderr, "[RMTFS] failed to send iovec-response: %s\n",
+			strerror(-ret));
+}
+
+static void rmtfs_alloc_buf(int sock, struct qrtr_packet *pkt)
+{
+	struct rmtfs_alloc_buf_resp resp = {};
+	struct rmtfs_alloc_buf_req req = {};
+	DEFINE_QRTR_PACKET(resp_buf, 256);
+	uint32_t alloc_size = 0;
+	uint32_t caller_id = 0;
+	int64_t address = 0;
+	unsigned txn;
+	ssize_t len;
+	int ret;
+
+	ret = qmi_decode_message(&req, &txn, pkt, QMI_REQUEST,
+				 QMI_RMTFS_ALLOC_BUFF, rmtfs_alloc_buf_req_ei);
+	if (ret < 0) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_MALFORMED_MSG);
+		goto respond;
+	}
+
+	caller_id = req.caller_id;
+	alloc_size = req.buff_size;
+
+	address = rmtfs_mem_alloc(rmem, alloc_size);
+	if (address < 0) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL);
+		goto respond;
+	}
+
+	resp.buff_address = address;
+	resp.buff_address_valid = true;
+respond:
+	dbgprintf("[RMTFS] alloc %d, %d => 0x%lx (%d:%d)\n", caller_id, alloc_size, address, resp.result.result, resp.result.error);
+
+	len = qmi_encode_message(&resp_buf,
+				 QMI_RESPONSE, QMI_RMTFS_ALLOC_BUFF, txn, &resp,
+				 rmtfs_alloc_buf_resp_ei);
+	if (len < 0) {
+		fprintf(stderr, "[RMTFS] failed to encode alloc-buf-response: %s\n",
+			strerror(-len));
+		return;
+	}
+
+	ret = qrtr_sendto(sock, pkt->node, pkt->port,
+			  resp_buf.data, resp_buf.data_len);
+	if (ret < 0)
+		fprintf(stderr, "[RMTFS] failed to send alloc-buf-response: %s\n",
+			strerror(-ret));
+}
+
+static void rmtfs_get_dev_error(int sock, struct qrtr_packet *pkt)
+{
+	struct rmtfs_dev_error_resp resp = {};
+	struct rmtfs_dev_error_req req = {};
+	DEFINE_QRTR_PACKET(resp_buf, 256);
+	struct rmtfd *rmtfd;
+	unsigned txn;
+	ssize_t len;
+	int ret;
+
+	ret = qmi_decode_message(&req, &txn, pkt, QMI_REQUEST,
+				 QMI_RMTFS_GET_DEV_ERROR,
+				 rmtfs_dev_error_req_ei);
+	if (ret < 0) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_MALFORMED_MSG);
+		goto respond;
+	}
+
+	rmtfd = storage_get(pkt->node, req.caller_id);
+	if (rmtfd) {
+		qmi_result_error(&resp.result, QMI_RMTFS_ERR_INTERNAL);
+		goto respond;
+	}
+
+	resp.status = storage_get_error(rmtfd);
+	resp.status_valid = true;
+
+respond:
+	dbgprintf("[RMTFS] dev_error %d => %d (%d:%d)\n", req.caller_id, resp.status, resp.result.result, resp.result.error);
+
+	len = qmi_encode_message(&resp_buf,
+				 QMI_RESPONSE, QMI_RMTFS_GET_DEV_ERROR, txn,
+				 &resp, rmtfs_dev_error_resp_ei);
+	if (len < 0) {
+		fprintf(stderr, "[RMTFS] failed to encode dev-error-response: %s\n",
+			strerror(-len));
+		return;
+	}
+
+	ret = qrtr_sendto(sock, pkt->node, pkt->port,
+			  resp_buf.data, resp_buf.data_len);
+	if (ret < 0)
+		fprintf(stderr, "[RMTFS] failed to send dev-error-response: %s\n",
+			strerror(-ret));
+}
+
+static int rmtfs_bye(uint32_t node)
+{
+	dbgprintf("[RMTFS] bye from %d\n", node);
+
+	return 0;
+}
+
+static int rmtfs_del_client(uint32_t node, uint32_t port)
+{
+	dbgprintf("[RMTFS] del_client %d:%d\n", node, port);
+
+	return 0;
+}
+
+static int handle_rmtfs(int sock)
+{
+	struct sockaddr_qrtr sq;
+	struct qrtr_packet pkt;
+	unsigned int msg_id;
+	socklen_t sl;
+	char buf[4096];
+	int ret;
+
+	sl = sizeof(sq);
+	ret = recvfrom(sock, buf, sizeof(buf), 0, (void *)&sq, &sl);
+	if (ret < 0) {
+		ret = -errno;
+		if (ret != -ENETRESET)
+			fprintf(stderr, "[RMTFS] recvfrom failed: %d\n", ret);
+		return ret;
+	}
+
+	dbgprintf("[RMTFS] packet; from: %d:%d\n", sq.sq_node, sq.sq_port);
+
+	ret = qrtr_decode(&pkt, buf, ret, &sq);
+	if (ret < 0) {
+		fprintf(stderr, "[RMTFS] unable to decode qrtr packet\n");
+		return ret;
+	}
+
+	switch (pkt.type) {
+	case QRTR_TYPE_BYE:
+		return rmtfs_bye(pkt.node);
+	case QRTR_TYPE_DEL_CLIENT:
+		return rmtfs_del_client(pkt.node, pkt.port);
+	case QRTR_TYPE_DATA:
+		ret = qmi_decode_header(&pkt, &msg_id);
+		if (ret < 0)
+			return ret;
+
+		switch (msg_id) {
+		case QMI_RMTFS_OPEN:
+			rmtfs_open(sock, &pkt);
+			break;
+		case QMI_RMTFS_CLOSE:
+			rmtfs_close(sock, &pkt);
+			break;
+		case QMI_RMTFS_RW_IOVEC:
+			rmtfs_iovec(sock, &pkt);
+			break;
+		case QMI_RMTFS_ALLOC_BUFF:
+			rmtfs_alloc_buf(sock, &pkt);
+			break;
+		case QMI_RMTFS_GET_DEV_ERROR:
+			rmtfs_get_dev_error(sock, &pkt);
+			break;
+		default:
+			fprintf(stderr, "[RMTFS] Unknown request: %d\n", msg_id);
+			break;
+		}
+
+		return 0;
+	}
+
+	return ret;
+}
+
+static int sig_int_count;
+
+static int run_rmtfs(int rprocfd)
+{
+	bool sig_int_handled = false;
+	int rmtfs_fd;
+	fd_set rfds;
+	char done;
+	int nfds;
+	int ret;
+
+	rmtfs_fd = qrtr_open(RMTFS_QMI_SERVICE);
+	if (rmtfs_fd < 0) {
+		fprintf(stderr, "failed to create qrtr socket\n");
+		return rmtfs_fd;
+	}
+
+	dbgprintf("registering services\n");
+
+	ret = qrtr_publish(rmtfs_fd, RMTFS_QMI_SERVICE,
+			   RMTFS_QMI_VERSION, RMTFS_QMI_INSTANCE);
+	if (ret < 0) {
+		fprintf(stderr, "failed to publish rmtfs service");
+		return ret;
+	}
+
+	if (rprocfd >= 0)
+		rproc_start();
+
+	for (;;) {
+		if (sig_int_count == 1 && !sig_int_handled) {
+			if (rprocfd < 0)
+				break;
+
+			rproc_stop();
+			sig_int_handled = true;
+		} else if (sig_int_count > 1) {
+			break;
+		}
+
+		FD_ZERO(&rfds);
+		FD_SET(rmtfs_fd, &rfds);
+		if (rprocfd >= 0)
+			FD_SET(rprocfd, &rfds);
+		nfds = MAX(rmtfs_fd, rprocfd) + 1;
+
+		ret = select(nfds, &rfds, NULL, NULL, NULL);
+		if (ret < 0 && errno != EINTR)
+			break;
+		else if (ret < 0 && errno == EINTR)
+			continue;
+
+		if (rprocfd >= 0 && FD_ISSET(rprocfd, &rfds)) {
+			ret = read(rprocfd, &done, 1);
+			if (!ret || done == 'Y')
+				break;
+		}
+
+		if (FD_ISSET(rmtfs_fd, &rfds)) {
+			ret = handle_rmtfs(rmtfs_fd);
+			if (ret == -ENETRESET)
+				break;
+		}
+	}
+
+	close(rmtfs_fd);
+
+	return ret;
+}
+
+static void sig_int_handler(int signo)
+{
+	sig_int_count++;
+}
+
+int main(int argc, char **argv)
+{
+	struct sigaction action;
+	bool use_partitions = false;
+	bool read_only = false;
+	int rprocfd = -1;
+	int ret;
+	int option;
+	const char *storage_root = NULL;
+
+	while ((option = getopt(argc, argv, "o:Prsv")) != -1) {
+		switch (option) {
+		/*
+		 * -o sets the directory where EFS images are stored,
+		 * or sets the directory from where raw EFS partitions
+		 * can be picked by-name when used with -P option.
+		 */
+		case 'o':
+			storage_root = optarg;
+			break;
+
+		/* -P to find and use raw EFS partitions */
+		case 'P':
+			use_partitions = true;
+			break;
+
+		/* -r to avoid writing to storage */
+		case 'r':
+			read_only = true;
+			break;
+
+		/* enable sync for the mss rproc instance */
+		case 's':
+			rprocfd = rproc_init();
+			if (rprocfd < 0) {
+				fprintf(stderr, "Failed to get rprocfd\n");
+				return 1;
+			}
+
+			break;
+
+		/* -v is for verbose */
+		case 'v':
+			dbgprintf_enabled = 1;
+			break;
+
+		case '?':
+			fprintf(stderr, "Unknown option: -%c\n", option);
+			return 1;
+		}
+	}
+
+	sigemptyset(&action.sa_mask);
+	action.sa_handler = sig_int_handler;
+	action.sa_flags = 0;
+
+	sigaction(SIGINT, &action, NULL);
+	sigaction(SIGTERM, &action, NULL);
+
+	rmem = rmtfs_mem_open();
+	if (!rmem)
+		return 1;
+
+	ret = storage_init(storage_root, read_only, use_partitions);
+	if (ret) {
+		fprintf(stderr, "failed to initialize storage system\n");
+		goto close_rmtfs_mem;
+	}
+
+	do {
+		ret = run_rmtfs(rprocfd);
+	} while (ret == -ENETRESET);
+
+	storage_exit();
+close_rmtfs_mem:
+	rmtfs_mem_close(rmem);
+
+	return 0;
+}
diff --git a/shared/vendor/rmtfs/rmtfs.h b/shared/vendor/rmtfs/rmtfs.h
new file mode 100644
index 0000000..fa4b806
--- /dev/null
+++ b/shared/vendor/rmtfs/rmtfs.h
@@ -0,0 +1,43 @@
+#ifndef __RMTFS_H__
+#define __RMTFS_H__
+
+#include <stdint.h>
+#include "qmi_rmtfs.h"
+
+#define SECTOR_SIZE		512
+
+struct qmi_packet {
+	uint8_t flags;
+	uint16_t txn_id;
+	uint16_t msg_id;
+	uint16_t msg_len;
+	uint8_t data[];
+} __attribute__((__packed__));
+
+struct rmtfs_mem;
+
+struct rmtfs_mem *rmtfs_mem_open(void);
+void rmtfs_mem_close(struct rmtfs_mem *rmem);
+int64_t rmtfs_mem_alloc(struct rmtfs_mem *rmem, size_t size);
+void rmtfs_mem_free(struct rmtfs_mem *rmem);
+ssize_t rmtfs_mem_read(struct rmtfs_mem *rmem, unsigned long phys_address, void *buf, ssize_t len);
+ssize_t rmtfs_mem_write(struct rmtfs_mem *rmem, unsigned long phys_address, const void *buf, ssize_t len);
+
+struct rmtfd;
+
+int storage_init(const char *storage_root, bool read_only, bool use_partitions);
+struct rmtfd *storage_open(unsigned node, const char *path);
+struct rmtfd *storage_get(unsigned node, int caller_id);
+void storage_close(struct rmtfd *rmtfd);
+int storage_get_caller_id(const struct rmtfd *rmtfd);
+int storage_get_error(const struct rmtfd *rmtfd);
+void storage_exit(void);
+ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t offset);
+ssize_t storage_pwrite(struct rmtfd *rmtfd, const void *buf, size_t nbyte, off_t offset);
+int storage_sync(struct rmtfd *rmtfd);
+
+int rproc_init(void);
+int rproc_start(void);
+int rproc_stop(void);
+
+#endif
diff --git a/shared/vendor/rmtfs/rmtfs.service.in b/shared/vendor/rmtfs/rmtfs.service.in
new file mode 100644
index 0000000..8384043
--- /dev/null
+++ b/shared/vendor/rmtfs/rmtfs.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Qualcomm remotefs service
+Requires=qrtr-ns.service
+After=qrtr-ns.service
+
+[Service]
+ExecStart=RMTFS_PATH/rmtfs -r -P -s
+Restart=always
+RestartSec=1
+
+[Install]
+WantedBy=multi-user.target
diff --git a/shared/vendor/rmtfs/rproc.c b/shared/vendor/rmtfs/rproc.c
new file mode 100644
index 0000000..732d992
--- /dev/null
+++ b/shared/vendor/rmtfs/rproc.c
@@ -0,0 +1,225 @@
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "rmtfs.h"
+
+#define RPROC_BASE_PATH		"/sys/bus/platform/drivers/qcom-q6v5-mss/"
+#define RPROC_CLASS_PATH	"/sys/class/remoteproc/"
+
+static pthread_t start_thread;
+static pthread_t stop_thread;
+static int rproc_state_fd;
+static int rproc_pipe[2];
+
+static int rproc_init_by_modalias(void)
+{
+	struct dirent *rproc_de;
+	char modalias[256];
+	DIR *base_dir;
+	int modalias_fd;
+	int rproc_fd;
+	int state_fd = -1;
+	int base_fd;
+	int ret;
+
+	base_fd = open(RPROC_CLASS_PATH, O_RDONLY | O_DIRECTORY);
+	if (base_fd < 0)
+		return -1;
+
+	base_dir = fdopendir(base_fd);
+	if (!base_dir) {
+		fprintf(stderr, "failed to open remoteproc class path\n");
+		close(base_fd);
+		return -1;
+	}
+
+	while (state_fd < 0 && (rproc_de = readdir(base_dir)) != NULL) {
+		if (!strcmp(rproc_de->d_name, ".") ||
+		    !strcmp(rproc_de->d_name, ".."))
+			continue;
+
+		rproc_fd = openat(base_fd, rproc_de->d_name, O_RDONLY | O_DIRECTORY);
+		if (rproc_fd < 0)
+			continue;
+
+		modalias_fd = openat(rproc_fd, "device/modalias", O_RDONLY);
+		if (modalias_fd < 0)
+			goto close_rproc_fd;
+
+		ret = read(modalias_fd, modalias, sizeof(modalias) - 1);
+		if (ret < 0)
+			goto close_modalias_fd;
+		modalias[ret] = '\0';
+
+		if (!strstr(modalias, "-mpss-pas") && !strstr(modalias, "-mss-pil"))
+			goto close_modalias_fd;
+
+		state_fd = openat(rproc_fd, "state", O_WRONLY);
+		if (state_fd < 0) {
+			fprintf(stderr,
+				"unable to open remoteproc \"state\" control file of %s\n",
+				rproc_de->d_name);
+		}
+
+close_modalias_fd:
+		close(modalias_fd);
+close_rproc_fd:
+		close(rproc_fd);
+	}
+	closedir(base_dir);
+	close(base_fd);
+
+	return state_fd;
+}
+
+static int rproc_init_by_mss_driver(void)
+{
+	struct dirent *device_de;
+	struct dirent *rproc_de;
+	int rproc_base_fd;
+	DIR *rproc_dir;
+	DIR *base_dir;
+	int device_fd;
+	int rproc_fd;
+	int state_fd = -1;
+	int base_fd;
+
+	base_fd = open(RPROC_BASE_PATH, O_RDONLY | O_DIRECTORY);
+	if (base_fd < 0)
+		return -1;
+
+	base_dir = fdopendir(base_fd);
+	if (!base_dir) {
+		fprintf(stderr, "failed to open mss driver path\n");
+		close(base_fd);
+		return -1;
+	}
+
+	while (state_fd < 0 && (device_de = readdir(base_dir)) != NULL) {
+		if (!strcmp(device_de->d_name, ".") ||
+		    !strcmp(device_de->d_name, ".."))
+			continue;
+
+		device_fd = openat(base_fd, device_de->d_name, O_RDONLY | O_DIRECTORY);
+		if (device_fd < 0)
+			continue;
+
+		rproc_base_fd = openat(device_fd, "remoteproc", O_RDONLY | O_DIRECTORY);
+		if (rproc_base_fd < 0) {
+			close(device_fd);
+			continue;
+		}
+
+		rproc_dir = fdopendir(rproc_base_fd);
+		while (state_fd < 0 && (rproc_de = readdir(rproc_dir)) != NULL) {
+			if (!strcmp(rproc_de->d_name, ".") ||
+			    !strcmp(rproc_de->d_name, ".."))
+				continue;
+
+			rproc_fd = openat(rproc_base_fd, rproc_de->d_name, O_RDONLY | O_DIRECTORY);
+			if (rproc_fd < 0)
+				continue;
+
+			state_fd = openat(rproc_fd, "state", O_WRONLY);
+			if (state_fd < 0) {
+				fprintf(stderr,
+					"unable to open remoteproc \"state\" control file of %s\n",
+					device_de->d_name);
+			}
+
+			close(rproc_fd);
+
+		}
+		closedir(rproc_dir);
+		close(rproc_base_fd);
+		close(device_fd);
+	}
+	closedir(base_dir);
+	close(base_fd);
+
+	return state_fd;
+}
+
+int rproc_init(void)
+{
+	int state_fd;
+	int ret;
+
+	state_fd = rproc_init_by_modalias();
+	if (state_fd < 0) {
+		state_fd = rproc_init_by_mss_driver();
+		if (state_fd < 0)
+			return -1;
+	}
+
+	ret = pipe(rproc_pipe);
+	if (ret < 0) {
+		close(state_fd);
+		return -1;
+	}
+
+	rproc_state_fd = state_fd;
+
+	return rproc_pipe[0];
+}
+
+static void *do_rproc_start(void *unused)
+{
+	ssize_t ret;
+
+	ret = pwrite(rproc_state_fd, "start", 5, 0);
+	if (ret < 4) {
+		fprintf(stderr, "failed to update start state: %s\n",
+			strerror(errno));
+	}
+
+	return NULL;
+}
+
+int rproc_start()
+{
+	pthread_attr_t attr;
+
+	pthread_attr_init(&attr);
+	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+	return pthread_create(&start_thread, &attr, do_rproc_start, NULL);
+}
+
+static void *do_rproc_stop(void *unused)
+{
+	ssize_t ret;
+
+	ret = pwrite(rproc_state_fd, "stop", 4, 0);
+	if (ret < 4) {
+		fprintf(stderr, "failed to update stop state: %s\n",
+			strerror(errno));
+	}
+
+	ret = write(rproc_pipe[1], "Y", 1);
+	if (ret != 1) {
+		fprintf(stderr, "failed to signal event loop about exit\n");
+		exit(0);
+	}
+
+	return NULL;
+}
+
+int rproc_stop(void)
+{
+	pthread_attr_t attr;
+
+	pthread_attr_init(&attr);
+	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+
+	return pthread_create(&stop_thread, &attr, do_rproc_stop, NULL);
+}
diff --git a/shared/vendor/rmtfs/sharedmem.c b/shared/vendor/rmtfs/sharedmem.c
new file mode 100644
index 0000000..d8b5ecd
--- /dev/null
+++ b/shared/vendor/rmtfs/sharedmem.c
@@ -0,0 +1,468 @@
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#ifndef ANDROID
+#include <libudev.h>
+#else
+#include <sys/endian.h>
+#endif
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <string.h>
+#include <unistd.h>
+#include "rmtfs.h"
+
+static int rmtfs_mem_enumerate(struct rmtfs_mem *rmem);
+
+struct rmtfs_mem {
+	uint64_t address;
+	uint64_t size;
+	void *base;
+	int fd;
+};
+
+#ifndef ANDROID
+
+static int parse_hex_sysattr(struct udev_device *dev, const char *name,
+			     uint64_t *value)
+{
+	unsigned long long val;
+	const char *buf;
+	char *endptr;
+
+	buf = udev_device_get_sysattr_value(dev, name);
+	if (!buf)
+		return -ENOENT;
+
+	errno = 0;
+	val = strtoull(buf, &endptr, 16);
+	if ((val == ULLONG_MAX && errno == ERANGE) || endptr == buf) {
+		return -errno;
+	}
+
+	*value = val;
+
+	return 0;
+}
+
+static int rmtfs_mem_open_rfsa(struct rmtfs_mem *rmem, int client_id)
+{
+	struct udev_device *dev;
+	struct udev *udev;
+	int saved_errno;
+	struct stat sb;
+	char path[32];
+	int ret;
+	int fd;
+
+	sprintf(path, "/dev/qcom_rmtfs_mem%d", client_id);
+
+	fd = open(path, O_RDWR);
+	if (fd < 0) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to open %s: %s\n", path, strerror(errno));
+		return -saved_errno;
+	}
+	rmem->fd = fd;
+
+	ret = fstat(fd, &sb);
+	if (ret < 0) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to stat %s: %s\n", path, strerror(errno));
+		close(fd);
+		goto err_close_fd;
+	}
+
+	udev = udev_new();
+	if (!udev) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to create udev context\n");
+		goto err_close_fd;
+	}
+
+	dev = udev_device_new_from_devnum(udev, 'c', sb.st_rdev);
+	if (!dev) {
+		saved_errno = errno;
+		fprintf(stderr, "unable to find udev device\n");
+		goto err_unref_udev;
+	}
+
+	ret = parse_hex_sysattr(dev, "phys_addr", &rmem->address);
+	if (ret < 0) {
+		fprintf(stderr, "failed to parse phys_addr of %s\n", path);
+		saved_errno = -ret;
+		goto err_unref_dev;
+	}
+
+	ret = parse_hex_sysattr(dev, "size", &rmem->size);
+	if (ret < 0) {
+		fprintf(stderr, "failed to parse size of %s\n", path);
+		saved_errno = -ret;
+		goto err_unref_dev;
+	}
+
+	udev_device_unref(dev);
+	udev_unref(udev);
+
+	return 0;
+
+err_unref_dev:
+	udev_device_unref(dev);
+err_unref_udev:
+	udev_unref(udev);
+err_close_fd:
+	close(fd);
+	return -saved_errno;
+}
+
+static int rmtfs_mem_open_uio(struct rmtfs_mem *rmem, int client_id)
+{
+	struct udev_device *dev;
+	struct udev *udev;
+	int saved_errno;
+	struct stat sb;
+	char path[32];
+	int ret;
+	int fd;
+
+	snprintf(path, sizeof(path), "/dev/qcom_rmtfs_uio%d", client_id);
+
+	fd = open(path, O_RDWR);
+	if (fd < 0) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to open %s: %s\n", path, strerror(errno));
+		return -saved_errno;
+	}
+	rmem->fd = fd;
+
+	ret = fstat(fd, &sb);
+	if (ret < 0) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to stat %s: %s\n", path, strerror(errno));
+		close(fd);
+		goto err_close_fd;
+	}
+
+	udev = udev_new();
+	if (!udev) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to create udev context\n");
+		goto err_close_fd;
+	}
+
+	dev = udev_device_new_from_devnum(udev, 'c', sb.st_rdev);
+	if (!dev) {
+		saved_errno = errno;
+		fprintf(stderr, "unable to find udev device\n");
+		goto err_unref_udev;
+	}
+
+	ret = parse_hex_sysattr(dev, "maps/map0/addr", &rmem->address);
+	if (ret < 0) {
+		fprintf(stderr, "failed to parse phys_addr of %s\n", path);
+		saved_errno = -ret;
+		goto err_unref_dev;
+	}
+
+	ret = parse_hex_sysattr(dev, "maps/map0/size", &rmem->size);
+	if (ret < 0) {
+		fprintf(stderr, "failed to parse size of %s\n", path);
+		saved_errno = -ret;
+		goto err_unref_dev;
+	}
+
+	rmem->base = mmap(0, rmem->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+	if (rmem->base == MAP_FAILED) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to mmap: %s\n", strerror(errno));
+		goto err_unref_dev;
+	}
+
+	udev_device_unref(dev);
+	udev_unref(udev);
+
+	return 0;
+
+err_unref_dev:
+	udev_device_unref(dev);
+err_unref_udev:
+	udev_unref(udev);
+err_close_fd:
+	close(fd);
+	return -saved_errno;
+}
+
+#else
+
+#define PAGE_SIZE 4096
+
+static int rmtfs_mem_open_rfsa(struct rmtfs_mem *rmem, int client_id)
+{
+	int saved_errno;
+	int fd;
+	char path[PATH_MAX];
+	char val[PAGE_SIZE];
+	char *endptr;
+
+	errno = 0;
+
+	snprintf(path, sizeof(path), "/dev/qcom_rmtfs_mem%d", client_id);
+	rmem->fd = open(path, O_RDWR);
+	if (rmem->fd < 0) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to open %s: %s\n", path, strerror(errno));
+		return -saved_errno;
+	}
+
+	snprintf(path, sizeof(path), "/sys/class/rmtfs/qcom_rmtfs_mem%d/phys_addr", client_id);
+	fd = open(path, O_RDONLY);
+	if (fd < 0) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to open %s: %s\n", path, strerror(errno));
+		return -saved_errno;
+	}
+	read(fd, val, sizeof(val));
+	rmem->address = strtoull(val, &endptr, 16);
+	if ((rmem->address == ULLONG_MAX && errno == ERANGE) || endptr == val) {
+		saved_errno = errno;
+		goto err_close_fd;
+	}
+	close(fd);
+
+	snprintf(path, sizeof(path), "/sys/class/rmtfs/qcom_rmtfs_mem%d/size", client_id);
+	fd = open(path, O_RDONLY);
+	if (fd < 0) {
+		saved_errno = errno;
+		fprintf(stderr, "failed to open %s: %s\n", path, strerror(errno));
+		return -saved_errno;
+	}
+	read(fd, val, sizeof(val));
+	rmem->size = strtoull(val, &endptr, 16);
+	if ((rmem->size == ULLONG_MAX && errno == ERANGE) || endptr == val) {
+		saved_errno = errno;
+		goto err_close_fd;
+	}
+	close(fd);
+
+	return 0;
+
+err_close_fd:
+	close(fd);
+	return -saved_errno;
+}
+
+static int rmtfs_mem_open_uio(struct rmtfs_mem *rmem, int client_id)
+{
+	fprintf(stderr, "uio access is not supported on ANDROID yet\n");
+	return -EINVAL;
+}
+
+#endif
+
+struct rmtfs_mem *rmtfs_mem_open(void)
+{
+	struct rmtfs_mem *rmem;
+	void *base;
+	int ret;
+	int fd;
+
+	rmem = malloc(sizeof(*rmem));
+	if (!rmem)
+		return NULL;
+
+	memset(rmem, 0, sizeof(*rmem));
+
+	ret = rmtfs_mem_open_rfsa(rmem, 1);
+	if (ret < 0 && ret != -ENOENT) {
+		goto err;
+	} else if (ret < 0) {
+		fprintf(stderr, "falling back to uio access\n");
+		ret = rmtfs_mem_open_uio(rmem, 1);
+		if (ret < 0 && ret != -ENOENT) {
+			goto err;
+		} else if (ret < 0) {
+			fprintf(stderr, "falling back to /dev/mem access\n");
+
+			ret = rmtfs_mem_enumerate(rmem);
+			if (ret < 0)
+				goto err;
+
+			fd = open("/dev/mem", O_RDWR|O_SYNC);
+			if (fd < 0) {
+				fprintf(stderr, "failed to open /dev/mem\n");
+				goto err;
+			}
+
+			base = mmap(0, rmem->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, rmem->address);
+			if (base == MAP_FAILED) {
+				fprintf(stderr, "failed to mmap: %s\n", strerror(errno));
+				goto err_close_fd;
+			}
+
+			rmem->base = base;
+			rmem->fd = fd;
+		}
+	}
+
+	return rmem;
+
+err_close_fd:
+	close(fd);
+err:
+	free(rmem);
+	return NULL;
+}
+
+int64_t rmtfs_mem_alloc(struct rmtfs_mem *rmem, size_t alloc_size)
+{
+	if (alloc_size > rmem->size) {
+		fprintf(stderr,
+			"[RMTFS] rmtfs shared memory not large enough for allocation request 0x%zx vs 0x%lx\n",
+			alloc_size, rmem->size);
+		return -EINVAL;
+	}
+
+	return rmem->address;
+}
+
+void rmtfs_mem_free(struct rmtfs_mem *rmem)
+{
+}
+
+static void *rmtfs_mem_ptr(struct rmtfs_mem *rmem, unsigned long phys_address, ssize_t len)
+{
+	uint64_t start;
+	uint64_t end;
+
+	if (len < 0)
+		return NULL;
+
+	start = phys_address;
+	end = start + len;
+
+	if (start < rmem->address || end > rmem->address + rmem->size)
+		return NULL;
+
+	return (char*)rmem->base + phys_address - rmem->address;
+}
+
+ssize_t rmtfs_mem_read(struct rmtfs_mem *rmem, unsigned long phys_address, void *buf, ssize_t len)
+{
+	off_t offset;
+	void *ptr;
+
+	if (rmem->base) {
+		ptr = rmtfs_mem_ptr(rmem, phys_address, len);
+		if (!ptr)
+			return -EINVAL;
+
+		memcpy(buf, ptr, len);
+	} else {
+		offset = phys_address - rmem->address;
+		len = pread(rmem->fd, buf, len, offset);
+	}
+
+	return len;
+}
+
+ssize_t rmtfs_mem_write(struct rmtfs_mem *rmem, unsigned long phys_address, const void *buf, ssize_t len)
+{
+	off_t offset;
+	void *ptr;
+
+	if (rmem->base) {
+		ptr = rmtfs_mem_ptr(rmem, phys_address, len);
+		if (!ptr)
+			return -EINVAL;
+
+		memcpy(ptr, buf, len);
+	} else {
+		offset = phys_address - rmem->address;
+		len = pwrite(rmem->fd, buf, len, offset);
+	}
+
+	return len;
+}
+
+void rmtfs_mem_close(struct rmtfs_mem *rmem)
+{
+	if (rmem->base)
+		munmap(rmem->base, rmem->size);
+
+	close(rmem->fd);
+
+	free(rmem);
+}
+
+static int rmtfs_mem_enumerate(struct rmtfs_mem *rmem)
+{
+	union {
+		uint32_t dw[2];
+		uint64_t qw[2];
+	} reg;
+	struct dirent *de;
+	int basefd;
+	int dirfd;
+	int regfd;
+	DIR *dir;
+	int ret = 0;
+	int n;
+
+	basefd = open("/proc/device-tree/reserved-memory/", O_DIRECTORY);
+	dir = fdopendir(basefd);
+	if (!dir) {
+		fprintf(stderr,
+			"Unable to open reserved-memory device tree node: %s\n",
+			strerror(-errno));
+		close(basefd);
+		return -1;
+	}
+
+	while ((de = readdir(dir)) != NULL) {
+		if (strncmp(de->d_name, "rmtfs", 5) != 0)
+			continue;
+
+		dirfd = openat(basefd, de->d_name, O_DIRECTORY);
+		if (dirfd < 0) {
+			fprintf(stderr, "failed to open %s: %s\n",
+				de->d_name, strerror(-errno));
+			ret = -1;
+			goto out;
+		}
+
+		regfd = openat(dirfd, "reg", O_RDONLY);
+		if (regfd < 0) {
+			fprintf(stderr, "failed to open reg of %s: %s\n",
+				de->d_name, strerror(-errno));
+			ret = -1;
+			goto out;
+		}
+
+		n = read(regfd, &reg, sizeof(reg));
+		if (n == 2 * sizeof(uint32_t)) {
+			rmem->address = be32toh(reg.dw[0]);
+			rmem->size = be32toh(reg.dw[1]);
+		} else if (n == 2 * sizeof(uint64_t)) {
+			rmem->address = be64toh(reg.qw[0]);
+			rmem->size = be64toh(reg.qw[1]);
+		} else {
+			fprintf(stderr, "failed to read reg of %s: %s\n",
+				de->d_name, strerror(-errno));
+			ret = -1;
+		}
+
+		close(regfd);
+		close(dirfd);
+		break;
+	}
+
+out:
+	closedir(dir);
+	close(basefd);
+	return ret;
+}
diff --git a/shared/vendor/rmtfs/storage.c b/shared/vendor/rmtfs/storage.c
new file mode 100644
index 0000000..107b296
--- /dev/null
+++ b/shared/vendor/rmtfs/storage.c
@@ -0,0 +1,297 @@
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include "rmtfs.h"
+
+#define MAX_CALLERS 10
+#define STORAGE_MAX_SIZE (16 * 1024 * 1024)
+
+#define BY_PARTLABEL_PATH "/dev/disk/by-partlabel"
+
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+
+struct partition {
+	const char *path;
+	const char *actual;
+	const char *partlabel;
+};
+
+struct rmtfd {
+	unsigned id;
+	unsigned node;
+	int fd;
+	unsigned dev_error;
+	const struct partition *partition;
+
+	void *shadow_buf;
+	size_t shadow_len;
+};
+
+static const char *storage_dir = "/boot";
+static int storage_read_only;
+static int storage_use_partitions;
+
+static const struct partition partition_table[] = {
+	{ "/boot/modem_fs1", "modem_fs1", "modemst1" },
+	{ "/boot/modem_fs2", "modem_fs2", "modemst2" },
+	{ "/boot/modem_fsc", "modem_fsc", "fsc" },
+	{ "/boot/modem_fsg", "modem_fsg", "fsg" },
+	{ "/boot/modem_tunning", "modem_tunning", "tunning" },
+	{}
+};
+
+static struct rmtfd rmtfds[MAX_CALLERS];
+
+static int storage_populate_shadow_buf(struct rmtfd *rmtfd, const char *file);
+
+int storage_init(const char *storage_root, bool read_only, bool use_partitions)
+{
+	int i;
+
+	if (storage_root)
+		storage_dir = storage_root;
+
+	if (use_partitions) {
+		if (!storage_root)
+			storage_dir = BY_PARTLABEL_PATH;
+		storage_use_partitions = true;
+	}
+
+	storage_read_only = read_only;
+
+	for (i = 0; i < MAX_CALLERS; i++) {
+		rmtfds[i].id = i;
+		rmtfds[i].fd = -1;
+		rmtfds[i].shadow_buf = NULL;
+	}
+
+	return 0;
+}
+
+struct rmtfd *storage_open(unsigned node, const char *path)
+{
+	char *fspath;
+	const struct partition *part;
+	struct rmtfd *rmtfd = NULL;
+	const char *file;
+	size_t pathlen;
+	int saved_errno;
+	int ret;
+	int fd;
+	int i;
+
+	for (part = partition_table; part->path; part++) {
+		if (strcmp(part->path, path) == 0)
+			goto found;
+	}
+
+	fprintf(stderr, "[RMTFS storage] request for unknown partition '%s', rejecting\n", path);
+	return NULL;
+
+found:
+	/* Check if this node already has the requested path open */
+	for (i = 0; i < MAX_CALLERS; i++) {
+		if ((rmtfds[i].fd != -1 || rmtfds[i].shadow_buf) &&
+		    rmtfds[i].node == node &&
+		    rmtfds[i].partition == part)
+			return &rmtfds[i];
+	}
+
+	for (i = 0; i < MAX_CALLERS; i++) {
+		if (rmtfds[i].fd == -1 && !rmtfds[i].shadow_buf) {
+			rmtfd = &rmtfds[i];
+			break;
+		}
+	}
+	if (!rmtfd) {
+		fprintf(stderr, "[storage] out of free rmtfd handles\n");
+		return NULL;
+	}
+
+	if (storage_use_partitions)
+		file = part->partlabel;
+	else
+		file = part->actual;
+
+	pathlen = strlen(storage_dir) + strlen(file) + 2;
+	fspath = alloca(pathlen);
+	snprintf(fspath, pathlen, "%s/%s", storage_dir, file);
+	if (!storage_read_only) {
+		fd = open(fspath, O_RDWR);
+		if (fd < 0) {
+			saved_errno = errno;
+			fprintf(stderr, "[storage] failed to open '%s' (requested '%s'): %s\n",
+					fspath, part->path, strerror(saved_errno));
+			errno = saved_errno;
+			return NULL;
+		}
+		rmtfd->fd = fd;
+		rmtfd->shadow_len = 0;
+	} else {
+		ret = storage_populate_shadow_buf(rmtfd, fspath);
+		if (ret < 0) {
+			saved_errno = errno;
+			fprintf(stderr, "[storage] failed to open '%s' (requested '%s'): %s\n",
+					fspath, part->path, strerror(saved_errno));
+			errno = saved_errno;
+			return NULL;
+		}
+	}
+
+	rmtfd->node = node;
+	rmtfd->partition = part;
+
+	return rmtfd;
+}
+
+void storage_close(struct rmtfd *rmtfd)
+{
+	if (rmtfd->fd >= 0) {
+		close(rmtfd->fd);
+		rmtfd->fd = -1;
+	}
+
+	free(rmtfd->shadow_buf);
+	rmtfd->shadow_buf = NULL;
+	rmtfd->shadow_len = 0;
+
+	rmtfd->partition = NULL;
+}
+
+struct rmtfd *storage_get(unsigned node, int caller_id)
+{
+	struct rmtfd *rmtfd;
+
+	if (caller_id >= MAX_CALLERS)
+		return NULL;
+
+	rmtfd = &rmtfds[caller_id];
+	if (rmtfd->node != node)
+		return NULL;
+
+	return rmtfd;
+}
+
+int storage_get_caller_id(const struct rmtfd *rmtfd)
+{
+	return rmtfd->id;
+}
+
+int storage_get_error(const struct rmtfd *rmtfd)
+{
+	return rmtfd->dev_error;
+}
+
+void storage_exit(void)
+{
+	int i;
+
+	for (i = 0; i < MAX_CALLERS; i++)
+		storage_close(&rmtfds[i]);
+}
+
+ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t offset)
+{
+	ssize_t n;
+
+	if (!storage_read_only) {
+		n = pread(rmtfd->fd, buf, nbyte, offset);
+	} else {
+		n = MIN((ssize_t)nbyte, (ssize_t)rmtfd->shadow_len - offset);
+		if (n > 0)
+			memcpy(buf, (char*)rmtfd->shadow_buf + offset, n);
+		else
+			n = 0;
+	}
+
+	if (n < nbyte)
+		memset((char*)buf + n, 0, nbyte - n);
+
+	return nbyte;
+}
+
+ssize_t storage_pwrite(struct rmtfd *rmtfd, const void *buf, size_t nbyte, off_t offset)
+{
+	size_t new_len = offset + nbyte;
+	void *new_buf;
+
+	if (!storage_read_only)
+		return pwrite(rmtfd->fd, buf, nbyte, offset);
+
+	if (new_len >= STORAGE_MAX_SIZE) {
+		fprintf(stderr, "write to %zd bytes exceededs max size\n", new_len);
+		errno = -EINVAL;
+		return -1;
+	}
+
+	if (new_len > rmtfd->shadow_len) {
+		new_buf = realloc(rmtfd->shadow_buf, new_len);
+		if (!new_buf) {
+			errno = -ENOMEM;
+			return -1;
+		}
+
+		rmtfd->shadow_buf = new_buf;
+		rmtfd->shadow_len = new_len;
+	}
+
+	memcpy((char*)rmtfd->shadow_buf + offset, buf, nbyte);
+
+	return nbyte;
+}
+
+int storage_sync(struct rmtfd *rmtfd)
+{
+	if (storage_read_only)
+		return 0;
+	
+	return fdatasync(rmtfd->fd);
+}
+
+static int storage_populate_shadow_buf(struct rmtfd *rmtfd, const char *file)
+{
+	ssize_t len;
+	ssize_t n;
+	void *buf;
+	int ret;
+	int fd;
+
+	fd = open(file, O_RDONLY);
+	if (fd < 0)
+		return -1;
+
+	len = lseek(fd, 0, SEEK_END);
+	if (len < 0) {
+		ret = -1;
+		goto err_close_fd;
+	}
+
+	lseek(fd, 0, SEEK_SET);
+
+	buf = calloc(1, len);
+	if (!buf) {
+		ret = -1;
+		goto err_close_fd;
+	}
+
+	n = read(fd, buf, len);
+	if (n < 0) {
+		ret = -1;
+		goto err_close_fd;
+	}
+
+	rmtfd->shadow_buf = buf;
+	rmtfd->shadow_len = n;
+
+	ret = 0;
+
+err_close_fd:
+	close(fd);
+
+	return ret;
+}
diff --git a/shared/vendor/rmtfs/util.c b/shared/vendor/rmtfs/util.c
new file mode 100644
index 0000000..5ca5bba
--- /dev/null
+++ b/shared/vendor/rmtfs/util.c
@@ -0,0 +1,48 @@
+#include <ctype.h>
+#include <stdint.h>
+#include <stdio.h>
+#include "util.h"
+
+static uint8_t to_hex(uint8_t ch)
+{
+	ch &= 0xf;
+	return ch <= 9 ? '0' + ch : 'a' + ch - 10;
+}
+
+void print_hex_dump(const char *prefix, const void *buf, size_t len)
+{
+	const uint8_t *ptr = buf;
+	size_t linelen;
+	uint8_t ch;
+	char line[16 * 3 + 16 + 1];
+	int li;
+	int i;
+	int j;
+
+	for (i = 0; i < len; i += 16) {
+		linelen = MIN(16, len - i);
+		li = 0;
+
+		for (j = 0; j < linelen; j++) {
+			ch = ptr[i + j];
+			line[li++] = to_hex(ch >> 4);
+			line[li++] = to_hex(ch);
+			line[li++] = ' ';
+		}
+
+		for (; j < 16; j++) {
+			line[li++] = ' ';
+			line[li++] = ' ';
+			line[li++] = ' ';
+		}
+
+		for (j = 0; j < linelen; j++) {
+			ch = ptr[i + j];
+			line[li++] = isprint(ch) ? ch : '.';
+		}
+
+		line[li] = '\0';
+
+		printf("%s %04x: %s\n", prefix, i, line);
+	}
+}
diff --git a/shared/vendor/rmtfs/util.h b/shared/vendor/rmtfs/util.h
new file mode 100644
index 0000000..3a9ec3e
--- /dev/null
+++ b/shared/vendor/rmtfs/util.h
@@ -0,0 +1,9 @@
+#ifndef __UTIL_H__
+#define __UTIL_H__
+
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+void print_hex_dump(const char *prefix, const void *buf, size_t len);
+
+#endif
diff --git a/shared/vendor/tqftpserv/Android.bp b/shared/vendor/tqftpserv/Android.bp
new file mode 100644
index 0000000..b2c5090
--- /dev/null
+++ b/shared/vendor/tqftpserv/Android.bp
@@ -0,0 +1,9 @@
+cc_binary {
+    name: "tqftpserv",
+    vendor: true,
+    srcs: [
+        "tqftpserv.c",
+        "translate.c",
+    ],
+    shared_libs: ["libqrtr"],
+}
diff --git a/shared/vendor/tqftpserv/LICENSE b/shared/vendor/tqftpserv/LICENSE
new file mode 100644
index 0000000..cd92517
--- /dev/null
+++ b/shared/vendor/tqftpserv/LICENSE
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2018, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
diff --git a/shared/vendor/tqftpserv/Makefile b/shared/vendor/tqftpserv/Makefile
new file mode 100644
index 0000000..60ad687
--- /dev/null
+++ b/shared/vendor/tqftpserv/Makefile
@@ -0,0 +1,25 @@
+TQFTPSERV := tqftpserv
+
+CFLAGS := -Wall -g -O2
+LDFLAGS := -lqrtr
+
+prefix ?= /usr/local
+bindir := $(prefix)/bin
+servicedir := $(prefix)/lib/systemd/system
+
+SRCS := tqftpserv.c translate.c
+
+OBJS := $(SRCS:.c=.o)
+
+$(TQFTPSERV): $(OBJS)
+	$(CC) -o $@ $^ $(LDFLAGS)
+
+tqftpserv.service: tqftpserv.service.in
+	@sed 's+TQFTPSERV_PATH+$(bindir)+g' $< > $@
+
+install: $(TQFTPSERV) tqftpserv.service
+	@install -D -m 755 $(TQFTPSERV) $(DESTDIR)$(bindir)/$(TQFTPSERV)
+	@install -D -m 644 tqftpserv.service $(DESTDIR)$(servicedir)/tqftpserv.service
+
+clean:
+	rm -f $(TQFTPSERV) $(OBJS) tqftpserv.service
diff --git a/shared/vendor/tqftpserv/list.h b/shared/vendor/tqftpserv/list.h
new file mode 100644
index 0000000..c3488e3
--- /dev/null
+++ b/shared/vendor/tqftpserv/list.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2016, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef __LIST_H__
+#define __LIST_H__
+
+#include <stdbool.h>
+#include <stddef.h>
+
+#ifndef container_of
+#define container_of(ptr, type, member) ({ \
+		const typeof(((type *)0)->member)*__mptr = (ptr);  \
+		(type *)((char *)__mptr - offsetof(type, member)); \
+		})
+#endif
+
+struct list_head {
+	struct list_head *prev;
+	struct list_head *next;
+};
+
+#define LIST_INIT(list) { &(list), &(list) }
+
+static inline void list_init(struct list_head *list)
+{
+	list->prev = list->next = list;
+}
+
+static inline bool list_empty(struct list_head *list)
+{
+	return list->next == list;
+}
+
+static inline void list_add(struct list_head *list, struct list_head *item)
+{
+	struct list_head *prev = list->prev;
+
+	item->next = list;
+	item->prev = prev;
+
+	prev->next = list->prev = item;
+}
+
+static inline void list_del(struct list_head *item)
+{
+	item->prev->next = item->next;
+	item->next->prev = item->prev;
+}
+
+#define list_for_each(item, list) \
+	for (item = (list)->next; item != list; item = item->next)
+
+#define list_for_each_safe(item, next, list) \
+	for (item = (list)->next, next = item->next; item != list; item = next, next = item->next)
+
+#define list_entry(item, type, member) \
+	container_of(item, type, member)
+
+#define list_entry_first(list, type, member) \
+	container_of((list)->next, type, member)
+
+#define list_entry_next(item, member) \
+	container_of((item)->member.next, typeof(*(item)), member)
+
+#define list_for_each_entry(item, list, member) \
+	for (item = list_entry_first(list, typeof(*(item)), member); \
+	     &item->member != list; \
+	     item = list_entry_next(item, member))
+
+#define list_for_each_entry_safe(item, next, list, member) \
+	for (item = list_entry_first(list, typeof(*(item)), member), \
+	     next = list_entry_next(item, member); \
+	     &item->member != list; \
+	     item = next, \
+	     next = list_entry_next(item, member)) \
+
+#endif
diff --git a/shared/vendor/tqftpserv/tqftpserv.c b/shared/vendor/tqftpserv/tqftpserv.c
new file mode 100644
index 0000000..fa6e3c9
--- /dev/null
+++ b/shared/vendor/tqftpserv/tqftpserv.c
@@ -0,0 +1,609 @@
+/*
+ * Copyright (c) 2018, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <arpa/inet.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <libqrtr.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "list.h"
+#include "translate.h"
+
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+enum {
+	OP_RRQ = 1,
+	OP_WRQ,
+	OP_DATA,
+	OP_ACK,
+	OP_ERROR,
+	OP_OACK,
+};
+
+struct tftp_client {
+	struct list_head node;
+
+	struct sockaddr_qrtr sq;
+
+	int sock;
+	int fd;
+
+	size_t block;
+
+	size_t blksize;
+	size_t rsize;
+	size_t wsize;
+	unsigned int timeoutms;
+};
+
+static struct list_head readers = LIST_INIT(readers);
+static struct list_head writers = LIST_INIT(writers);
+
+static ssize_t tftp_send_data(struct tftp_client *client,
+			      unsigned int block, size_t offset)
+{
+	ssize_t len;
+	char *buf;
+	char *p;
+
+	buf = malloc(4 + client->blksize);
+	p = buf;
+
+	*p++ = 0;
+	*p++ = OP_DATA;
+
+	*p++ = (block >> 8) & 0xff;
+	*p++ = block & 0xff;
+
+	len = pread(client->fd, p, client->blksize, offset);
+	if (len <= 0) {
+		if (len < 0)
+			printf("[TQFTP] failed to read data\n");
+		free(buf);
+		return len;
+	}
+
+	p += len;
+
+	// printf("[TQFTP] Sending %zd bytes of DATA\n", p - buf);
+	len = send(client->sock, buf, p - buf, 0);
+
+	free(buf);
+
+	return len;
+}
+
+
+static int tftp_send_ack(int sock, int block)
+{
+	struct {
+		uint16_t opcode;
+		uint16_t block;
+	} ack = { htons(OP_ACK), htons(block) };
+
+	return send(sock, &ack, sizeof(ack), 0);
+}
+
+static int tftp_send_oack(int sock, size_t *blocksize, size_t *tsize,
+			  size_t *wsize, unsigned int *timeoutms, size_t *rsize)
+{
+	char buf[512];
+	char *p = buf;
+	int n;
+
+	*p++ = 0;
+	*p++ = OP_OACK;
+
+	if (blocksize) {
+		strcpy(p, "blksize");
+		p += 8;
+
+		n = sprintf(p, "%zd", *blocksize);
+		p += n;
+		*p++ = '\0';
+	}
+
+	if (timeoutms) {
+		strcpy(p, "timeoutms");
+		p += 10;
+
+		n = sprintf(p, "%d", *timeoutms);
+		p += n;
+		*p++ = '\0';
+	}
+
+	if (tsize && *tsize != -1) {
+		strcpy(p, "tsize");
+		p += 6;
+
+		n = sprintf(p, "%zd", *tsize);
+		p += n;
+		*p++ = '\0';
+	}
+
+	if (wsize) {
+		strcpy(p, "wsize");
+		p += 6;
+
+		n = sprintf(p, "%zd", *wsize);
+		p += n;
+		*p++ = '\0';
+	}
+
+	if (rsize) {
+		strcpy(p, "rsize");
+		p += 6;
+
+		n = sprintf(p, "%zd", *rsize);
+		p += n;
+		*p++ = '\0';
+	}
+
+	return send(sock, buf, p - buf, 0);
+}
+
+static int tftp_send_error(int sock, int code, const char *msg)
+{
+	size_t len;
+	char *buf;
+	int rc;
+
+	len = 4 + strlen(msg) + 1;
+
+	buf = calloc(1, len);
+	if (!buf)
+		return -1;
+
+	*(uint16_t*)buf = htons(OP_ERROR);
+	*(uint16_t*)(buf + 2) = htons(code);
+	strcpy(buf + 4, msg);
+
+	rc = send(sock, buf, len, 0);
+	free(buf);
+	return rc;
+}
+
+static void handle_rrq(const char *buf, size_t len, struct sockaddr_qrtr *sq)
+{
+	struct tftp_client *client;
+	const char *filename;
+	const char *value;
+	const char *mode;
+	const char *opt;
+	struct stat sb;
+	const char *p;
+	ssize_t tsize = -1;
+	size_t blksize = 512;
+	unsigned int timeoutms = 1000;
+	size_t rsize = 0;
+	size_t wsize = 0;
+	bool do_oack = false;
+	int sock;
+	int ret;
+	int fd;
+
+	p = buf + 2;
+
+	filename = p;
+	p += strlen(p) + 1;
+
+	mode = p;
+	p += strlen(p) + 1;
+
+	if (strcasecmp(mode, "octet")) {
+		/* XXX: error */
+		printf("[TQFTP] not octet, reject\n");
+		return;
+	}
+
+	printf("[TQFTP] RRQ: %s (%s)\n", filename, mode);
+
+	if (p < buf + len) {
+		do_oack = true;
+
+		while (p < buf + len) {
+			/* XXX: ensure we're not running off the end */
+			opt = p;
+			p += strlen(p) + 1;
+
+			/* XXX: ensure we're not running off the end */
+			value = p;
+			p += strlen(p) + 1;
+
+			if (!strcmp(opt, "blksize")) {
+				blksize = atoi(value);
+			} else if (!strcmp(opt, "timeoutms")) {
+				timeoutms = atoi(value);
+			} else if (!strcmp(opt, "tsize")) {
+				tsize = atoi(value);
+			} else if (!strcmp(opt, "rsize")) {
+				rsize = atoi(value);
+			} else if (!strcmp(opt, "wsize")) {
+				wsize = atoi(value);
+			} else {
+				printf("[TQFTP] Ignoring unknown option '%s'\n", opt);
+			}
+		}
+	}
+
+	sock = qrtr_open(0);
+	if (sock < 0) {
+		/* XXX: error */
+		printf("[TQFTP] unable to create new qrtr socket, reject\n");
+		return;
+	}
+
+	ret = connect(sock, (struct sockaddr *)sq, sizeof(*sq));
+	if (ret < 0) {
+		/* XXX: error */
+		printf("[TQFTP] unable to connect new qrtr socket to remote\n");
+		return;
+	}
+
+	fd = translate_open(filename, O_RDONLY);
+	if (fd < 0) {
+		printf("[TQFTP] unable to open %s (%d), reject\n", filename, errno);
+		tftp_send_error(sock, 1, "file not found");
+		return;
+	}
+
+	if (tsize != -1) {
+		fstat(fd, &sb);
+		tsize = sb.st_size;
+	}
+
+	client = calloc(1, sizeof(*client));
+	client->sq = *sq;
+	client->sock = sock;
+	client->fd = fd;
+	client->blksize = blksize;
+	client->rsize = rsize;
+	client->wsize = wsize;
+	client->timeoutms = timeoutms;
+
+	// printf("[TQFTP] new reader added\n");
+
+	list_add(&readers, &client->node);
+
+	if (do_oack) {
+		tftp_send_oack(client->sock, &blksize,
+			       tsize ? (size_t*)&tsize : NULL,
+			       wsize ? &wsize : NULL,
+			       &client->timeoutms,
+			       rsize ? &rsize: NULL);
+	} else {
+		tftp_send_data(client, 1, 0);
+	}
+}
+
+static void handle_wrq(const char *buf, size_t len __unused, struct sockaddr_qrtr *sq)
+{
+	struct tftp_client *client;
+	const char *filename;
+	const char *mode;
+	int sock;
+	int ret;
+	int fd;
+
+	filename = buf + 2;
+	mode = buf + 2 + strlen(filename) + 1;
+
+	if (strcasecmp(mode, "octet")) {
+		/* XXX: error */
+		printf("[TQFTP] not octet, reject\n");
+		return;
+	}
+
+	printf("[TQFTP] WRQ: %s (%s)\n", filename, mode);
+
+	fd = translate_open(filename, O_WRONLY | O_CREAT);
+	if (fd < 0) {
+		/* XXX: error */
+		printf("[TQFTP] unable to open %s (%d), reject\n", filename, errno);
+		return;
+	}
+
+	sock = qrtr_open(0);
+	if (sock < 0) {
+		/* XXX: error */
+		printf("[TQFTP] unable to create new qrtr socket, reject\n");
+		return;
+	}
+
+	ret = connect(sock, (struct sockaddr *)sq, sizeof(*sq));
+	if (ret < 0) {
+		/* XXX: error */
+		printf("[TQFTP] unable to connect new qrtr socket to remote\n");
+		return;
+	}
+
+	client = calloc(1, sizeof(*client));
+	client->sq = *sq;
+	client->sock = sock;
+	client->fd = fd;
+
+	ret = tftp_send_ack(client->sock, 0);
+	if (ret < 0) {
+		printf("[TQFTP] unable to send ack\n");
+		close(sock);
+		close(fd);
+		free(client);
+		return;
+	}
+
+	// printf("[TQFTP] new writer added\n");
+
+	list_add(&writers, &client->node);
+}
+
+static int handle_reader(struct tftp_client *client)
+{
+	struct sockaddr_qrtr sq;
+	uint16_t block;
+	uint16_t last;
+	char buf[128];
+	socklen_t sl;
+	ssize_t len;
+	ssize_t n = 0;
+	int opcode;
+	int ret;
+
+	sl = sizeof(sq);
+	len = recvfrom(client->sock, buf, sizeof(buf), 0, (void *)&sq, &sl);
+	if (len < 0) {
+		ret = -errno;
+		if (ret != -ENETRESET)
+			fprintf(stderr, "[TQFTP] recvfrom failed: %d\n", ret);
+		return -1;
+	}
+
+	/* Drop unsolicited messages */
+	if (sq.sq_node != client->sq.sq_node ||
+	    sq.sq_port != client->sq.sq_port) {
+		printf("[TQFTP] Discarding spoofed message\n");
+		return -1;
+	}
+
+	opcode = buf[0] << 8 | buf[1];
+	if (opcode == OP_ERROR) {
+		buf[len] = '\0';
+		printf("[TQFTP] Remote returned an error: %s\n", buf + 4);
+		return -1;
+	} else if (opcode != OP_ACK) {
+		printf("[TQFTP] Expected ACK, got %d\n", opcode);
+		return -1;
+	}
+
+	last = buf[2] << 8 | buf[3];
+	// printf("[TQFTP] Got ack for %d\n", last);
+
+	for (block = last; block < last + client->wsize; block++) {
+		n = tftp_send_data(client, block + 1,
+				   block * client->blksize);
+		if (n < 0) {
+			printf("[TQFTP] Sent block %d failed: %zd\n", block + 1, n);
+			break;
+		}
+		// printf("[TQFTP] Sent block %d of %zd\n", block + 1, n);
+		if (n == 0)
+			break;
+	}
+
+	return 1;
+}
+
+static int handle_writer(struct tftp_client *client)
+{
+	struct sockaddr_qrtr sq;
+	uint16_t block;
+	size_t payload;
+	char buf[516];
+	socklen_t sl;
+	ssize_t len;
+	int opcode;
+	int ret;
+
+	sl = sizeof(sq);
+	len = recvfrom(client->sock, buf, sizeof(buf), 0, (void *)&sq, &sl);
+	if (len < 0) {
+		ret = -errno;
+		if (ret != -ENETRESET)
+			fprintf(stderr, "[TQFTP] recvfrom failed: %d\n", ret);
+		return -1;
+	}
+
+	/* Drop unsolicited messages */
+	if (sq.sq_node != client->sq.sq_node ||
+	    sq.sq_port != client->sq.sq_port)
+		return -1;
+
+	opcode = buf[0] << 8 | buf[1];
+	block = buf[2] << 8 | buf[3];
+	if (opcode != OP_DATA) {
+		printf("[TQFTP] Expected DATA opcode, got %d\n", opcode);
+		tftp_send_error(client->sock, 4, "Expected DATA opcode");
+		return -1;
+	}
+
+	payload = len - 4;
+
+	ret = write(client->fd, buf + 4, payload);
+	if (ret < 0) {
+		/* XXX: report error */
+		printf("[TQFTP] failed to write data\n");
+		return -1;
+	}
+
+	tftp_send_ack(client->sock, block);
+
+	return payload == 512 ? 1 : 0;
+}
+
+static void client_close_and_free(struct tftp_client *client)
+{
+	list_del(&client->node);
+	close(client->sock);
+	close(client->fd);
+	free(client);
+}
+
+int main(int argc __unused, char **argv __unused)
+{
+	struct tftp_client *client;
+	struct tftp_client *next;
+	struct sockaddr_qrtr sq;
+	struct qrtr_packet pkt;
+	socklen_t sl;
+	ssize_t len;
+	char buf[4096];
+	fd_set rfds;
+	int nfds;
+	int opcode;
+	int ret;
+	int fd;
+
+	fd = qrtr_open(0);
+	if (fd < 0) {
+		fprintf(stderr, "failed to open qrtr socket\n");
+		exit(1);
+	}
+
+	ret = qrtr_publish(fd, 4096, 1, 0);
+	if (ret < 0) {
+		fprintf(stderr, "failed to publish service registry service\n");
+		exit(1);
+	}
+
+	for (;;) {
+		FD_ZERO(&rfds);
+		FD_SET(fd, &rfds);
+		nfds = fd;
+
+		list_for_each_entry(client, &writers, node) {
+			FD_SET(client->sock, &rfds);
+			nfds = MAX(nfds, client->sock);
+		}
+
+		list_for_each_entry(client, &readers, node) {
+			FD_SET(client->sock, &rfds);
+			nfds = MAX(nfds, client->sock);
+		}
+
+		ret = select(nfds + 1, &rfds, NULL, NULL, NULL);
+		if (ret < 0) {
+			if (errno == EINTR) {
+				continue;
+			} else {
+				fprintf(stderr, "select failed\n");
+				break;
+			}
+		}
+
+		list_for_each_entry_safe(client, next, &writers, node) {
+			if (FD_ISSET(client->sock, &rfds)) {
+				ret = handle_writer(client);
+				if (ret <= 0)
+					client_close_and_free(client);
+			}
+		}
+
+		list_for_each_entry_safe(client, next, &readers, node) {
+			if (FD_ISSET(client->sock, &rfds)) {
+				ret = handle_reader(client);
+				if (ret <= 0)
+					client_close_and_free(client);
+			}
+		}
+
+		if (FD_ISSET(fd, &rfds)) {
+			sl = sizeof(sq);
+			len = recvfrom(fd, buf, sizeof(buf), 0, (void *)&sq, &sl);
+			if (len < 0) {
+				ret = -errno;
+				if (ret != -ENETRESET)
+					fprintf(stderr, "[TQFTP] recvfrom failed: %d\n", ret);
+				return ret;
+			}
+
+			/* Ignore control messages */
+			if (sq.sq_port == QRTR_PORT_CTRL) {
+				ret = qrtr_decode(&pkt, buf, len, &sq);
+				if (ret < 0) {
+					fprintf(stderr, "[TQFTP] unable to decode qrtr packet\n");
+					return ret;
+				}
+
+				switch (pkt.type) {
+				case QRTR_TYPE_BYE:
+					// fprintf(stderr, "[TQFTP] got bye\n");
+					list_for_each_entry_safe(client, next, &writers, node) {
+						if (client->sq.sq_node == sq.sq_node)
+							client_close_and_free(client);
+					}
+					break;
+				case QRTR_TYPE_DEL_CLIENT:
+					// fprintf(stderr, "[TQFTP] got del_client\n");
+					list_for_each_entry_safe(client, next, &writers, node) {
+						if (!memcmp(&client->sq, &sq, sizeof(sq)))
+							client_close_and_free(client);
+					}
+					break;
+				}
+			} else {
+				if (len < 2)
+					continue;
+
+				opcode = buf[0] << 8 | buf[1];
+				switch (opcode) {
+				case OP_RRQ:
+					handle_rrq(buf, len, &sq);
+					break;
+				case OP_WRQ:
+					// printf("[TQFTP] write\n");
+					handle_wrq(buf, len, &sq);
+					break;
+				default:
+					printf("[TQFTP] unhandled op %d\n", opcode);
+					break;
+				}
+			}
+		}
+	}
+
+	close(fd);
+
+	return 0;
+}
diff --git a/shared/vendor/tqftpserv/tqftpserv.service.in b/shared/vendor/tqftpserv/tqftpserv.service.in
new file mode 100644
index 0000000..2cf828c
--- /dev/null
+++ b/shared/vendor/tqftpserv/tqftpserv.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=QRTR TFTP service
+Requires=qrtr-ns.service
+After=qrtr-ns.service
+
+[Service]
+ExecStart=TQFTPSERV_PATH/tqftpserv
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/shared/vendor/tqftpserv/translate.c b/shared/vendor/tqftpserv/translate.c
new file mode 100644
index 0000000..63161a0
--- /dev/null
+++ b/shared/vendor/tqftpserv/translate.c
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2019, Linaro Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libgen.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "translate.h"
+
+#define READONLY_PATH	"/readonly/firmware/image/"
+#define READWRITE_PATH	"/readwrite/"
+
+#ifndef ANDROID
+#define FIRMWARE_BASE	"/lib/firmware/"
+#define TQFTPSERV_TMP	"/tmp/tqftpserv"
+#else
+#define FIRMWARE_BASE	"/vendor/firmware/"
+#define TQFTPSERV_TMP	"/data/vendor/tmp/tqftpserv"
+#endif
+
+/**
+ * translate_readonly() - open "file" residing with remoteproc firmware
+ * @file:	file requested, stripped of "/readonly/image/" prefix
+ *
+ * It is assumed that the readonly files requested by the client resides under
+ * /lib/firmware in the same place as its associated remoteproc firmware.  This
+ * function scans through all entries under /sys/class/remoteproc and read the
+ * dirname of each "firmware" file in an attempt to find, and open(2), the
+ * requested file.
+ *
+ * As these files are readonly, it's not possible to pass flags to open(2).
+ *
+ * Return: opened fd on success, -1 otherwise
+ */
+static int translate_readonly(const char *file)
+{
+	char firmware_value[PATH_MAX];
+	char firmware_attr[32];
+	char path[PATH_MAX];
+	struct dirent *de;
+	int firmware_fd;
+	DIR *class_dir;
+	int class_fd;
+	ssize_t n;
+	int fd = -1;
+
+	class_fd = open("/sys/class/remoteproc", O_RDONLY | O_DIRECTORY);
+	if (class_fd < 0) {
+		warn("failed to open remoteproc class");
+		return -1;
+	}
+
+	class_dir = fdopendir(class_fd);
+	if (!class_dir) {
+		warn("failed to opendir");
+		goto close_class;
+	}
+
+	while ((de = readdir(class_dir)) != NULL) {
+		if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, ".."))
+			continue;
+
+		if (strlen(de->d_name) + sizeof("/firmware") > sizeof(firmware_attr))
+			continue;
+		strcpy(firmware_attr, de->d_name);
+		strcat(firmware_attr, "/firmware");
+
+		firmware_fd = openat(class_fd, firmware_attr, O_RDONLY);
+		if (firmware_fd < 0)
+			continue;
+
+		n = read(firmware_fd, firmware_value, sizeof(firmware_value));
+		close(firmware_fd);
+		if (n < 0) {
+			continue;
+		}
+		firmware_value[n] = '\0';
+
+		if (strlen(FIRMWARE_BASE) + strlen(firmware_value) + 1 +
+		    strlen(file) + 1 > sizeof(path))
+			continue;
+
+		strcpy(path, FIRMWARE_BASE);
+		strcat(path, dirname(firmware_value));
+		strcat(path, "/");
+		strcat(path, file);
+
+		fd = open(path, O_RDONLY);
+		if (fd >= 0)
+			break;
+
+		if (errno != ENOENT)
+			warn("failed to open %s", path);
+	}
+
+	closedir(class_dir);
+
+close_class:
+	close(class_fd);
+
+	return fd;
+}
+
+/**
+ * translate_readwrite() - open "file" from a temporary directory
+ * @file:	relative path of the requested file, with /readwrite/ stripped
+ * @flags:	flags to be passed to open(2)
+ *
+ * Return: opened fd on success, -1 otherwise
+ */
+static int translate_readwrite(const char *file, int flags)
+{
+	int base;
+	int ret;
+	int fd;
+
+	ret = mkdir(TQFTPSERV_TMP, 0700);
+	if (ret < 0 && errno != EEXIST) {
+		warn("failed to create temporary tqftpserv directory");
+		return -1;
+	}
+
+	base = open(TQFTPSERV_TMP, O_RDONLY | O_DIRECTORY);
+	if (base < 0) {
+		warn("failed top open temporary tqftpserv directory");
+		return -1;
+	}
+
+	fd = openat(base, file, flags, 0600);
+	close(base);
+	if (fd < 0)
+		warn("failed to open %s", file);
+
+	return fd;
+}
+
+/**
+ * translate_open() - open file after translating path
+ *
+
+ * Strips /readonly/firmware/image and search among remoteproc firmware.
+ * Replaces /readwrite with a temporary directory.
+
+ */
+int translate_open(const char *path, int flags)
+{
+	if (!strncmp(path, READONLY_PATH, strlen(READONLY_PATH)))
+		return translate_readonly(path + strlen(READONLY_PATH));
+	else if (!strncmp(path, READWRITE_PATH, strlen(READWRITE_PATH)))
+		return translate_readwrite(path + strlen(READWRITE_PATH), flags);
+
+	fprintf(stderr, "invalid path %s, rejecting\n", path);
+	errno = ENOENT;
+	return -1;
+}
diff --git a/shared/vendor/tqftpserv/translate.h b/shared/vendor/tqftpserv/translate.h
new file mode 100644
index 0000000..ade2d09
--- /dev/null
+++ b/shared/vendor/tqftpserv/translate.h
@@ -0,0 +1,6 @@
+#ifndef __TRANSLATE_H__
+#define __TRANSLATE_H__
+
+int translate_open(const char *path, int flags);
+
+#endif