Merge "Enable dm-verity on shamu"
diff --git a/device.mk b/device.mk
index c04e2d2..fcb0212 100644
--- a/device.mk
+++ b/device.mk
@@ -336,6 +336,10 @@
 PRODUCT_SYSTEM_VERITY_PARTITION := /dev/block/platform/msm_sdcc.1/by-name/system
 $(call inherit-product, build/target/product/verity.mk)
 
+PRODUCT_PACKAGES += \
+    slideshow \
+    verity_warning_images
+
 # setup scheduler tunable
 PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
     ro.qualcomm.perf.cores_online=2
diff --git a/fstab.shamu b/fstab.shamu
index 4a9989a..f07daf8 100644
--- a/fstab.shamu
+++ b/fstab.shamu
@@ -3,7 +3,7 @@
 # specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
 #
 #<src>                                                <mnt_point>  <type>  <mnt_flags and options>                     <fs_mgr_flags>
-/dev/block/platform/msm_sdcc.1/by-name/system         /system      ext4    ro,barrier=1                                wait
+/dev/block/platform/msm_sdcc.1/by-name/system         /system      ext4    ro,barrier=1                                wait,verify=/dev/block/platform/msm_sdcc.1/by-name/metadata
 /dev/block/platform/msm_sdcc.1/by-name/userdata    /data        ext4    rw,nosuid,nodev,noatime,nodiratime,noauto_da_alloc,nobarrier    wait,check,formattable,forceencrypt=/dev/block/platform/msm_sdcc.1/by-name/metadata
 /dev/block/platform/msm_sdcc.1/by-name/cache       /cache       ext4    rw,noatime,nosuid,nodev,barrier=1,data=ordered   wait,check,formattable
 /dev/block/platform/msm_sdcc.1/by-name/modem       /firmware    ext4    ro,barrier=1,context=u:object_r:firmware_file:s0    wait
diff --git a/init.shamu.rc b/init.shamu.rc
index 3513760..f6ebbf7 100644
--- a/init.shamu.rc
+++ b/init.shamu.rc
@@ -25,6 +25,9 @@
     chown system system /sys/kernel/debug/kgsl/proc
 
 on init
+    # Load persistent dm-verity state
+    verity_load_state
+
     mkdir /oem 0550 root root
 
     # Set permissions for persist partition
@@ -61,6 +64,12 @@
     setprop persist.data.df.agg.dl_pkt 10
     setprop persist.data.df.agg.dl_size 4096
 
+    # Adjust parameters for dm-verity device
+    write /sys/block/dm-0/queue/read_ahead_kb 2048
+
+    # Update dm-verity state and set partition.*.verified properties
+    verity_update_state
+
 on post-fs-data
     mkdir /tombstones/modem 0771 system system
     mkdir /tombstones/lpass 0771 system system
@@ -568,6 +577,9 @@
 on property:vold.decrypt=trigger_reset_main
     stop gnss-svcd
 
+on verity-logging
+    exec u:r:slideshow:s0 -- /sbin/slideshow warning/verity_red_1 warning/verity_red_2
+
 # When QCA1530 is known not to present
 on property:persist.qca1530=no
    stop gnss-svcd
diff --git a/verity/Android.mk b/verity/Android.mk
new file mode 100644
index 0000000..8493309
--- /dev/null
+++ b/verity/Android.mk
@@ -0,0 +1,52 @@
+#
+# Copyright 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.
+#
+
+# This contains the module build definitions for the hardware-specific
+# components for this device.
+#
+# As much as possible, those components should be built unconditionally,
+# with device-specific names to avoid collisions, to avoid device-specific
+# bitrot and build breakages. Building a component unconditionally does
+# *not* include it on all devices, so it is safe even with hardware-specific
+# components.
+
+LOCAL_PATH := $(call my-dir)
+
+define _add-warning-image
+include $$(CLEAR_VARS)
+LOCAL_MODULE := warning_$(notdir $(1))
+LOCAL_MODULE_STEM := $(notdir $(1))
+_img_modules += $$(LOCAL_MODULE)
+LOCAL_SRC_FILES := $1
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $$(TARGET_ROOT_OUT)/res/images/warning
+include $$(BUILD_PREBUILT)
+endef
+
+_img_modules :=
+_images :=
+$(foreach _img, $(call find-subdir-subdir-files, "images", "*.png"), \
+  $(eval $(call _add-warning-image,$(_img))))
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := verity_warning_images
+LOCAL_MODULE_TAGS := optional
+LOCAL_REQUIRED_MODULES := $(_img_modules)
+include $(BUILD_PHONY_PACKAGE)
+
+_add-warning-image :=
+_img_modules :=
diff --git a/verity/images/verity_red_1.png b/verity/images/verity_red_1.png
new file mode 100644
index 0000000..0b8c308
--- /dev/null
+++ b/verity/images/verity_red_1.png
Binary files differ
diff --git a/verity/images/verity_red_2.png b/verity/images/verity_red_2.png
new file mode 100644
index 0000000..e7a4b37
--- /dev/null
+++ b/verity/images/verity_red_2.png
Binary files differ