Encryption of the SD Card - Desire General

Hi,
the sd-card backup question posted yesterday has brought back a question, which I had posted some days ago in another formum already (Android Development and Hacking > Android Software and Hacking General: http://forum.xda-developers.com/showthread.php?t=661724 ) Perhaps that forum was the wrong place to post.
HTC's description of the auto backup functionality (not in the manual, I think) indicates that the backup information will be encrypted to the effect that it can be read in the original device only.
Has somebody in this forum an idea what app to use or trick to encrypt the (information on the) sd card, perhaps even in such fashion, that the sd card is legible in the original device only, like HTC's backup?
Thank you in advance!

Push for implementating it in Android:
Using dm-crypt to Encrypt the SD Card...? - xda-developers
Using dm-crypt to Encrypt the SD Card...? - CyanogenMod Forum
Issue 11211 - android - Android too insecure - Encryption of the SDcard is crucial - Project Hosting on Google Code
Issue 3748 - android - Add support for partition/block device encryption - Project Hosting on Google Code

Related

[Android ROM Dictionary] Newbe Friendly

I TOOK IT HERE
Android ROM and rooting dictionary: all the terms explained​
Android is a Linux-based operating system, and in Linux, there is something called root access. When you root your Android phone, you will get superuser access. It’s sort of like a special user account for system administration.
With root access, you have complete control over your phone’s operating system. It will let you install lots of great system apps, such as backup tools, that only are available to root users, and you’ll have the option to flash themes and custom Android ROMs. You can look at custom ROMs as different editions of the Android platform, and when you flash a new ROM, you install someone’s vision of Android.
For example, when I bought the HTC Desire in April 2010, I initially used the stock HTC firmware for a couple of months, which basically is HTC’s customized version of Android. Then I got bored with it, and I started using a ROM called MIUI by a group of Chinese developers. It added a lot of functionality and had a unique UI design. Then I got curious of HTC’s new device Desire HD, and I flashed a custom ROM that was based on the firmware of that phone. And when Android 2.3 Gingerbread arrived, I started using a virtually unmodified version of Android – Google’s vision of it.
In other words, when you have root access, you can use your phone as a hardware shell that you simply can put new versions of the Android operating system into. This post won’t discuss how to get root access, but it will try to explain all the funny words that you will encounter when reading about custom ROMs in forums such as xda-developers. There is an entire terminology surrounding Android ROMs and rooting, and these words sound like complete gibberish when you’re not used to them.
So I’ve tried to write a rooting dictionary that explains the most common superuser and Android ROM terms. I’m no expert, so please correct me in the comments if I’m wrong, and feel free to suggest additional words to include in this root access and ROM dictionary.
Android ROM and rooting dictionary
A2SD+​
A2SD+ is an extension of Android 2.2 Froyo’s native support for installing apps on the SD card, but it virtually installs every app to the external storage. You can more or less expand your internal storage with the size of the partition you create on your memory card — because you need to partition your SD card to use A2SD+. It’s great if your Android phone has a limited amount of internal storage space. Most Android ROMs have built-in support for A2SD+.
AOSP​
AOSP is short for Android Open Source Project, and when the term is used in ROM descriptions, it usually indicates that the ROM in question is based on the Android source code provided by Google itself, and not on some other ROM project or a company’s firmware.
Bootloader​
The bootloader executes code before any operating system is launched. On Android devices, the bootloader is usually locked because manufacturers want you to use the version of Android they’ve provided. With a locked bootloader on Android phones, custom ROMs cannot be flashed.
BusyBox​
BusyBox is an app on your phone that will give you access to additional Linux/Unix based commands. You may need BusyBox installed to perform some root level tasks, and some other apps that require root access may need BusyBox installed as well. BusyBox is self-dubbed “The Swiss Army Knife of Embedded Linux.”
ClockworkMod Recovery​
I won’t get very technical here, because I can’t, but you can think of the Recovery Mode as Android’s equivalent of the BIOS on your computer. Not quite, since Hboot may be more similar to your PC’s BIOS, but you get the picture. It’s a boot menu that is shown without Android being loaded, and it gives you access to certain features such as doing complete backups of your phone (Nandroid backups) and installing custom ROMs. ClockworkMod is the most popular Recovery Mode, and it’s installed with the app ROM Manager.
CyanogenMod or CM​
CyanogenMod, often abbreviated CM, is a custom version of vanilla (more or less unmodified) Android. It’s the most popular custom ROM for Android – a community effort, and many other ROMs are based on CyanogenMod. Among other things, it adds a bunch of extra customization features and options.
Dalvik & Dalvik cache​
Dalvik is the cryptic name of the virtual machine (VM) in Android, and it’s the basis for running apps (with the .apk filename extension) on the platform. Before Android apps are launched, they’re converted into the compact Dalvik Executable (.dex) format, which is designed to be suitable for systems that are constrained in terms of memory and processor speed. Dalvik was originally written by Dan Bornstein, who named it after the fishing village of Dalvík in Eyjafjörður, Iceland, where some of his ancestors lived.
The Dalvik cache is a simply the cache used by Dalvik, and it’s the result of Dalvik doing optimizations of running apps. Some Android ROMs allow you to move the Dalvik cache to your SD card, in order to free up internal storage.
Data2SD / D2EXT / D2SD​
If a ROM supports data2SD, D2EXT, or simply D2SD, it means that the /data folder on your Android phone’s internal storage can be moved to your memory card instead. That’s a good thing, because it will free up precious internal megabytes and leave more room for apps and games. Some say that having the data stored on your SD card is slightly slower, though.
D2ext is a short way of saying “data to the extended file system”. It requires that you have created a partition on your SD card.
Deodexed​
The term “deodexed” has been mocking me ever since I rooted my first Android phone. What the frak does it mean, exactly? Well, it’s probably the hardest term to explain in this rooting dictionary, but I’ll do my best.
Apparently, when a ROM has been deodexed, it means that its apps have been prepared so they can be modified. Deodexed ROMs feature apps that have been repackaged in a certain way. Android applications, .APKs, contain .odex files that devs supposedly use to save space. These .odex files are extracted from the application packages and put in the /system/ folder on your phone, to speed up boot processes and to allow parts of applications to be preloaded.
However, this makes hacking and modifying those apps difficult because parts of the apps have been extracted to another location. Deodexing means that all pieces of an application package are put back together into one file, and it makes sure that a modified .APK won’t conflict with some separate odexed parts located somewhere else. Developers of custom ROMs choose to deodex their ROM packages, since it lets them modify various .APKs, and it also makes theming possible after the ROMs have been installed.
DSPManager​
This is an equalizer app that Android devs like to include in their ROMs.
EXT2/3/4​
This refers to ext2, ext3, and ext4 partitions on your SD card. They’re extended file systems for Linux that can be used by Android, usually in order to preserve internal storage space. Many custom Android ROMs require that you have an ext2, ext3 or ext4 partition on your memory card. Ext2 is the oldest type of extended file system, and ext4 is the newest. Some say that ext4 will put an unnecessary strain on your memory card, because it writes to it so much, and I think the ext3 file system currently is most common. To use one of these file systems, you need to create a special partition on your SD card with ROM Manager or GParted.
So what exactly is a partition? It’s a part of a hard disk, or a SD card in this case, that’s separated from the other parts. Think of partitioning as dividing your SD card into two sections that have different purposes.
Fastboot​
Please correct me if I’m wrong, but fastboot is essentially a boot menu that you can do stuff from before Android is launched. On the HTC Desire, you can access it by turning off the device and simultaneously pressing the Power button and the Volume down button. From this menu, you can choose to boot into Recovery Mode, and more. I’ve also seen this technical (and likely more accurate) explanation: “Fastboot is a protocol used to directly update the flash file system in Android devices from a host over USB.”
Firmware​
A phone’s firmware is basically its operating system. A “firmware update” means that the operating system, the software that controls the phone, is updated. “Stock firmware” means that the firmware is unmodified: it’s the version of the operating system the phone’s manufacturer delivers.
Flash and flashing​
To flash a custom ROM, or a firmware, simply means that you install it. So, flashing is the process of installing a new version of the Android operating system, or just parts of it, like the radio. Flashing new ROMs is done via the Recovery Mode, usually with ClockworkMod Recovery.
HBoot​
HBoot is loaded immediately when your phone is switched on, and it’s mainly responsible for checking and initializing the hardware and starting the phone’s software. It can also be used for flashing official software releases, as well as a few other things. HBoot can be compared to the BIOS on a computer.
IME​
Input Method Editor (soft keyboard)
[Thanks to Hayden4018]
IMEI​
International Mobile Equipment Identity. which you can get by by typing *#06# (works for Galaxy S)
[Thanks to turnado]
Kernel​
The kernel is the central component of most operating systems: it’s a bridge between applications and the actual data processing done at the hardware level. The Linux kernel was initially created by legendary Finnish computer science student Linus Torvalds in 1991. Android kernels are often customized, optimized and modified for different purposes, such as over-clocking the processor or extending the battery life. Custom ROMs usually include a new kernel.
Linux​
Linux refers to the family of Unix-like computer operating systems that use the Linux kernel. The name “Linux” comes from the Linux kernel, originally written in 1991 by Linus Torvalds. Android is a Linux-based mobile operating system.
MIUI ROM​
MIUI is a heavily customized version of Android 2.2 from a team of Chinese developers, and it made a splash in the Android blogosphere back in September 2010. MIUI takes the best parts of Froyo, Samsung’s TouchWiz interface and iOS, and transforms the various elements into something quite unique that has managed to make many people excited. A lot of developers have released their own versions of MIUI, and the ROM is available for many different devices. Besides the official website (in Chinese), there’s a forum dedicated to MIUI at miui-dev.com.
NANDroid & NANDroid backups​
NANDroid will let anyone with root access make a complete system backup. It lets you create a backup of every piece of information on your phone, and it can be restored later whenever you want. NANDroid backups are usually performed before flashing a new ROM, in case anything goes wrong, or if you want to return to your previous setup later. NANDroid backups are created from the Recovery Mode, often with ClockworkMod Recovery.
Odexed​
See deodexed.
Radio​
OK, so this is not the radio you’re listening to your favorite stations with. It’s the radio on your phone that handles communication, the radio that sends and receives voice and data. Flashing (installing) a new radio can improve your reception, and bring other benefits. A radio is flashed via Recovery Mode, just as a full Android ROM.
Radio interface layer (RIL)​
Android provides a Radio Interface Layer (RIL) between Android’s telephony services and the radio hardware. Developers and enthusiasts enjoy messing around with every part of Android, and some of them modify the RIL, just like Android itself, the kernel and the radio, to make it better.
RC1, RC2 et cetera​
When it comes to Android ROMs, RC means Release Candidate. It’s a candidate for the final release of a ROM, and they can be considered ROM betas.
Recovery Mode​
As explained under ClockworkMod, the Recovery Mode is a menu that you can boot into that lets you perform complete backups of your phone (Nandroid backups), install custom ROMs and more. ClockworkMod is a very popular Recovery Mode, and you can get it via the app ROM Manager below.
ROM Manager​
ROM Manager is an immensely popular app for root users, and it lets you flash ClockworkMod Recovery, install ROMs from your SD card, perform backups and even download new ROMs over-the-air.
Root​
When someone mentions root, it usually just refers to having root access on an Android phone – also called being a root user, or a superuser. Root access is explained under superuser, and in the introduction to this dictionary.
S-OFF (security off)​
On the HTC Desire and several other HTC Android phones, the company has implemented a form of “security.” It’s called @secuflag, and it controls whether your phone has its NAND or flash unlocked. S-ON (security on) will read-lock your /system and /recovery partitions, blocking you from performing certain root level actions directly from Android.
You can disable this security measure with S-OFF (security off), although you risk bricking your phone in the process (worst case scenario).
SetCPU​
This is a popular application for overclocking or underclocking your phone’s processor, making it faster or slower. It may require a special kernel in order to work.
SuperUser​
Android is a Linux-based operating system, and in Linux, there is something called root access. When you root your Android phone, you will get superuser access. The superuser, or root user, is sort of a special user account for system administration. SuperUser is also the name of an app, which lets you grant or deny superuser privileges to other apps.
Terminal and Terminal Emulator​
Terminal Emulator, sometimes just referred to as Terminal, is an app that lets users access Android’s built-in Linux command line shell. The application emulates a Digital Equipment Corporation VT-100 terminal, and it’s mostly useful for programmers and for those with root access. For example, typing this in Terminal Emulator when a2sd is installed will move the Dalvik cache to the SD card:
su (gives the app SuperUser access)
a2sd cachesd (moves the Dalvik cache to the SD card)
Titanium Backup​
Titanium Backup is the best backup tool for root users, since it allows you to backup all your applications as well as their data.
Zipaligned​
Zipalign is a tool that optimizes the way an Android app (.APK) is packaged. It enables Android to interact with the application more efficiently, and in doing so, it has the potential to make the app and the entire Android system much faster. Zipaligned applications are launched more quickly, and they use less amounts of RAM. So, thumbs up for zipaligned Android ROMs.
WWE​
WWE means “World Wide English”, and usually tells that an Android ROM is based on WWE, or World Wide English, firmware.
Thank you very much paul-ac. Very much appreciate your effort in creating this dictionary for helping newbies like me.
Wow, very nice writeup!
Sent from my GT-I9000 using XDA Premium App
thanks a lot it was very helpful
and for IME is it the same as (International Mobile Equipment Identity). which we can get by by typing *#06# on your standby screen.? or not
Nice one. thank you
turnado said:
thanks a lot it was very helpful
and for IME is it the same as (International Mobile Equipment Identity). which we can get by by typing *#06# on your standby screen.? or not
Click to expand...
Click to collapse
That's the IMEI, IME if I'm not mistakin' is Input Method Editor.
Very nice post, thank you. It would have been very useful when I buyed my first android phone.
really nice
Very cool, please keep this updated
Sent from my GT-I9000 using XDA Premium App
Nice copy-paste
galaxysdev said:
Nice copy-paste
Click to expand...
Click to collapse
Yes it is!
xxxxxxxxxx
I just like to ask what WIP means? ive seen it on other forums but i havent found any extraordinary about the rom or something
thanks in advance
fulii said:
I just like to ask what WIP means? ive seen it on other forums but i havent found any extraordinary about the rom or something
thanks in advance
Click to expand...
Click to collapse
work in progress
finally i know what deodexed means
please add modem. thx
BoKKeR said:
please add modem. thx
Click to expand...
Click to collapse
Radio=modem.
Sent from my GT-I9000 using xda premium
What is ETA mean?.
Sent from my GT-I9000 using Tapatalk
THX !

Acer Liquid Mini E310 - Device Storage Low

Hello everyone;
I'm a Acer C4 Liquid Mini E310 Owner and like some other owners; that aquired this device there seems to be a issue with device space.
(Not SD Card Space)
At first i've used this thread to ask some questions; but as i grew in knowledge with this Android device i found some ways to help you guys out.
If you already updated your device to Gingerbread 2.3 (or not); and you feel like you don't have room for your app's then here's what you can do:
Before beginning:
Remember that: YOU ARE RESPONSIBLE for what you'll do. (Don't blame me if something goes wrong)
This worked for me; so i can only assume that every thing will work like charm.
1) Backup everything (Apps; Contacts; Application Data, etc)
2) Be sure that you've saved it to your SD CARD. (/Root/DCIM/...)
3) Turn Off your Device; and remove your SD CARD
4) Press: Camera Button + Vol. Down + Power (Unpress only after you feel your device vibrating; after that it will format your device and Re-Install the Android OS)
5) Set Up your device and Re-install your Apps; recover contacts; etc...
6) (Just for you to check) Go to: Storage Definitions (I don't know if this is how it's called in English) and check your device storage space.
Note: My device wen't from 25/50MB free to 127MB!!!
I believe you may wonder: "What have i done exaclty?"
Answer: By doing these step(s); you've cleaned all the older data (from your previous/older ROM) that was stored in your device.
It's just a full wipe, for more data space you should flash a custom rom like I Scream Sandwick

Using SdExt partition tab 3 7"

Hi everyone.
Been a tab 3 owner for a few weeks now, go it rooted and running seal v3 (very stable IMO) but I'm hitting the low storage issue with apps on internal.
I know you can move apps to sdcard, but my question is can we use anything like darktremor a2sdx or Mount2sd and have a ext4 partition on sdcard and symlink data to sdext?
Many thanks to the person who can solve this, I have done many searches and nothing coming up with a successful answer.
I have a script which will completely swap the mounts at boot - so that the ext partition appears as data and data (internal) appears a ext.....could this be used here?
Sent from my SM-T210R using XDA Free mobile app
Google search is your friend
GlennBrownie said:
Hi everyone.
Been a tab 3 owner for a few weeks now, go it rooted and running seal v3 (very stable IMO) but I'm hitting the low storage issue with apps on internal.
I know you can move apps to sdcard, but my question is can we use anything like darktremor a2sdx or Mount2sd and have a ext4 partition on sdcard and symlink data to sdext?
Many thanks to the person who can solve this, I have done many searches and nothing coming up with a successful answer.
I have a script which will completely swap the mounts at boot - so that the ext partition appears as data and data (internal) appears a ext.....could this be used here?
Sent from my SM-T210R using XDA Free mobile app
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=47082501&postcount=87
http://forum.xda-developers.com/showpost.php?p=52550870&postcount=933
http://forum.xda-developers.com/showpost.php?p=52547938&postcount=931
http://forum.xda-developers.com/showpost.php?p=47099628&postcount=93
less than 1 min searching. buck up. lmfao
if you dont want to search via xda, try putting this into google, "site:forum.xda-developers.com"
EDIT: lets be honest, if you read more about the security features of 4.4+ you'd know why they are moving away from a2sd, and why you should only be linking the folders of /android/data and /obb
mattyyey said:
http://forum.xda-developers.com/showpost.php?p=47082501&postcount=87
http://forum.xda-developers.com/showpost.php?p=52550870&postcount=933
http://forum.xda-developers.com/showpost.php?p=52547938&postcount=931
http://forum.xda-developers.com/showpost.php?p=47099628&postcount=93
less than 1 min searching. buck up. lmfao
if you dont want to search via xda, try putting this into google, "site:forum.xda-developers.com"
EDIT: lets be honest, if you read more about the security features of 4.4+ you'd know why they are moving away from a2sd, and why you should only be linking the folders of /android/data and /obb
Click to expand...
Click to collapse
Well hello there Mattyyey lol.
I've been searching but hadn't found anything I'd class as relevant.
And where may I find the information about security features? Or the names of the features you are referring to? X
Sent from my SM-T210R using XDA Free mobile app
GlennBrownie said:
Well hello there Mattyyey lol.
I've been searching but hadn't found anything I'd class as relevant.
And where may I find the information about security features? Or the names of the features you are referring to? X
Sent from my SM-T210R using XDA Free mobile app
Click to expand...
Click to collapse
use search man! another 1 min google search and im done.
firstly actually read the links. you can use mount 2 sd apparently - hell its only post 87 in the thread of your rom.
https://play.google.com/store/apps/details?id=com.spazedog.mounts2sd
secondly - the security features aren't just for 4.4.2 google has been moving away from using the extsd for app or data storage - as its insecure. just remove the sdcard, and you can find out tons about a person, inc potentially sensitive data (even more so if u use a2sd). It's been going on actually since ICS.... and on android.com is states the new features of KK (sample quote below). google is your friend. I see youve not changed.
Also they've been upgrading the permissions based system relating to accessing the extsd for some time. hence why directory bind no longer works after 4.2.2. That too would probably mean your scripts wont work, unless you update them to the new system.
Security enhancements
SELinux (enforcing mode)
Android 4.4 updates its SELinux configuration from "permissive" to "enforcing." This means potential policy violations within a SELinux domain that has an enforcing policy will be blocked.
Improved cryptographic algorithms
Android has improved its security further by adding support for two more cryptographic algorithms. Elliptic Curve Digital Signature Algorithm (ECDSA) support has been added to the keystore provider improving security of digital signing, applicable to scenarios such as signing of an application or a data connection. The Scrypt key derivation function is implemented to protect the cryptographic keys used for full-disk encryption.
Other enhancements
On multiuser devices, VPNs are now applied per user. This can allow a user to route all network traffic through a VPN without affecting other users on the device. Also, Android now supports FORTIFY_SOURCE level 2, and all code is compiled with those protections. FORTIFY_SOURCE has been enhanced to work with clang.
Click to expand...
Click to collapse
Look just use mount2sd or foldermount, or accept the limitation of device memory.... hardly rocket science.

[REF] LVM Partition Remapping

OK, this thread is going to be a work in progress, intended to serve as a reference for the work I've been doing on LVM partition remapping.
My work was done initially on a Find 7, but this should eventually be usable on many other devices (I have the Find 5 and N1 in mind for when I return from vacation). Also, this would not have been possible without the work Steven676 did years ago on the Nexus S, which has been used by all AOSP-derivative projects to support the Samsung Aries (Galaxy S) family for quite some time now.
The current state of things is that the patches are solid and work very well for the system side of things, but there is still a bit of work needed on the recovery side of things. This is due to TWRP having an architectural limitation I need to work on - Whether a device uses emulated storage or not is set at compile time, which is a problem if your design requires automatic detection of configuration at run time.
One of the key design goals here was to support both normal and LVM configurations automatically with a single build that detects which configuration is present on a device at run time.
A second key design goal was that the underlying partition table of the device is not touched in any way. Touching the partition table of a mobile device in the field is a fundamentally dangerous operation, as many partitions contain data that is device-unique or will render a device unbootable if altered. Recovery methods that involve DDing partition images to nonstandard partitions is asking for trouble due to typos... There's no protection against a user typoing the name of a critical partition.
Initially, I'm going to dump the contents of an email I wrote to someone giving them documentation on how to integrate LVM into their project. Over time I'll clean up and reorganize this post, including adding some more links. Also, since this email was written, I've added a LOT of comments to each patch explaining what is going on.
For additional documentation, especially a more user-oriented view of things (such as how to set this up if you want to use it with Omni nightlies) - see the Omni nightlies thread on XDA.
So here goes:
How it's implemented - the complete patch set is at:
https://gerrit.omnirom.org/#/q/topic:find7_lvm - Expect this to periodically change as work on this feature continues (Note: All patches required to support nightly builds of Omni have been merged. At this point, all remaining work that I expect is on polishing up TWRP.)
With the rest of this post, I'll talk about each individual patch and what it does.
https://gerrit.omnirom.org/#/c/9273/ - This is a patch against frameworks/base which adds an alternative to storage_list.xml called storage_list_lvm.xml - The frameworks will choose storage_list_lvm.xml instead of storage_list.xml if the property ro.lvm_storage is set to 1 - The device init scripts will set this property if they detect an LVM configuration.
https://gerrit.omnirom.org/#/c/9207/ - This is an Omni-specific patch. Omni builds for both the Find 7 and OnePlus One (also known as find7op) and both share a common device tree. The LVM patches do not apply to the find7op, so we move init.recovery.rc out of the msm8974-common tree - You likely don't have to worry about this unless you also have a -common tree for find7 and find7op
https://gerrit.omnirom.org/#/c/9276/ - Normal Android kernel ramdisks do not include busybox or any form of shell, making it impossible to run shell scripts without /system mounted. Since we need to run a shell script prior to mounting partitions, we need to add busybox to the ramdisk. This patch does that. For legal reasons you may wish to replace busybox with system/core/toolbox and system/core/sh - I have not tried doing so. If you choose to stay with busybox, you will have to provide the busybox source code in order to comply with the GPL.
https://gerrit.omnirom.org/#/c/9205/ - This adds the LVM binary and LVM configuration file to the ramdisks of both normal boot and recovery. This patch does not actually begin doing anything with the binaries, I separated it out from the other patches as a way to keep things organized so I could start working with the binaries when I began this project. The original source code and documentation for the binary is at https://github.com/steven676/android-lvm-mod
One change I made in lvm.conf that differs from the Samsung aries family (galaxysmtd, fascinatemtd, captivatemtd, etc.) is that I changed the filter line to only allow the userdata and sdcard partitions. This prevents LVM's vgscan from accidentally determining another partition is a physical volume, and also prevents users from accidentally running pvcreate on a critical partition.
https://gerrit.omnirom.org/#/c/9206/ - This is where all of the "heavy lifting" is done. I'm going to work on adding more comments to the init scripts and shell scripts to document them tonight and tomorrow, but I'll try to explain things here.
Android's init system is a bit limited in that it's very difficult to have conditional behavior defined in init.rc - which appears to be why Qualcomm loves to use shell scripts called from init. Similarly, much of the LVM magic happens in three shell scripts (which execute at three different phases within the boot sequence).
In the early-init phase, the two "wait" blocks ensure that the underlying block devices are ready before vgscan/vgchange are called. This will probably slow down booting by a few fractions of a second unfortunately.
vgscan will scan the volumes defined in lvm.conf (in this case, only the userdata and sdcard partitions) for LVM physical volumes. If LVM physical volumes are detected and form a proper volume group, vgscan will create appropriate device nodes. With the configuration I'm using, the device node will be /dev/lvpool/userdata - which consists of a single logical volume that merges the sdcard and physical userdata physical volumes (partitions). The configuration of lvm.conf prevents LVM commands (especially pvcreate) from altering partitions we don't want to alter. If someone accidentally tries to, for example, run pvcreate on the system partition, it will give an error indicating that the partition was not part of the filter.
vgchange will activate the physical volumes detected by vgscan
lvm_init.sh will check to see if /dev/lvpool/userdata exists, and copy fstab.qcom.lvm to fstab.qcom, init.fs.rc.lvm to init.fs.rc, and twrp.fstab.lvm to twrp.fstab if it does. If it does not, it selects fstab.qcom.std, etc.
In the "on init" section, the init script exports all environment variables from init.fs.rc, and creates all storage-related directories and symlinks needed for both configurations (except for when they conflict). lvm_symlinks.sh will create directories/symlinks that must be configuration-specific. Just like lvm_init.sh - it decides what to do based on whether /dev/lvpool/userdata exists
In the "on fs" section - we do an SELinux restorecon on /dev/mapper/lvpool-userdata (/dev/lvpool/userdata would probably work here too). If it doesn't exist, this will fail gracefully without causing any issues.
In "on early-boot" - lvm_setprop.sh uses /system/bin/setprop to set ro.lvm_storage to 0 or 1 depending on the detected configuration. The property service is not available until early-boot - so this cannot be in lvm_init.sh or lvm_symlinks.sh This propery is used by the frameworks/base patch above to determine which storage_list to choose.
At the end of the init.qcom.rc, the fuse daemon for emulated storage is added for all configurations. (I could not figure out a good way to make this conditional based on whether LVM was present or not). In a non-LVM configuration, it runs but is harmless - it maps /data/media (which is empty) to /mnt/shell/emulated (which nothing is looking at due to the environment variables and symlinks set in the "on init" section )
You will probably notice that Omni's standard storage configuration is fairly different from ColorOS - this is due to the way KitKat storage works, but it allowed us to get away without using Oppo's ext4 permissions hacks in our kernel (by remapping permissions instead, in a manner similar to how the emulated storage system works) The way we handle our /sdcard partition does interoperate without issues with the ColorOS approach.
https://gerrit.omnirom.org/#/c/9279/ is a patch specifically for TWRP. TWRP currently determines whether to use emulated storage (/sdcard on /data/media) at build time instead of at run time. Until I have time to fix this, the patch here operates as a workaround. It is similar to the behavior of the fuse sdcard daemon in the previous patch - it maps /data/media to /sdcard whether the configuration is actually emulated storage or not. If the device is not using emulated storage (LVM), mapping of /data/media to /sdcard is still mostly harmless. However it does result in undesirable changes to TWRP's user interface. DO NOT USE THIS APPROACH IN PRODUCTION RELEASES. It's a horrible hack. You'll need to figure out how to properly do /data/media handling depending on whether LVM is present or not based on how your own recovery architecture works.
https://gerrit.omnirom.org/#/c/9281/ adds "raw" sdcard and userdata partition entries to the partition table for the LVM configuration. This allows a user to return their device to a standard configuration by formatting the underlying sdcard and userdata partitions directly, instead of the removelvm ZIP at the beginning of this email. - To be abandoned, this patch was squashed into 9206
FAQ
Q: Coldbird already had repartitioning support. Why did you create this different approach?
A: Even before he started work, I strongly recommended that he not touch the partition table of the device. It's a really bad idea and is fundamentally dangerous. It's pure luck that someone hasn't hardbricked yet. (A number of people have come close.) If you read through his thread and the ColorOS 2.0.2 thread, you'll see that the repartitioning approach fails frequently, and in multiple ways. (Missing partition contents, partition table ending early, etc. The latter is really scary, one person had the process fail at mmcblk0p19 - what if someone else's partition table write operation aborted even earlier?.) Also, nearly everyone that has implemented support for that approach has needed a separate build to support it. (Oppo is the first to manage autodetection.) I also provided him all of the reference information from Steven676's work.
LVM is far safer. The underlying partition table is not touched in any way. Instead, LVM remaps sectors on the fly so that two partitions that are not adjacent to each other on the physical storage appear as a single contiguous partition to the filesystem drivers. Linux has supported LVM for on the order of a decade, if not more. I've been using LVM on my file server since 2006. (Yes, the system is 8 years old and still working other than needing a new power supply after a thunderstorm. Nothing to do with LVM. ) In addition, the lvm.conf configuration used here provides protection against accidental typos causing damage. Undoing the changes is as simple as doing a wipe of /data and /sdcard from any standard recovery and can be done in seconds, not of running a special batch file that runs a bunch of fastboot commands and takes 4-5 minutes. Similarly, the LVM setup process currently described in the Omni thread involves flashing a single ZIP from recovery that takes only 10-15 seconds, and most of that process is flashing an LVM-aware recovery. (The only limitation currently is that the ZIP must be on external storage - USB OTG or MicroSD)
To put it simply, it Just Works. No need to back up a pile of partitions other than /data and /sdcard because those partitions are never touched or altered.
Q: I have a device with a ridiculously oversized /system partition, can I get some of that back for /data?
A: Yes, you can. Add the physical /system partition to the lvm.conf filters and add it to the lvpool when creating it, then create a smaller /system LV out of this big pool. (see updater.sh in device/samsung/aries-common/ of any AOSP-derivative for hints here.) Be careful though - leave enough spare space for growth (new Android versions, etc.) While it should be possible to use some of the LVM tools along with ext4 resize tools to reorganize the LVs without wiping, this is very difficult and you'll probably have to make users wipe /data if you want to alter /system.
*reserved 2*
Nice work, I hope all the patches can be widely used on some other devices and other roms.
systop said:
Nice work, I hope all the patches can be widely used on some other devices and other roms.
Click to expand...
Click to collapse
Yup. I know Andre from PA was working on it last week but I haven't heard from him lately.
My priority when I return from vacation will be fixing up the TWRP side of things. It's working for now, but the user interface on non-LVM configs is a little funky thanks to RECOVERY_SDCARD_ON_DATA being compile time. This has never been a problem before since a single TWRP binary never had to support two different configurations before. I plan on either doing a property-based approach or fstab-based like CWM. (It should be possible for someone to make a CWM build that automatically detects configuration without any modifications to CWM, based on reading the code - but I haven't tried it myself.)
Once TWRP is in better shape, I plan on doing the Find 5 and N1. These will have the challenge of not having a MicroSD slot, so I may have to change TWRP so that it use /tmp instead of /sdcard when doing "adb sideload", or at least gives the user that option.
Good stuff :good: I don't really need it as of yet, but when my new device is provided (warranty) I will surely give this a try.
I hope ayysir will merge the LVM support very soon ^^
Find 7u PA 4.6 beta 1
Awesome work mate. I have avoided other methods because I'm always the guy that will have a device fail at very bad timing; like during boatloader or SBL stage.
I'm really glad you have continued to work on this. I have hit thanks a few times but would also like to thank you here
tork987 said:
I hope ayysir will merge the LVM support very soon ^^
Find 7u PA 4.6 beta 1
Click to expand...
Click to collapse
He had issues with merging support, hopefully now that I've added more documentation he can try again.
how are the *.std files created?
atm this is tough for me to port from omni to cm base which AOSPA Oppo trees
ayysir said:
how are the *.std files created?
atm this is tough for me to port from omni to cm base which AOSPA Oppo trees
Click to expand...
Click to collapse
the std files are also part of the device tree
https://github.com/omnirom/android_device_oppo_find7/tree/android-4.4/configs
ayysir said:
how are the *.std files created?
atm this is tough for me to port from omni to cm base which AOSPA Oppo trees
Click to expand...
Click to collapse
For the fstabs - they are simply moves/renames of the fstab files and other storage-related items from the standard Oppo configuration (they should appear as renames/moves in the Gerrit commit...)
For the init.fs.rc file - all of the "export <blah>_STORAGE" lines from init.qcom.rc/init.find7.rc are cut out of the RC file and put into .std
Obviously, the .lvm versions of the files are the ones where the fstab has been altered to support a single data partition with emulated storage.
Amazing work and amazing posts. Thanks a lot for your sharing. ?
I've got a question related to your configuration (/data and /sdcard merged) : are the LV hot-resizables?
Wendigogo said:
Amazing work and amazing posts. Thanks a lot for your sharing. ?
I've got a question related to your configuration (/data and /sdcard merged) : are the LV hot-resizables?
Click to expand...
Click to collapse
In theory, you could probably use some of the ext4 resizing tools to do something like this, but I haven't looked into it as there isn't much point in the current config (since the LVM userdata volume is allocated to use all space on the volume group).
Something like that might be more useful if someone ever uses LVM to regain some of the wasted /system partition space on certain excessively bloated devices (like some GS4 units).
Entropy512 said:
In theory, you could probably use some of the ext4 resizing tools to do something like this, but I haven't looked into it as there isn't much point in the current config (since the LVM userdata volume is allocated to use all space on the volume group).
Something like that might be more useful if someone ever uses LVM to regain some of the wasted /system partition space on certain excessively bloated devices (like some GS4 units).
Click to expand...
Click to collapse
Thanks for your answer.
Seems I misunderstood the way it's implemented here. All space is allocated to /data? So there's no more internal sdcard right?
But in that case an external sdcard is mandatory. How is it managed when there's no sdcard?
Enjoy!
Wendigogo said:
Thanks for your answer.
Seems I misunderstood the way it's implemented here. All space is allocated to /data? So there's no more internal sdcard right?
But in that case an external sdcard is mandatory. How is it managed when there's no sdcard?
Enjoy!
Click to expand...
Click to collapse
Android has supported emulated storage (where /data/media is mapped to /sdcard with a special FUSE daemon that makes /sdcard have DOS-like permissions despite an underlying ext4 partition) since ICS. It's pretty much the standard in all new devices - the Find 7 is to my knowledge the only device launched in 2014 not to use emulated storage. Most devices in 2013 also did - Oppos were again the rare exception.
As I understand it - for some reason Chinese users prefer the legacy pre-ICS partitioning scheme. My guess is due to UMS vs. MTP - MTP is required for access to emulated storage, UMS can't be used, but a lot of older desktop OSes have issues with MTP. So Oppo finds themselves in conflict between their home market (China) and expanding in the West. That said, the Find 7 was kind of a screwup in achieving this goal, since the internal sdcard partition was ext4 which meant UMS was a no-go for it.
Entropy512 said:
Android has supported emulated storage (where /data/media is mapped to /sdcard with a special FUSE daemon that makes /sdcard have DOS-like permissions despite an underlying ext4 partition) since ICS. It's pretty much the standard in all new devices - the Find 7 is to my knowledge the only device launched in 2014 not to use emulated storage. Most devices in 2013 also did - Oppos were again the rare exception.
As I understand it - for some reason Chinese users prefer the legacy pre-ICS partitioning scheme. My guess is due to UMS vs. MTP - MTP is required for access to emulated storage, UMS can't be used, but a lot of older desktop OSes have issues with MTP. So Oppo finds themselves in conflict between their home market (China) and expanding in the West. That said, the Find 7 was kind of a screwup in achieving this goal, since the internal sdcard partition was ext4 which meant UMS was a no-go for it.
Click to expand...
Click to collapse
I've got it now. Thanks for your explanations
I saw that Oppo phones didn't follow Android guidelines (yet?) by not using the emulated_storage mounting method but I didn't know why.
And your right, mtp doesn't work in Windows XP (or is hard to make working) and there's a lot of Asian people still using it. Obvious once you said it...
And that's also why only external sdcard is accessible in UMS mode in recovery.
Thanks again for your enlightenment. ?
Reading some of the comments on G+ it looks like Oppo might be using this solution for their KitKat release. I would be so pleased if they did.
Sent from my X9076 using Tapatalk
kishd said:
Reading some of the comments on G+ it looks like Oppo might be using this solution for their KitKat release. I would be so pleased if they did.
Sent from my X9076 using Tapatalk
Click to expand...
Click to collapse
You could be pleased...
Wendigogo said:
You could be pleased...
Click to expand...
Click to collapse
Had some problems with camera focus on earlier versions of omnirom for find 7. Now those have been addressed. I installed Omni and am on the nightlies with lvm. My find 7 and find 7a will not see another rom again.

How to be able to write files to the MicroSD card on S3 Neo I9301I

Hi,
While i was looking on how to fix the ability to write to the sd card on my Galaxy SIII Neo Android 4.4.2 KitKat,
i found this wonderful app on Google play to fix this issue..
​ SDFix: KitKat Writable MicroSD
(REQUIRES ROOT ACCESS)
it's easy and simple but on your own risk
it works for me
i dont know if there is another posts about this app, but let others know for general benefit
_______________
Thanks? Maybe?!!
Amirstars said:
Hi,
While i was looking on how to fix the ability to write to the sd card on my Galaxy SIII Neo Android 4.4.2 KitKat,
i found this wonderful app on Google play to fix this issue..
​ SDFix: KitKat Writable MicroSD
(REQUIRES ROOT ACCESS)
it's easy and simple but on your own risk
it works for me
i dont know if there is another posts about this app, but let others know for general benefit
_______________
Thanks? Maybe?!!
Click to expand...
Click to collapse
I have I9300I on kitkat but have not encountered SD card writing problem. Please explain what the writing problem is. I can do create new folder,create file. copy file etc. on mine....
muntinlupa said:
I have I9300I on kitkat but have not encountered SD card writing problem. Please explain what the writing problem is. I can do create new folder,create file. copy file etc. on mine....
Click to expand...
Click to collapse
------------''-''--------------
And i quote
--------------------------------------
[ About MicroSD Cards in Android 4.4 / KitKat ]
When Google released Android 4.4, they specified that applications you download can no longer write to user-installed MicroSD cards. Apps can still write to internal flash storage. Some devices (like Google Nexus devices) only have internal storage, and are unaffected. Other devices (e.g. Samsung Galaxy and Note devices) have the ability to expand their storage space by installing a MicroSD card. When KitKat is installed on such devices, apps are limited to only being able to manipulate files on the built-in storage, with write-access to the MicroSD card being restricted.
This change represents a removal of functionality compared with Android 4.3. 4.3 allowed apps to write to the MicroSD card, as did prior versions.
The limitation introduced in KitKat does not affect the capabilities of preinstalled apps, only apps you choose to install. Apps preinstalled by Google, your device manufacturer, and your carrier still have this ability. Only apps that you choose to install are restricted.
[ Technical Details ]
NextApp SDFix will modify the configuration file located at /system/etc/permissions/platform.xml to allow apps to write to the MicroSD card. Specifically, SDFix will add the Android UNIX group "media_rw" to the WRITE_EXTERNAL_STORAGE permission's configuration. This will enable apps (only those that you granted write access permissions to when you installed them) to write files to the MicroSD card. On many devices, this is effectively reverting the state of this permission back to the way it was configured in Android 4.3. This modification is carried out by modifying the existing XML file, rather than replacing it.
A backup of the original configuration file will be saved at /system/etc/permissions/platform.xml.original-pre-sdfix (provided one does not already exist). Reverting this modification can be accomplished by using a root -enabled file manager to replace the /system/etc/permissions/platform.xml file with the backed up version.
Sent from my GT-I9301I using XDA Free mobile app

Categories

Resources