Skip to content

Commit fd693a0

Browse files
committed
Switch to nexus style mode completely v2
This is a 2nd iteration of the patch in which we go completely Nexus. We eliminate external sdcard completely and use it 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
1 parent 5b9b4a9 commit fd693a0

File tree

10 files changed

+30
-110
lines changed

10 files changed

+30
-110
lines changed

BoardConfig.mk

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
124124
RECOVERY_GRAPHICS_USE_LINELENGTH := true
125125
TARGET_RECOVERY_DEVICE_DIRS += device/htc/pyramid
126126
RECOVERY_SDCARD_ON_DATA := true
127+
BOARD_HAS_NO_REAL_SDCARD := true
127128

128129
# Required for Sensors
129130
COMMON_GLOBAL_CFLAGS += -DNEEDS_VECTORIMPL_SYMBOLS
@@ -148,9 +149,13 @@ BOARD_HARDWARE_CLASS := $(LOCAL_PATH)/cmhw
148149
# RIL
149150
BOARD_RIL_CLASS := ../../../$(LOCAL_PATH)/ril
150151

152+
# USB
153+
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/msm_hsusb/gadget/lun0/file"
154+
151155
# Misc
152156
BOARD_USES_LEGACY_MMAP := true
153157
BOARD_SUPPRESS_EMMC_WIPE := true
158+
BOARD_SUPPRESS_SECURE_ERASE := true
154159

155160
# Use dlmalloc
156161
MALLOC_IMPL := dlmalloc
@@ -173,7 +178,7 @@ TARGET_USERIMAGES_USE_F2FS := true
173178
BOARD_VOLD_MAX_PARTITIONS := 36
174179
BOARD_BOOTIMAGE_PARTITION_SIZE := 16777216
175180
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 16776192
176-
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 838859776
181+
BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1252770816
177182
BOARD_USERDATAIMAGE_PARTITION_SIZE := 1252770816
178183
BOARD_FLASH_BLOCK_SIZE := 262144
179184

@@ -187,8 +192,10 @@ TW_NO_CPU_TEMP := true
187192
TW_NEW_ION_HEAP := true
188193
TW_INCLUDE_NTFS_3G := true
189194
TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness"
190-
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/msm_hsusb/gadget/lun0/file"
191195
TW_BACKUP_DATA_MEDIA := true
192-
TW_INTERNAL_STORAGE_PATH := /sdcard
193-
TW_EXTERNAL_STORAGE_PATH := /sdcard1
194-
TW_INCLUDE_L_CRYPTO := true
196+
197+
# Dalvik/ART optimizations
198+
WITH_DEXPREOPT := true
199+
WITH_DEXPREOPT_COMP := false
200+
WITH_DEXPREOPT_PIC := true
201+
WITH_ART_SMALL_MODE := true

device_pyramid.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
156156
# Ramdisk
157157
PRODUCT_PACKAGES += \
158158
fstab.pyramid \
159-
init.pyramid.sh \
160159
init.pyramid.rc \
161160
init.pyramid.usb.rc \
162161
ueventd.pyramid.rc \

overlay/frameworks/base/core/res/res/xml/storage_list.xml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,8 @@
2626
android:emulated="true"
2727
android:primary="true"
2828
android:mtpReserve="100" />
29-
<!-- external sdcard (non-removable due to optional usage of second partition for data) -->
30-
<storage android:mountPoint="/storage/sdcard1"
31-
android:storageDescription="@string/storage_sd_card"
32-
android:primary="false"
33-
android:emulated="false"
34-
android:removable="false"
35-
android:allowMassStorage="false"
36-
android:maxFileSize="4096" />
3729
<!-- external USB OTG storage -->
38-
<storage android:mountPoint="/storage/usb-otg"
30+
<storage android:mountPoint="/storage/usbdisk"
3931
android:storageDescription="@string/storage_usb"
4032
android:removable="true" />
4133
</StorageList>

recovery.fstab

Lines changed: 0 additions & 11 deletions
This file was deleted.

recovery.fstab

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
recovery/root/etc/twrp.fstab

recovery/root/etc/twrp.fstab

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
/boot emmc /dev/block/mmcblk0p20
44
/recovery emmc /dev/block/mmcblk0p21
5-
/system ext4 /dev/block/mmcblk0p22
6-
/data f2fs /dev/block/mmcblk0p23 length=-16384
7-
/cache f2fs /dev/block/mmcblk0p28
5+
/system ext4 /dev/block/mmcblk0p23
6+
/data f2fs /dev/block/mmcblk1 length=-16384
7+
/cache f2fs /dev/block/mmcblk0p24
88
/misc emmc /dev/block/mmcblk0p31
9-
/sdcard1 vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="sdcard1";andsec;storage;wipeingui;removable
10-
/data1 f2fs /dev/block/mmcblk1p2 /dev/block/mmcblk1 flags=display="data1";wipeingui;removable
11-
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="usb-otg";storage;wipeingui;removable
9+
/usbdisk vfat /dev/block/sda1 /dev/block/sda flags=display="usbdisk";storage;wipeingui;removable

rootdir/Android.mk

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,6 @@ LOCAL_SRC_FILES := etc/fstab.pyramid
88
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
99
include $(BUILD_PREBUILT)
1010

11-
include $(CLEAR_VARS)
12-
LOCAL_MODULE := init.pyramid.sh
13-
LOCAL_MODULE_TAGS := optional eng
14-
LOCAL_MODULE_CLASS := ETC
15-
LOCAL_SRC_FILES := etc/init.pyramid.sh
16-
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
17-
include $(BUILD_PREBUILT)
18-
1911
include $(CLEAR_VARS)
2012
LOCAL_MODULE := init.pyramid.rc
2113
LOCAL_MODULE_TAGS := optional eng

rootdir/etc/fstab.pyramid

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,18 @@
77
/dev/block/platform/msm_sdcc.1/by-name/boot /boot emmc defaults defaults
88
/dev/block/platform/msm_sdcc.1/by-name/recovery /recovery emmc defaults defaults
99
/dev/block/platform/msm_sdcc.1/by-name/misc /misc emmc defaults defaults
10-
/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
11-
/dev/block/platform/msm_sdcc.1/by-name/devlog /cache f2fs rw,discard,nosuid,nodev,noatime,nodiratime,inline_xattr wait,check
12-
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,noatime,barrier=1 wait
13-
/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
14-
/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
15-
/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
16-
/dev/block/platform/msm_sdcc.3/by-num/p2 /data1 f2fs noatime,nodiratime,nosuid,nodev,inline_xattr,discard,rw wait,check
17-
18-
# SD card
19-
/devices/platform/msm_sdcc.3/mmc_host/mmc1* auto vfat defaults voldmanaged=sdcard1:auto,noemulatedsd
10+
/dev/block/platform/msm_sdcc.1/by-name/devlog /devlog ext4 rw,noatime,nosuid,nodev,barrier=0 wait
11+
/dev/block/platform/msm_sdcc.1/by-name/userdata /system ext4 ro,noatime,barrier=0 wait
12+
/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
13+
/dev/block/platform/msm_sdcc.1/by-name/cache /cache f2fs rw,discard,nosuid,nodev,noatime,nodiratime,inline_xattr wait,check
14+
/dev/block/platform/msm_sdcc.3/mmcblk1 /data ext4 noatime,nosuid,nodev,barrier=1,data=ordered,nomblk_io_submit,noauto_da_alloc,errors=panic wait,check,encryptable=footer,length=-16384
15+
/dev/block/platform/msm_sdcc.3/mmcblk1 /data f2fs noatime,nodiratime,nosuid,nodev,inline_xattr,discard,rw wait,check,encryptable=footer,length=-16384
2016

2117
# USB storage
22-
d* auto auto defaults voldmanaged=usbdisk:auto,noemulatedsd
18+
/devices/platform/msm_hsusb_host.0/usb1 auto auto defaults voldmanaged=usbdisk:auto,noemulatedsd
2319

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

27-
# Cache as secondary swap
28-
/dev/block/platform/msm_sdcc.1/by-name/cache none swap defaults defaults
23+
# System as secondary swap
24+
/dev/block/platform/msm_sdcc.1/by-name/system none swap defaults defaults

rootdir/etc/init.pyramid.rc

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ on init
1818
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
1919
export EMULATED_STORAGE_TARGET /storage/emulated
2020

21-
# Secondary storage
22-
mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
23-
mkdir /storage/sdcard1 0700 root root
24-
export SECONDARY_STORAGE /storage/sdcard1
25-
26-
# Secondary data (optional)
27-
mkdir /data1 0771 root root
28-
2921
# Support legacy paths
3022
symlink /storage/emulated/legacy /sdcard
3123
symlink /storage/emulated/legacy /mnt/sdcard
@@ -67,9 +59,6 @@ on fs
6759
# link widevine drm library path
6860
symlink /system/vendor/lib /vendor/lib
6961

70-
# run device's script
71-
exec /init.pyramid.sh
72-
7362
mount_all /remount.pyramid
7463

7564
on post-fs-data
@@ -280,11 +269,6 @@ service iprenew_wlan0 /system/bin/dhcpcd -n
280269
disabled
281270
oneshot
282271

283-
# external sdcard daemon running as media_rw (1023)
284-
service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
285-
class late_start
286-
disabled
287-
288272
# virtual sdcard daemon running as media_rw (1023)
289273
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
290274
class late_start

rootdir/etc/init.pyramid.sh

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)