Jump to content


Photo

Q&A regarding gellmar's notes on E400 development

- - - - -

  • Please log in to reply
85 replies to this topic

#1
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus
Do you think it's possible to join two consecutive partitions mmcblk0p20 and mmcblk0p21 in one mounted to /data? I think that i'd be a good idea to have 1GB for apps and leave the microsd slot for "external" /sdcard storage. I did it before myself without joining it (i did with dirty init.rc scripts) because i was scared of bricking my device if i change the number of partitions.

  • 0
There is no place like 127.0.0.1

#2
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
I had such idea long ago, but I need to explore the bootloader code. Maybe we should leave number of partitions intact but the size of /data is to be adjusted to a bare possible minimum ext4 allows.

  • 0

#3
viking_kong

viking_kong

    Newbie

  • Members
  • Pip
  • 31 posts
  • Devices:LG Optimus L3
wow!new development is here.uhm,can i request something about cm9?what i hate about cm9 is the unstable battery percentage.when you reboot or turn it off,later when you turn it on again,the battery sometimes increases or decreases like hell.that's so annoying.the battery percentage is really unstable.unlike in stock.you reboot or turn it off and on,the battery level is stable.stays the same or only drops 1%.is there any fix for that issue?i'm starting to love cm9 especially now that the usb mass storage is now working.no need to go to cwm.hehe.thanks!

  • 0

#4
yayakuya

yayakuya

    Enthusiast

  • Members
  • PipPipPip
  • 178 posts
  • Gender:Male
  • Location:Indonesia
  • Devices:Sony Xperia E, HTC Desire VC
is UMS read only int-sd or ext-sd or both???

  • 0

#5
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
yayakuya,both writable. I uploaded movies and music to external card, got screenshots from internal and pushed back a photo for test

  • 0

#6
cryerenable

cryerenable

    Newbie

  • Members
  • Pip
  • 13 posts
  • Devices:LG Optimus L3 (E400)
Maybe u know how made mass_storage in CM9/AOKP....?

  • 0

#7
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
As soon as AOKP is based on CM9 kernel and framework the zip may be suitable for AOKP too.

  • 0

#8
Ygreck

Ygreck

    Regular

  • Members
  • PipPip
  • 133 posts
my AOKP bootloop after installing the zip :P

  • 0

#9
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

I had such idea long ago, but I need to explore the bootloader code. Maybe we should leave number of partitions intact but the size of /data is to be adjusted to a bare possible minimum ext4 allows.


You could format the 1GB partition as EXT4 and mount in init.rc. What i did was:
1. Format 1gb partition to EXT4.
2. Write code for mounting it in init.rc as /data (runs in linux before android core startup)
3. Swap the internal emmc and the external sdcard device in fstab.vold (that makes android core to recognise the 1GB ext partition as secondary external storage and sdcard as primary sdcard that it's what we want)

The third step it's here for avoiding mounting errors in the notification bar. If Android framework detects an error while mounting the primary external storage it will show a error message asking to format the sdcard, also some apps like Gallery, will crash as they're using getExternalStorage() method which returns null if not available, BUT if the mounting error happens on the external storage partition android just ignore it and even don't show anything.

If only we could disable in the kernel the external storage option this dirty fix could be enough to achieve 1 gb of internal storage for apps and sdcard for external.

If you know how to do this in the kernel, i will help you with the rest.

  • 0
There is no place like 127.0.0.1

#10
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
Ygreck, try changing only framework-res but not boot.img

crazybyte, the issue is about vold rather and storage_info.xml inside the framework-res.apk, but let me check your scenario. Can you PM your init.rc?

Here's what I plan to check:

1. The hecatae's swap scenario: format /dev/block/mmcblk0p20 as ext2fs and /dev/block/mmcblk0p21 as vfat, change the mtd@ mapping, leave init.rc intact to get sdcard of 157 MB and /data of 1 GB. This can eliminate the need to patch the kernel / bootloader.

2. If it works (and I think it works), investigate bootloader parts for partition table. If nothing, fdisk /dev/block/mmcblk0 and delete /data/ and /sdcard partitions and make a new one of 1.157 MB ext2fs, then change vold.fstab and recovery.fstab and disable the sd-ext in storage_info.xml and anywhere else (this is your question whether it needs to be disabled inside kernel some way)

About getExternalStorage() mess, it relies on kernel's sdcard mapping - now the mapping shows ext-sd as external, but if there is no ext-sd, the code will return the only sdcard as external, emulating the sdcard-less devices...

I am inspecting kernel sources for mmcblk0 - found in devices documentation and in lge/factory/lge_emmc_direct_access.c

The very interesting file is that direct access stuff... there are some hardcoded offsets for MBR/EBR and the names of all partitions :) I should deep into it and update the /dev/block post first.

Edited by gellmar, 13 March 2013 - 08:51 AM.

  • 0

#11
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus

Ygreck, try changing only framework-res but not boot.img

crazybyte, the issue is about vold rather and storage_info.xml inside the framework-res.apk, but let me check your scenario. Can you PM your init.rc?

Here's what I plan to check:

1. The hecatae's swap scenario: format /dev/block/mmcblk0p20 as ext2fs and /dev/block/mmcblk0p21 as vfat, change the mtd@ mapping, leave init.rc intact to get sdcard of 157 MB and /data of 1 GB. This can eliminate the need to patch the kernel / bootloader.

2. If it works (and I think it works), investigate bootloader parts for partition table. If nothing, fdisk /dev/block/mmcblk0 and delete /data/ and /sdcard partitions and make a new one of 1.157 MB ext2fs, then change vold.fstab and recovery.fstab and disable the sd-ext in storage_info.xml and anywhere else (this is your question whether it needs to be disabled inside kernel some way)

About getExternalStorage() mess, it relies on kernel's sdcard mapping - now the mapping shows ext-sd as external, but if there is no ext-sd, the code will return the only sdcard as external, emulating the sdcard-less devices...

I am inspecting kernel sources for mmcblk0 - found in devices documentation and in lge/factory/lge_emmc_direct_access.c

The very interesting file is that direct access stuff... there are some hardcoded offsets for MBR/EBR and the names of all partitions :) I should deep into it and update the /dev/block post first.



You're forgetting a step. If you change the partition layout you have to rebuild the recovery, otherwise when it will try to mount /data for installing a rom it will fail.

In the other hand what you says about getExternalStorage() it's true, that it's what i said that we have to "remove" the sd-ext option. I forgot a step my init.rc script relies on the previous format in the rom install script of the 1gb partition, saddly i removed the rom because it was unusable on my girlfriend phone because the charger and sudden reboot bugs... That was a pity because i never tought that somebody would fix it. :/

I can ask him to give me the phone leting me to "build" the modded rom again.

PS: Sorry about my English, i'm from Spain, i'm trying to do my best :)

  • 0
There is no place like 127.0.0.1

#12
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
crazybyte, you are right about recovery. But I think I found the routine lge_mmc_scan_partitions with the list. Now trying to get a print from it

  • 0

#13
yayakuya

yayakuya

    Enthusiast

  • Members
  • PipPipPip
  • 178 posts
  • Gender:Male
  • Location:Indonesia
  • Devices:Sony Xperia E, HTC Desire VC

my AOKP bootloop after installing the zip :P


wait a minute, i can't see any zip file here... :/
anyone wanna tell me?

  • 0

#14
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
yayakuya, the e400-charger-mass-encryption from big topic...

  • 0

#15
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus
Watch out about changing the number of partitions(because if we mess the bootloader we will brick the device you already know!), we could do a first approach mounting only the bigger one and leaving the remaining intact.

Edited by crazybyte, 13 March 2013 - 09:26 PM.

  • 0
There is no place like 127.0.0.1

#16
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
crazybyte, the hack works if make a correct combination of vold.fstab + storage_info.xml + build.prop. And of course recovery.fstab and init.rc. Let me show the screenshots.

But I need the dump of stock MBR because I was a dumb :(

su
dd if=/dev/block/mmcblk0 of=/mnt/sdcard/mbr.bin bs=1024 count=100

Attached Files


Edited by gellmar, 13 March 2013 - 09:58 PM.

  • 0

#17
hecatae

hecatae

    Hardcore

  • Moderator Team
  • PipPipPipPipPipPip
  • 3,251 posts
  • Gender:Male
  • Location:northampton
  • Devices:Moto E
Please post any questions regarding E400 development here.

  • 0

#18
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus
That's cool, tomorrow at sunrise i will upload the mbr. Sorry about this but i my girlfriend now have the stock rom and i have to root it and i deleted the drivers from my pc hehe.

EDIT: Backup your MBR maybe it's easier to install in a script this patch. We can add to the install script some steps like 1. DD the new mbr, 2. Reload partition table 3. Format new partitions 4. Mount partitions and install. It should work because the start and the ends of the remaining partitions matches the original.

Edited by crazybyte, 13 March 2013 - 11:24 PM.

  • 0
There is no place like 127.0.0.1

#19
gellmar

gellmar

    Enthusiast

  • Members
  • PipPipPip
  • 189 posts
  • Devices:LG Optimus L3 E400
crazybyte, you are reading my thoughts :D

  • 0

#20
crazybyte

crazybyte

    Newbie

  • Members
  • Pip
  • 46 posts
  • Gender:Male
  • Devices:Galaxy Nexus
Here is the MBR of LG L3 V10N

Attached Files

  • Attached File  mbr.rar   39.61KB   7 downloads

  • 0
There is no place like 127.0.0.1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users