diff --git a/Android.mk b/Android.mk
index 4712da3eb..108716393 100644
--- a/Android.mk
+++ b/Android.mk
@@ -46,3 +46,18 @@ include $(BUILD_PREBUILT)
endif
include $(call first-makefiles-under,$(LOCAL_PATH))
+
+ifeq ($(TARGET_DEVICE),mako)
+
+# This is ugly for more reasons than I can mention. Don't think
+# that this is a good idea. It's not. It's horrible. It's truly
+# entirely horrible. It's not an elegant hack in any way.
+
+$(shell mkdir -p $(TARGET_OUT_ETC)/firmware/wcd9310; \
+ ln -sf /data/misc/audio/wcd9310_anc.bin \
+ $(TARGET_OUT_ETC)/firmware/wcd9310/wcd9310_anc.bin; \
+ ln -sf /data/misc/audio/mbhc.bin \
+ $(TARGET_OUT_ETC)/firmware/wcd9310/wcd9310_mbhc.bin)
+
+endif
+
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 9a26a532f..f0473d2db 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -33,11 +33,12 @@ TARGET_KRAIT_BIONIC_PLDTHRESH := 10
TARGET_KRAIT_BIONIC_BBTHRESH := 64
TARGET_KRAIT_BIONIC_PLDSIZE := 64
-TARGET_USE_O3 := true
-
TARGET_NO_BOOTLOADER := true
TARGET_KERNEL_CONFIG := mako_defconfig
+# Use JWR66Y kernel compatibility fix
+TARGET_USE_JWR66Y := true
+
BOARD_KERNEL_BASE := 0x80200000
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.hardware=mako lpj=67677
diff --git a/bluetooth/bdroid_buildcfg.h b/bluetooth/bdroid_buildcfg.h
index ed417ede2..dbc147192 100644
--- a/bluetooth/bdroid_buildcfg.h
+++ b/bluetooth/bdroid_buildcfg.h
@@ -19,5 +19,5 @@
#define BTM_DEF_LOCAL_NAME "Nexus 4"
#define BTA_DISABLE_DELAY 1000 /* in milliseconds */
-
+#define BLUETOOTH_QCOM_SW TRUE
#endif
diff --git a/device.mk b/device.mk
index 1546e6d67..eec95d802 100644
--- a/device.mk
+++ b/device.mk
@@ -97,7 +97,8 @@ PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.usb.accessory.xml:system/etc/permissions/android.hardware.usb.accessory.xml \
frameworks/native/data/etc/android.hardware.telephony.gsm.xml:system/etc/permissions/android.hardware.telephony.gsm.xml \
frameworks/native/data/etc/android.hardware.audio.low_latency.xml:system/etc/permissions/android.hardware.audio.low_latency.xml \
- frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml
+ frameworks/native/data/etc/android.hardware.bluetooth_le.xml:system/etc/permissions/android.hardware.bluetooth_le.xml \
+ frameworks/native/data/etc/android.hardware.usb.host.xml:system/etc/permissions/android.hardware.usb.host.xml
# GPS configuration
PRODUCT_COPY_FILES += \
diff --git a/fstab.mako b/fstab.mako
index 3ae7c2a81..adad30692 100644
--- a/fstab.mako
+++ b/fstab.mako
@@ -18,3 +18,5 @@
/dev/block/platform/msm_sdcc.1/by-name/tz /tz emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/rpm /rpm emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/aboot /aboot emmc defaults defaults
+
+/devices/platform/msm_hsusb_host/usb2 /storage/usbdisk0 auto defaults voldmanaged=usbdisk:auto
diff --git a/init.mako.rc b/init.mako.rc
index 0c77562ec..09d92c3d4 100644
--- a/init.mako.rc
+++ b/init.mako.rc
@@ -23,6 +23,7 @@ on init
# See storage config details at http://source.android.com/tech/storage/
mkdir /mnt/shell/emulated 0700 shell shell
mkdir /storage/emulated 0555 root root
+ mkdir /storage/usbdisk0 0666 system system
# Set permissions for persist partition
mkdir /persist 0771 system system
@@ -31,12 +32,15 @@ on init
export EXTERNAL_STORAGE /storage/emulated/legacy
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
export EMULATED_STORAGE_TARGET /storage/emulated
+ export SECONDARY_STORAGE /storage/usbdisk0
# Support legacy paths
symlink /storage/emulated/legacy /sdcard
symlink /storage/emulated/legacy /mnt/sdcard
symlink /storage/emulated/legacy /storage/sdcard0
symlink /mnt/shell/emulated/0 /storage/emulated/legacy
+ symlink /storage/usbdisk0 /usbdisk
+ symlink /storage/usbdisk0 /mnt/usbdisk
# Setup custom emergency number list based on
# the MCC. This is needed by RIL.
@@ -414,5 +418,11 @@ service diag_mdlog /system/bin/logwrapper /system/bin/diag_mdlog -s 100
class late_start
disabled
+service userinit /system/xbin/busybox run-parts /system/etc/init.d
+ oneshot
+ class late_start
+ user root
+ group root
+
# on property:gsm.sim.state=READY
# start diag_mdlog
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index fc5a5b8b0..7d0e5d09c 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -31,6 +31,12 @@
9000
+
+ true
+
+
+ true
+
true
@@ -228,7 +234,7 @@
- 7
+ 10
true
diff --git a/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/overlay/frameworks/base/core/res/res/xml/storage_list.xml
index 344fe1e10..a43d4f9e9 100644
--- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml
+++ b/overlay/frameworks/base/core/res/res/xml/storage_list.xml
@@ -23,6 +23,12 @@
+