xda-developers
Linux
Windows
Factory Image
Filesystem Maintenance
Notes
Can only be done within TWRP Recovery either via built-in Terminal or over ADB
Ideal to do before a clean ROM flash, after an improper shutdown, and/or after configuring all apps/copying over all data
Quick-commands
This expects /data
and /cache
to be ext4
This expects /data
to be encrypted
Boot TWRP, enter encryption password, and immediately run the following from a computer
adb shell "umount '/sdcard' && umount '/cache' && umount '/data' && e2fsck -y -f -v '/dev/block/mmcblk0p39' && e2fsck -y -f -v '/dev/block/mmcblk0p40' && e2fsck -y -f -v '/dev/block/mmcblk0p41' && e2fsck -y -f -v '/dev/block/dm-0' && mount '/system' && mount '/data' && mount '/cache' && mount '/vendor' && rm -Rf '/data/dalvik-cache' && fstrim -v '/system' && fstrim -v '/data' && fstrim -v '/cache' && fstrim -v '/vendor' && sync && umount '/system' && umount '/data' && umount '/cache' && umount '/vendor' && reboot"
/dev/block/dm-0
is /data
and /sdcard
/dev/block/mmcblk0p39
is /vendor
/dev/block/mmcblk0p40
is /cache
/dev/block/mmcblk0p41
is /system
All 5 partitions are ext4
Wipe Partitions
fastboot erase bootloader
fastboot erase radio
fastboot erase recovery
fastboot erase boot
fastboot erase vendor
fastboot format vendor
fastboot -w
Unmount Partitions
umount '/sdcard'
umount '/data'
umount '/cache'
umount '/system'
ext4 Filesystem Maintenance
e2fsck -y -f -v '/dev/block/dm-0'
e2fsck -y -f -v '/dev/block/mmcblk0p39'
e2fsck -y -f -v '/dev/block/mmcblk0p40'
e2fsck -y -f -v '/dev/block/mmcblk0p41'
Mount Partitions
mount '/system'
mount '/data'
mount '/cache'
mount '/vendor'
Clear Dalvik/ART Cache
adb shell
mount '/data'
rm -Rf '/data/dalvik-cache'
fstrim
adb shell
mount '/system' && mount '/vendor'
fstrim -v '/system' && fstrim -v '/data' && fstrim -v '/cache' && fstrim -v '/vendor' && sync
Quick-command
adb shell "mount '/system' && mount '/vendor' && fstrim -v '/system' && fstrim -v '/data' && fstrim -v '/cache' && fstrim -v '/vendor' && sync"
Flash Base
sudo fastboot flash 'bootloader' ~/'Downloads/bullhead-'*'/bootloader-bullhead-'*'.img' && sudo fastboot reboot-bootloader && sleep 5 && sudo fastboot flash 'radio' ~/'Downloads/bullhead-'*'/radio-bullhead-'*'.img' && sudo fastboot reboot-bootloader
Flash Other
Expects a factory image folder extracted to ~/Downloads
starting with the name bullhead
Expects a image-bullhead
zip archive in that factory image folder
Flashes boot
and vendor
partitions
unar -o ~/'Downloads/bullhead-'* ~/'Downloads/bullhead-'*'/image-bullhead-'*'.zip' && sudo fastboot flash 'boot' ~/'Downloads/bullhead-'*'/image-bullhead-'*'/boot.img' && sudo fastboot flash 'vendor' ~/'Downloads/bullhead-'*'/image-bullhead-'*'/vendor.img' && sudo fastboot reboot-bootloader
Ideal Stack
Flash Order
Boot to Recovery
ROM
Reboot to Recovery
Advanced Wipe → Erase everything except System, format Data and Cache to ext4
Reboot to Recovery
FrancoKernel
Balanced StereoSound & StereoRecord patch
Reboot to System
TWRP
FrancoKernel
Balanced StereoSound & StereoRecord patch
LineageOS
ROM
APN
Delete Straight Talk APN profile
Select T-Mobile US LTE from new list of APNs
Last tested as of 2018/04/11, this provides VoLTE, Wifi Calling, and allows tethering without having to add dun
APN type
Apps
F-Droid
Install
wget -O ~/'Downloads/FDroid.apk' 'https://f-droid.org/FDroid.apk' && adb install ~/'Downloads/FDroid.apk' && adb shell 'sync' && rm -fv ~/'Downloads/FDroid.apk' && sync
Apps
Yalp Store
Disabled Apps
Firefox Klar
StartPage
adb shell input text "https://www.startpage.com/do/dsearch?query=%s"
https://www.startpage.com/do/dsearch?query=%s
DAVdroid
adb shell input text "https://posteo.de:8443/"
https://posteo.de:8443/