Skip to content

Commit

Permalink
Switch to nexus style mode completely
Browse files Browse the repository at this point in the history
This is a 2nd iteration of the patch in which we go completely Nexus.
We eliminate external sdcard completely and use it's first partition as /data that can be fully encrypted.
In addition we perform series of storage layout changes, cleanups and optimizations.

Now to the details:
* Use original "userdata" parititon as /system (60% more space for GAPPS and DEX data).
* Reduce size of primary zram swap by half (Add more RAM).
* Use original "system" as secondary swap (Provide backup swap for smaller zram swap).
* We create pre-odexed build which should allow the following:
  - Avoid usage of userdata for DEX data of system apps and data duplication
  - Avoid encryption of system DEX data (which is public)
  - Allow much faster access from /system partition
  - Allow much faster boot with encrypted data (when data is encrypted,
    dalvik-cache is also and need to be re-created on each boot for asking user's password!)
  - Enable ART-small mode which pre-compiles (into dalvik-cache) only bare minimum of clasees
* Add misc recovery related settings and coresponding changes to TWRP in order to support above.
* Modify recovery related settings (this device tree can be used for building TWRP image)
* Remove duplicated default init.rc code
* General cleanups

Change-Id: I60b8303fce99a83c162ca11bb1304a551c48404a
  • Loading branch information
eugenesan committed Oct 1, 2015
1 parent 1a8bbe7 commit 5198dc0
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 110 deletions.
17 changes: 12 additions & 5 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TARGET_RECOVERY_DEVICE_DIRS += device/htc/pyramid
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true

# Required for Sensors
COMMON_GLOBAL_CFLAGS += -DNEEDS_VECTORIMPL_SYMBOLS
Expand All @@ -148,9 +149,13 @@ BOARD_HARDWARE_CLASS := $(LOCAL_PATH)/cmhw
# RIL
BOARD_RIL_CLASS := ../../../$(LOCAL_PATH)/ril

# USB
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/msm_hsusb/gadget/lun0/file"

# Misc
BOARD_USES_LEGACY_MMAP := true
BOARD_SUPPRESS_EMMC_WIPE := true
BOARD_SUPPRESS_SECURE_ERASE := true

# Use dlmalloc
MALLOC_IMPL := dlmalloc
Expand All @@ -173,7 +178,7 @@ TARGET_USERIMAGES_USE_F2FS := true
BOARD_VOLD_MAX_PARTITIONS := 36
BOARD_BOOTIMAGE_PARTITION_SIZE := 16777216
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 16776192
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 838859776
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1252770816
BOARD_USERDATAIMAGE_PARTITION_SIZE := 1252770816
BOARD_FLASH_BLOCK_SIZE := 262144

Expand All @@ -186,8 +191,10 @@ HAVE_SELINUX := true
TW_NEW_ION_HEAP := true
TW_INCLUDE_NTFS_3G := true
TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness"
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/msm_hsusb/gadget/lun0/file"
TW_BACKUP_DATA_MEDIA := true
TW_INTERNAL_STORAGE_PATH := /sdcard
TW_EXTERNAL_STORAGE_PATH := /sdcard1
TW_INCLUDE_L_CRYPTO := true

# Dalvik/ART optimizations
WITH_DEXPREOPT := true
WITH_DEXPREOPT_COMP := false
WITH_DEXPREOPT_PIC := true
WITH_ART_SMALL_MODE := true
1 change: 0 additions & 1 deletion device_pyramid.mk
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
# Ramdisk
PRODUCT_PACKAGES += \
fstab.pyramid \
init.pyramid.sh \
init.pyramid.rc \
init.pyramid.usb.rc \
ueventd.pyramid.rc \
Expand Down
10 changes: 1 addition & 9 deletions overlay/frameworks/base/core/res/res/xml/storage_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,8 @@
android:emulated="true"
android:primary="true"
android:mtpReserve="100" />
<!-- external sdcard (non-removable due to optional usage of second partition for data) -->
<storage android:mountPoint="/storage/sdcard1"
android:storageDescription="@string/storage_sd_card"
android:primary="false"
android:emulated="false"
android:removable="false"
android:allowMassStorage="false"
android:maxFileSize="4096" />
<!-- external USB OTG storage -->
<storage android:mountPoint="/storage/usb-otg"
<storage android:mountPoint="/storage/usbdisk"
android:storageDescription="@string/storage_usb"
android:removable="true" />
</StorageList>
11 changes: 0 additions & 11 deletions recovery.fstab

This file was deleted.

1 change: 1 addition & 0 deletions recovery.fstab
10 changes: 4 additions & 6 deletions recovery/root/etc/twrp.fstab
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

/boot emmc /dev/block/mmcblk0p20
/recovery emmc /dev/block/mmcblk0p21
/system ext4 /dev/block/mmcblk0p22
/data f2fs /dev/block/mmcblk0p23 length=-16384
/cache f2fs /dev/block/mmcblk0p28
/system ext4 /dev/block/mmcblk0p23
/data f2fs /dev/block/mmcblk1p1 length=-16384
/cache f2fs /dev/block/mmcblk0p24
/misc emmc /dev/block/mmcblk0p31
/sdcard1 vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="sdcard1";andsec;storage;wipeingui;removable
/data1 f2fs /dev/block/mmcblk1p2 /dev/block/mmcblk1 flags=display="data1";wipeingui;removable
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="usb-otg";storage;wipeingui;removable
/usbdisk vfat /dev/block/sda1 /dev/block/sda flags=display="usbdisk";storage;wipeingui;removable
8 changes: 0 additions & 8 deletions rootdir/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ LOCAL_SRC_FILES := etc/fstab.pyramid
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := init.pyramid.sh
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.pyramid.sh
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := init.pyramid.rc
LOCAL_MODULE_TAGS := optional eng
Expand Down
22 changes: 9 additions & 13 deletions rootdir/etc/fstab.pyramid
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,18 @@
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults
/dev/block/platform/msm_sdcc.1/by-name/devlog /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/devlog /cache f2fs rw,discard,nosuid,nodev,noatime,nodiratime,inline_xattr wait,check
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,noatime,barrier=1 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.1/by-name/userdata /data f2fs noatime,nodiratime,nosuid,nodev,inline_xattr,discard,rw wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.3/by-num/p2 /data1 ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check
/dev/block/platform/msm_sdcc.3/by-num/p2 /data1 f2fs noatime,nodiratime,nosuid,nodev,inline_xattr,discard,rw wait,check

# SD card
/devices/platform/msm_sdcc.3/mmc_host/mmc1* auto vfat defaults voldmanaged=sdcard1:auto,noemulatedsd
/dev/block/platform/msm_sdcc.1/by-name/devlog /devlog ext4 rw,noatime,nosuid,nodev,barrier=0 wait
/dev/block/platform/msm_sdcc.1/by-name/userdata /system ext4 ro,noatime,barrier=0 wait
/dev/block/platform/msm_sdcc.1/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check
/dev/block/platform/msm_sdcc.1/by-name/cache /cache f2fs rw,discard,nosuid,nodev,noatime,nodiratime,inline_xattr wait,check
/dev/block/platform/msm_sdcc.3/by-num/p1 /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check,encryptable=footer,length=-16384
/dev/block/platform/msm_sdcc.3/by-num/p1 /data f2fs noatime,nodiratime,nosuid,nodev,inline_xattr,discard,rw wait,check,encryptable=footer,length=-16384

# USB storage
d* auto auto defaults voldmanaged=usbdisk:auto,noemulatedsd
/devices/platform/msm_hsusb_host.0/usb1 auto auto defaults voldmanaged=usbdisk:auto,noemulatedsd

# ZRAM
/dev/block/zram0 none swap defaults zramsize=134217728

# Cache as secondary swap
/dev/block/platform/msm_sdcc.1/by-name/cache none swap defaults defaults
# System as secondary swap
/dev/block/platform/msm_sdcc.1/by-name/system none swap defaults defaults
16 changes: 0 additions & 16 deletions rootdir/etc/init.pyramid.rc
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ on init
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
export EMULATED_STORAGE_TARGET /storage/emulated

# Secondary storage
mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
mkdir /storage/sdcard1 0700 root root
export SECONDARY_STORAGE /storage/sdcard1

# Secondary data (optional)
mkdir /data1 0771 root root

# Support legacy paths
symlink /storage/emulated/legacy /sdcard
symlink /storage/emulated/legacy /mnt/sdcard
Expand Down Expand Up @@ -67,9 +59,6 @@ on fs
# link widevine drm library path
symlink /system/vendor/lib /vendor/lib

# run device's script
exec /init.pyramid.sh

mount_all /remount.pyramid

on post-fs-data
Expand Down Expand Up @@ -280,11 +269,6 @@ service iprenew_wlan0 /system/bin/dhcpcd -n
disabled
oneshot

# external sdcard daemon running as media_rw (1023)
service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
class late_start
disabled

# virtual sdcard daemon running as media_rw (1023)
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
class late_start
Expand Down
38 changes: 0 additions & 38 deletions rootdir/etc/init.pyramid.sh

This file was deleted.

6 changes: 3 additions & 3 deletions system_prop.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ PRODUCT_PROPERTY_OVERRIDES += \

# Tweaks
PRODUCT_PROPERTY_OVERRIDES += \
dalvik.vm.dexopt-data-only=1 \
dalvik.vm.dexopt-flags=m=y \
windowsmgr.max_events_per_sec=300 \
pm.sleep_mode=1
# dalvik.vm.dexopt-data-only=1 \
# dalvik.vm.dexopt-flags=m=y \
# Display
PRODUCT_PROPERTY_OVERRIDES += \
Expand All @@ -41,8 +41,8 @@ PRODUCT_PROPERTY_OVERRIDES += \
# Misc
PRODUCT_PROPERTY_OVERRIDES += \
ro.setupwizard.enable_bypass=1 \
dalvik.vm.lockprof.threshold=500 \
ro.com.google.locationfeatures=1
# dalvik.vm.lockprof.threshold=500 \
# USB-OTG
persist.sys.isUsbOtgEnabled=true
Expand Down

0 comments on commit 5198dc0

Please sign in to comment.