diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..5b14e18
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2018 The LineageOS 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)
+
+ifneq ($(filter enchilada,$(TARGET_DEVICE)),)
+include $(call all-makefiles-under,$(LOCAL_PATH))
+endif
diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk
new file mode 100644
index 0000000..b58a383
--- /dev/null
+++ b/BoardConfigCommon.mk
@@ -0,0 +1,101 @@
+
+# Copyright (C) 2018 The LineageOS 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.
+#
+
+BOARD_VENDOR := oneplus
+
+COMMON_PATH := device/oneplus/sdm845-common
+
+TARGET_SPECIFIC_HEADER_PATH := $(COMMON_PATH)/include
+
+# Architecture
+TARGET_ARCH := arm64
+TARGET_ARCH_VARIANT := armv8-a
+TARGET_CPU_ABI := arm64-v8a
+TARGET_CPU_ABI2 :=
+TARGET_CPU_VARIANT := kryo300
+
+TARGET_2ND_ARCH := arm
+TARGET_2ND_ARCH_VARIANT := armv7-a-neon
+TARGET_2ND_CPU_ABI := armeabi-v7a
+TARGET_2ND_CPU_ABI2 := armeabi
+TARGET_2ND_CPU_VARIANT := cortex-a9
+
+TARGET_USES_64_BIT_BINDER := true
+
+# Bootloader
+TARGET_BOOTLOADER_BOARD_NAME := sdm845
+TARGET_NO_BOOTLOADER := true
+
+# Kernel
+BOARD_KERNEL_BASE := 0x80000000
+BOARD_KERNEL_CMDLINE := androidboot.hardware=qcom androidboot.console=ttyMSM0 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 service_locator.enable=1 swiotlb=2048 androidboot.configfs=true androidboot.usbcontroller=a600000.dwc3
+BOARD_KERNEL_IMAGE_NAME := Image.gz-dtb
+BOARD_KERNEL_PAGESIZE := 4096
+TARGET_KERNEL_ARCH := arm64
+TARGET_KERNEL_SOURCE := kernel/oneplus/sdm845
+TARGET_KERNEL_CROSS_COMPILE_PREFIX := aarch64-linux-android-
+
+# Platform
+# TARGET_BOARD_PLATFORM := sdm845
+TARGET_BOARD_PLATFORM_GPU := qcom-adreno630
+
+# Properties
+BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
+
+# Treble
+BOARD_VNDK_RUNTIME_DISABLE := true
+BOARD_VNDK_VERSION := current
+PRODUCT_FULL_TREBLE_OVERRIDE := true
+
+# Audio
+USE_XML_AUDIO_POLICY_CONF := 1
+
+# Dex
+ifeq ($(HOST_OS),linux)
+ ifneq ($(TARGET_BUILD_VARIANT),eng)
+ WITH_DEXPREOPT ?= true
+ endif
+endif
+WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= true
+
+# Display
+TARGET_USES_HWC2 := true
+
+# Partitions
+BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2998927360
+BOARD_USERDATAIMAGE_PARTITION_SIZE := 118112366592
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+BOARD_FLASH_BLOCK_SIZE := 262144 # (BOARD_KERNEL_PAGESIZE * 64)
+TARGET_COPY_OUT_VENDOR := vendor
+
+# Recovery
+BOARD_USES_RECOVERY_AS_BOOT := true
+TARGET_NO_RECOVERY := true
+TARGET_RECOVERY_FSTAB := $(COMMON_PATH)/rootdir/etc/fstab.qcom
+TARGET_RECOVERY_PIXEL_FORMAT := "BGRA_8888"
+TARGET_USERIMAGES_USE_EXT4 := true
+TARGET_USERIMAGES_USE_F2FS := true
+TARGET_USES_MKE2FS := true
+
+# Root
+BOARD_ROOT_EXTRA_FOLDERS := bt_firmware dsp firmware odm op1 op2 persist
+
+# Sepolicy
+BOARD_PLAT_PRIVATE_SEPOLICY_DIR += $(COMMON_PATH)/sepolicy/private
+
+# Inherit from the proprietary version
+-include vendor/oneplus/sdm845-common/BoardConfigVendor.mk
diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000..bd2f6cc
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,51 @@
+#
+# Copyright (C) 2018 The LineageOS Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/product_launched_with_o_mr1.mk)
+
+# Get non-open-source specific aspects
+$(call inherit-product, vendor/oneplus/sdm845-common/sdm845-common-vendor.mk)
+
+# Overlays
+DEVICE_PACKAGE_OVERLAYS += \
+ $(LOCAL_PATH)/overlay \
+ $(LOCAL_PATH)/overlay-lineage
+
+# Properties
+-include $(LOCAL_PATH)/system_prop.mk
+
+# Audio
+PRODUCT_PACKAGES += \
+ audio.a2dp.default
+
+# Display
+PRODUCT_PACKAGES += \
+ libvulkan
+
+# Net
+PRODUCT_PACKAGES += \
+ netutils-wrapper-1.0
+
+# NFC
+PRODUCT_PACKAGES += \
+ NfcNci \
+ Tag \
+ com.android.nfc_extras
+
+# VNDK
+PRODUCT_PACKAGES += \
+ vndk_package
diff --git a/extract-files.sh b/extract-files.sh
new file mode 100755
index 0000000..f9a3716
--- /dev/null
+++ b/extract-files.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 The LineageOS 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.
+#
+
+set -e
+
+# Load extract_utils and do some sanity checks
+MY_DIR="${BASH_SOURCE%/*}"
+if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
+
+LINEAGE_ROOT="$MY_DIR"/../../..
+
+HELPER="$LINEAGE_ROOT"/vendor/lineage/build/tools/extract_utils.sh
+if [ ! -f "$HELPER" ]; then
+ echo "Unable to find helper script at $HELPER"
+ exit 1
+fi
+. "$HELPER"
+
+# Default to sanitizing the vendor folder before extraction
+CLEAN_VENDOR=true
+
+while [ "$1" != "" ]; do
+ case $1 in
+ -n | --no-cleanup ) CLEAN_VENDOR=false
+ ;;
+ -s | --section ) shift
+ SECTION=$1
+ CLEAN_VENDOR=false
+ ;;
+ * ) SRC=$1
+ ;;
+ esac
+ shift
+done
+
+if [ -z "$SRC" ]; then
+ SRC=adb
+fi
+
+# Initialize the helper for common device
+setup_vendor "$DEVICE_COMMON" "$VENDOR" "$LINEAGE_ROOT" true "$CLEAN_VENDOR"
+
+extract "$MY_DIR"/proprietary-files.txt "$SRC" "$SECTION"
+
+if [ -s "$MY_DIR"/../$DEVICE/proprietary-files.txt ]; then
+ # Reinitialize the helper for device
+ setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" false "$CLEAN_VENDOR"
+
+ extract "$MY_DIR"/../$DEVICE/proprietary-files.txt "$SRC" "$SECTION"
+fi
+
+"$MY_DIR"/setup-makefiles.sh
diff --git a/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml
new file mode 100644
index 0000000..7070559
--- /dev/null
+++ b/overlay-lineage/lineage-sdk/lineage/res/res/values/config.xml
@@ -0,0 +1,87 @@
+
+
+
+
+ 64
+
+
+ 64
+
+
+ 107
+
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
new file mode 100644
index 0000000..673ce79
--- /dev/null
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -0,0 +1,320 @@
+
+
+
+
+
+
+ true
+
+
+ true
+
+
+
+ true
+
+
+ true
+
+
+ Android-Mms/2.0
+
+
+ http://www.google.com/oha/rdf/ua-profile-kila.xml
+
+
+
+ - "usb\\d"
+ - "rndis\\d"
+
+
+
+
+ - "softap0"
+ - "wigig0"
+ - "wifi_br0"
+
+
+
+
+ - "bnep\\d"
+ - "bt-pan"
+
+
+
+
+
+ - 1
+ - 0
+ - 5
+ - 7
+
+
+
+
+
+ - 192.168.42.2
+ - 192.168.42.254
+ - 192.168.43.2
+ - 192.168.43.254
+ - 192.168.44.2
+ - 192.168.44.254
+ - 192.168.45.2
+ - 192.168.45.254
+ - 192.168.46.2
+ - 192.168.46.254
+ - 192.168.47.2
+ - 192.168.47.254
+ - 192.168.48.2
+ - 192.168.48.254
+ - 192.168.49.2
+ - 192.168.49.254
+ - 192.168.50.2
+ - 192.168.50.254
+ - 192.168.51.2
+ - 192.168.51.254
+
+
+
+
+
+
+
+ - wifi,1,1,1,-1,true
+ - mobile,0,0,0,-1,true
+ - mobile_mms,2,0,4,60000,true
+ - mobile_supl,3,0,2,60000,true
+ - mobile_dun,4,0,2,60000,true
+ - mobile_hipri,5,0,3,60000,true
+ - mobile_fota,10,0,2,60000,true
+ - mobile_ims,11,0,2,60000,true
+ - mobile_cbs,12,0,2,60000,true
+ - bluetooth,7,7,2,-1,true
+ - mobile_emergency,15,0,5,-1,true
+
+
+
+
+
+ - "1,1"
+ - "0,1"
+ - "7,1"
+
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ 524288,1048576,4194304,524288,1048576,4194304
+
+
+ true
+
+
+ true
+
+
+ com.android.systemui/com.android.systemui.doze.DozeService
+
+
+ true
+
+
+ true
+
+
+ 17
+
+
+
+ - lte:2097152,4194304,8388608,262144,524288,1048576
+ - lte_ca:4096,6291456,12582912,4096,1048576,2097152
+ - umts:4094,87380,1220608,4096,16384,1220608
+ - hspa:4094,87380,1220608,4096,16384,1220608
+ - hsupa:4094,87380,1220608,4096,16384,1220608
+ - hsdpa:4094,87380,1220608,4096,16384,1220608
+ - hspap:4094,87380,1220608,4096,16384,1220608
+ - edge:4093,26280,35040,4096,16384,35040
+ - gprs:4092,8760,11680,4096,8760,11680
+ - evdo:4094,87380,524288,4096,16384,262144
+
+
+
+ true
+
+
+ true
+
+
+ org.codeaurora.ims
+
+
+ true
+
+
+ false
+
+
+ true
+
+
+ true
+
+
+ 680
+
+
+ 3300
+
+
+
+ - 0
+ - 10
+
+
+
+
+ - 0
+ - 10
+
+
+
+
+ - 10
+
+
+
+
+ - "/system/framework/arm64/boot-framework.oat"
+ - "/system/framework/arm64/boot-framework.vdex"
+ - "/system/framework/oat/arm64/services.odex"
+ - "/system/framework/oat/arm64/services.vdex"
+ - "/system/framework/arm64/boot.oat"
+ - "/system/framework/arm64/boot.vdex"
+ - "/system/framework/arm64/boot-core-libart.oat"
+ - "/system/framework/arm64/boot-core-libart.vdex"
+
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ true
+
diff --git a/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
new file mode 100644
index 0000000..bf10c07
--- /dev/null
+++ b/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+ true
+
+
diff --git a/overlay/packages/services/Telephony/res/values/config.xml b/overlay/packages/services/Telephony/res/values/config.xml
new file mode 100644
index 0000000..bca0057
--- /dev/null
+++ b/overlay/packages/services/Telephony/res/values/config.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+
diff --git a/proprietary-files.txt b/proprietary-files.txt
new file mode 100644
index 0000000..469c4f5
--- /dev/null
+++ b/proprietary-files.txt
@@ -0,0 +1,10 @@
+# IOP
+lib64/vendor.qti.hardware.iop@2.0.so
+lib/vendor.qti.hardware.iop@2.0.so
+
+# Telephony
+-app/QtiTelephonyService/QtiTelephonyService.apk
+etc/permissions/qcrilhook.xml
+etc/permissions/privapp-permissions-qti.xml
+framework/qcrilhook.jar
+-priv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk
diff --git a/rootdir/etc/fstab.qcom b/rootdir/etc/fstab.qcom
new file mode 100644
index 0000000..642b324
--- /dev/null
+++ b/rootdir/etc/fstab.qcom
@@ -0,0 +1,27 @@
+# Android fstab file.
+# The filesystem that contains the filesystem checker binary (typically /system) cannot
+# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
+
+#TODO: Add 'check' as fs_mgr_flags with data partition.
+# Currently we dont have e2fsck compiled. So fs check would failed.
+
+#
+/dev/block/bootdevice/by-name/system / ext4 ro,barrier=1,discard wait,slotselect,avb
+/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc,discard wait,check,fileencryption=ice,quota
+#/devices/platform/soc/8804000.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
+#/devices/platform/soc/1da4000.ufshc_card/host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
+/dev/block/bootdevice/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect
+/dev/block/bootdevice/by-name/dsp /dsp ext4 ro,nosuid,nodev,barrier=1 wait,slotselect
+/dev/block/bootdevice/by-name/persist /persist ext4 noatime,nosuid,nodev,barrier=1 wait
+#/dev/block/bootdevice/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1 wait
+/dev/block/bootdevice/by-name/bluetooth /bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait,slotselect
+/devices/platform/soc/a600000.ssusb/a600000.dwc3/xhci-hcd.0.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto
+# Need to have this entry in here even though the mount point itself is no longer needed.
+# The update_engine code looks for this entry in order to determine the boot device address
+# and fails if it does not find it.
+/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
+#/dev/block/bootdevice/by-name/op1 /op1 ext4 ro,barrier=1,discard,context=u:object_r:op1_file:s0 wait
+/dev/block/zram0 none swap defaults zramsize=1073741824
+/devices/platform/soc/a600000.ssusb/a600000.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto
+/devices/platform/soc/a800000.ssusb/a800000.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto
+
diff --git a/sepolicy/private/file.te b/sepolicy/private/file.te
new file mode 100644
index 0000000..e3d523e
--- /dev/null
+++ b/sepolicy/private/file.te
@@ -0,0 +1,6 @@
+type adsprpcd_file, file_type;
+type bt_firmware_file, file_type;
+type firmware_file, file_type;
+type op1_file, file_type;
+type op2_file, file_type;
+type persist_file, file_type;
diff --git a/sepolicy/private/file_contexts b/sepolicy/private/file_contexts
new file mode 100644
index 0000000..367712b
--- /dev/null
+++ b/sepolicy/private/file_contexts
@@ -0,0 +1,7 @@
+# Files in rootfs
+/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0
+/dsp(/.*)? u:object_r:adsprpcd_file:s0
+/firmware(/.*)? u:object_r:firmware_file:s0
+/op1(/.*)? u:object_r:op1_file:s0
+/op2(/.*)? u:object_r:op2_file:s0
+/persist(/.*)? u:object_r:persist_file:s0
diff --git a/setup-makefiles.sh b/setup-makefiles.sh
new file mode 100755
index 0000000..a06f1dd
--- /dev/null
+++ b/setup-makefiles.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# Copyright (C) 2018 The LineageOS 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.
+#
+
+set -e
+
+# Load extract_utils and do some sanity checks
+MY_DIR="${BASH_SOURCE%/*}"
+if [[ ! -d "$MY_DIR" ]]; then MY_DIR="$PWD"; fi
+
+LINEAGE_ROOT="$MY_DIR"/../../..
+
+HELPER="$LINEAGE_ROOT"/vendor/lineage/build/tools/extract_utils.sh
+if [ ! -f "$HELPER" ]; then
+ echo "Unable to find helper script at $HELPER"
+ exit 1
+fi
+. "$HELPER"
+
+# Initialize the helper for common
+setup_vendor "$DEVICE_COMMON" "$VENDOR" "$LINEAGE_ROOT" true
+
+# Copyright headers and guards
+write_headers "enchilada"
+
+# The standard common blobs
+write_makefiles "$MY_DIR"/proprietary-files.txt true
+
+# We are done!
+write_footers
+
+if [ -s "$MY_DIR"/../$DEVICE/proprietary-files.txt ]; then
+ # Reinitialize the helper for device
+ setup_vendor "$DEVICE" "$VENDOR" "$LINEAGE_ROOT" false
+
+ # Copyright headers and guards
+ write_headers
+
+ # The standard device blobs
+ write_makefiles "$MY_DIR"/../$DEVICE/proprietary-files.txt true
+
+ # We are done!
+ write_footers
+fi
diff --git a/system_prop.mk b/system_prop.mk
new file mode 100644
index 0000000..b9a197b
--- /dev/null
+++ b/system_prop.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2018 The LineageOS 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.
+#
+
+# Radio
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.telephony.default_network=22,20