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/beryllium/BoardConfig.mk b/beryllium/BoardConfig.mk
index 3a684a0..3e1d727 100644
--- a/beryllium/BoardConfig.mk
+++ b/beryllium/BoardConfig.mk
@@ -1,4 +1,4 @@
-include device/generic/sdm845/BoardConfigCommon.mk
+include device/generic/sdm845/shared/BoardConfig.mk
 
 # Copied from https://github.com/LineageOS/android_device_xiaomi_sdm845-common/blob/lineage-16.0/BoardConfigCommon.mk
 # Board Information
diff --git a/beryllium/beryllium.mk b/beryllium/beryllium.mk
new file mode 100644
index 0000000..7f0c72e
--- /dev/null
+++ b/beryllium/beryllium.mk
@@ -0,0 +1,24 @@
+ifndef TARGET_KERNEL_USE
+TARGET_KERNEL_USE := mainline
+endif
+
+KERNEL_MODS := $(wildcard device/generic/sdm845/shared/prebuilt-kernel/android-$(TARGET_KERNEL_USE)/*.ko)
+
+# Following modules go to vendor partition
+# msm.ko is too big (31M) for ramdisk
+VENDOR_KERN_MODS := %/msm.ko
+BOARD_VENDOR_KERNEL_MODULES := $(filter $(VENDOR_KERN_MODS),$(KERNEL_MODS))
+
+# All other modules go to ramdisk
+BOARD_GENERIC_RAMDISK_KERNEL_MODULES := $(filter-out $(VENDOR_KERN_MODS),$(KERNEL_MODS))
+
+# Inherit the full_base and device configurations
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
+$(call inherit-product, device/generic/sdm845/beryllium/device.mk)
+$(call inherit-product, device/generic/sdm845/shared/device.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
+
+# Product overrides
+PRODUCT_NAME := beryllium
+PRODUCT_DEVICE := beryllium
+PRODUCT_BRAND := AOSP
diff --git a/beryllium/device.mk b/beryllium/device.mk
index 4350143..28a6e13 100644
--- a/beryllium/device.mk
+++ b/beryllium/device.mk
@@ -17,10 +17,10 @@
 PRODUCT_COPY_FILES := \
     $(LOCAL_PATH)/fstab.ramdisk:$(TARGET_COPY_OUT_RAMDISK)/fstab.beryllium \
     $(LOCAL_PATH)/fstab.ramdisk:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.beryllium \
-    device/generic/sdm845/etc/audio.sdm845.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio.beryllium.xml \
-    device/generic/sdm845/init.common.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.beryllium.rc \
-    device/generic/sdm845/init.common.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.beryllium.usb.rc \
-    device/generic/sdm845/common.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/beryllium.kl
+    device/generic/sdm845/shared/etc/audio.sdm845.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio.beryllium.xml \
+    device/generic/sdm845/shared/init.sdm845.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.beryllium.rc \
+    device/generic/sdm845/shared/init.sdm845.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.beryllium.usb.rc \
+    device/generic/sdm845/shared/key_layout.kl:$(TARGET_COPY_OUT_VENDOR)/usr/keylayout/beryllium.kl
 
 # Build generic Audio HAL
 PRODUCT_PACKAGES := audio.primary.beryllium