Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] [HELP] AOSP exfat/ntfs/ext4 OTG support ported from CyanogenMOD

OP bitdomo

21st August 2014, 08:14 PM   |  #1  
OP Senior Member
Flag Göd
Thanks Meter: 717
 
1,148 posts
Join Date:Joined: Nov 2011
More
I started my little own project to port exfat, ntfs and ext4 read-write support for OTG storage devices from CM to AOSP.
It was fun to discover how git works and understand how a little portion of the android system works.
Eventually, I was able to port it to AOSP, but I still have some questions and I have to admit there are still huge black holes in my mind about the soruce code. That's why I want ask you to tell me what I did wrong, what was unnecessary, what else I still have to add or modofy and why.

My source code based on AOSP kitkat-mr2.1-release branch.

I added Add support for USB OTG and HACK: Disable secure discard commits to device/lgehammerhead.
Question 1: HACK: Disable secure discard is a fix for when I select "Erase USB storage" in Settings/Storage to not take too long?

I added Make "SD Card removed" notification dismissible commit to frameworks/base

I added Dont show "Erase SD Card" when there is none commit to packages/apps/Settings

I added blkid: Add support for probing exFAT commit to external/e2fsprog

I merged 6 commits into one commit and added it to external/sepolicy. You will find the links for merged commits in the commit I made.
Question 2: I think, I dont need the changes about ASEC containers, because if I understand right these ASEC commits for phones which has support for installing apps to sdcard. Am I right?

Question 3: I was in trouble with system/vold. There were so much commits made by CM. It is beyond my knowledge to decide which commit I need for exfat/ntfs/ext4 rw otg support at the moment, therefore I decided to use the CM system/vold instead of the AOSP one, and fixed a build error. Is that okay or should I find the commits for the ntfs/exfat/ext4 rw otg support?
Question 4: Is it okay to solve that above mentioned build error that way or should I resolve the conflict with the selinux_android_restorecon funciton in external/libselinux/src/android.c (CM version)

I added Add libminshacrypt static lib commit to system/core to fix a lib dependancy needed by something from system/vold.

I added the repos of the exfat, ntfs and fuse sources from CM to my manifest and also made it github compatible and added the modified repos.

I added the exfat/ntfs modules to build
After some testing it tunred out I cannot format pendrives formated as NTFS or ext4 because the binaries (mkntfs and mke2fs) were missing qhich could format the storage device to ntfs or ext4. Luckily the modules already have been declared in their Android.mk files so I just had to add that two modules mkntfs and mke2fs.

I am sorry if something is confusing or not understandable. I am really at the begining of programing android.

Also here is a build the AOSP rom with exfat/ntfs/ext4 rw otg support. You have to flash it in fastboot, because the zip packages has recovery.img which will overwrite your recovery during flashing. Just extract it then fastboot flash system system.img then fastboot flash boot boot.img and do a factory reset.
21st August 2014, 11:20 PM   |  #2  
beekay201's Avatar
Senior Member
Thanks Meter: 1,143
 
4,753 posts
Join Date:Joined: Nov 2010
More
Quote:
Originally Posted by bitdomo

I started my little own project to port exfat, ntfs and ext4 read-write support for OTG storage devices from CM to AOSP.
It was fun to discover how git works and understand how a little portion of the android system works.
Eventually, I was able to port it to AOSP, but I still have some questions and I have to admit there are still huge black holes in my mind about the soruce code. That's why I want ask you to tell me what I did wrong, what was unnecessary, what else I still have to add or modofy and why.

My source code based on AOSP kitkat-mr2.1-release branch.

I added Add support for USB OTG and HACK: Disable secure discard commits to device/lgehammerhead.
Question 1: HACK: Disable secure discard is a fix for when I select "Erase USB storage" in Settings/Storage to not take too long?

I added Make "SD Card removed" notification dismissible commit to frameworks/base

I added Dont show "Erase SD Card" when there is none commit to packages/apps/Settings

I added blkid: Add support for probing exFAT commit to external/e2fsprog

I merged 6 commits into one commit and added it to external/sepolicy. You will find the links for merged commits in the commit I made.
Question 2: I think, I dont need the changes about ASEC containers, because if I understand right these ASEC commits for phones which has support for installing apps to sdcard. Am I right?

Question 3: I was in trouble with system/vold. There were so much commits made by CM. It is beyond my knowledge to decide which commit I need for exfat/ntfs/ext4 rw otg support at the moment, therefore I decided to use the CM system/vold instead of the AOSP one, and fixed a build error. Is that okay or should I find the commits for the ntfs/exfat/ext4 rw otg support?
Question 4: Is it okay to solve that above mentioned build error that way or should I resolve the conflict with the selinux_android_restorecon funciton in external/libselinux/src/android.c (CM version)

I added Add libminshacrypt static lib commit to system/core to fix a lib dependancy needed by something from system/vold.

I added the repos of the exfat, ntfs and fuse sources from CM to my manifest and also made it github compatible and added the modified repos.

I added the exfat/ntfs modules to build
After some testing it tunred out I cannot format pendrives formated as NTFS or ext4 because the binaries (mkntfs and mke2fs) were missing qhich could format the storage device to ntfs or ext4. Luckily the modules already have been declared in their Android.mk files so I just had to add that two modules mkntfs and mke2fs.

I am sorry if something is confusing or not understandable. I am really at the begining of programing android.

Also here is a build the AOSP rom with exfat/ntfs/ext4 rw otg support. You have to flash it in fastboot, because the zip packages has recovery.img which will overwrite your recovery during flashing. Just extract it then fastboot flash system system.img then fastboot flash boot boot.img and do a factory reset.


1- Seems like it. Don't think you need "Dont show "Erase SD Card" when there is none" on the N5 though.
2- Yup, ASEC installs on external sdcards for devices which don't have sufficient internal storage.
3- Beyond my knowledge.
4- In my experience it's always best to solve stuff, not just remove stuff.

Let me get back to you, have something nice at home to do something about that recovery being included in the OTA package.

Meanwhile, after the zip is done, just unzip it somewhere, remove recovery.img and the line which calls it on the updater-script. Then people can flash it without fear of overwriting their installed recovery.
The Following User Says Thank You to beekay201 For This Useful Post: [ View ]
23rd August 2014, 10:41 PM   |  #3  
beekay201's Avatar
Senior Member
Thanks Meter: 1,143
 
4,753 posts
Join Date:Joined: Nov 2010
More
I was outdoors today man. Didn't forget, just that I went skating all day.
24th August 2014, 05:39 PM   |  #4  
OP Senior Member
Flag Göd
Thanks Meter: 717
 
1,148 posts
Join Date:Joined: Nov 2011
More
Quote:
Originally Posted by beekay201

I was outdoors today man. Didn't forget, just that I went skating all day.

I spent my last three days on a vacation.
That is why I haven't responded yet.
Thank you for your advice. I was able to modify ota_from_target_files in the build repo's tools/releasetools folder to not include the recovery in the zip and the commands for the recovery in the updater script. I will report you in 2-3 day about my progress and maybe I will ask you a few more questions if it does not bother you.
Post Reply Subscribe to Thread

Tags
exfat rw, ntfs rw
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes