[Android Software/Hacking General [Developers Only]] SnakyJake:
enlarging internal memory

Hi,

playing around with my tablet PMP5080B (Prestigio) I wanted to increase internal memory storage a bit. Not even 256MB are not enough, free maybe around 100MB; always had to move apps to external sd (no preset there to tell android to always put them to the 16GB external sd)

So what I wanted to do: decrease the internal (fake) sd and give some space to the userdata partition.

Sounds quite easy, and it actually is, if you know the hurdles.

Be careful: YOUR DATA WILL BE LOST!

Step 1: adjust the parameters (offset 0x0000, size 0x2000)

so what I did first:

rkflashtool r 0x0 0x2000 >orgparams

...
0x00080000@0x0014a000(userdata),
0x00002000@0x001ca000(kpanic),
-@0x001cc000(user)

The size 0x00080000 is 256MB, 0x00100000 would be 512MB. Change it:

...
0x00100000@0x0014a000(userdata),
0x00002000@0x0024a000(kpanic),
-@0x0024c000(user)

Important: you need to change all following offsets!

To flash back your parameters you need to recalculate the checksum. To do that you will need the tool rkcrc from naobsd. The checksum is only calculated from the datablock, so do the following:

Cut off the first 8 bytes of the file (PARM+4 Byte length, which you should write down - your file should now start with "FIRMWARE"); cut off all after "(user) 0x0d 0x0a" - its the 4-byte checksum.

You now should have a file, around 500-600 Byte in size.

Add the checksum:

rkcrc myparams myparamswithcrc

now re-add the 8 Byte header (PARM+size, where the size actually should not have changed, so you probably can take the old value you wrote down. Else just take the filesize of the naked file before adding the checksum - you need it in HEX and turn around all bytes!)

Now you can flash back your params. On my tablet those parameters are stored every 20 blocks about 5 times (probably for recovery or something)

So I overwrote all 5 blocks like this:

rkflashtool w 0x00 0x20 <myparamswithcrc

rkflashtool w 0x20 0x20 <myparamswithcrc

rkflashtool w 0x40 0x20 <myparamswithcrc

rkflashtool w 0x60 0x20 <myparamswithcrc

rkflashtool w 0x80 0x20 <myparamswithcrc

Now try to boot your device. It should boot up, maybe take 2 or 3 tries and take some longer, since the phone/tablet will re-arrange the partitions and format them.

When started my userdata-partition size had not yet changed. Still 256MB. So we will need to feed him a self-created ext3 512MB file to 0x0014a000.

Here the problems begin.

STEP 2: create a 512MB userdata partition.

To create an ext3 partition you will need to use the tool mke2fs. I thought, I could just take my JoliOS tool, but PC and RK29 seem to deal differently with the journal, so ext3-Tools from PC WILL NOT WORK! Don't even try to mount (userdata) on PC and reflash it. I tried: did not work! Your phone/tablet will recreate the userdata partition in its default size (256MB), since it cannot read it anymore.

Se use the devices mke2fs!

So what I did: (I used adb shell, you can do it with "terminal emulator" on the device)

adb shell (or in terminal emulator)

$ dd if=/dev/zero of=/sdcard/newuserdata bs=1048576 count=512

$ mke2fs /sdcard/newuserdata

(mke2fs will mourn about newuserdata not being a block device, press y for ack and go ahead)

Now get the newly generated 512MB file on your PC

(Easy per adb with "adb pull /sdcard/newuserdata", or just via your sdcard)

Flash it:

rkflashtool w 0x14a000 0x100000 <newuserdata

Boot device. It will take some time, maybe it will hang in a loop. I needed to hardreset it once, after the animation would not stop. The device does a filesystem check and recreates all needed directories within userdata, which may take a while.

After all I had an internal storage of 470MB, which is 512MB minus filesystem data :-)

Probably works with 1GB too, whatever you want. Just use the ext3 tools of your device, not the PC tools.

I have not figured out how to put files in those ext3-filesystems, since I cannot mount them on PC. The reason why I have not figured out how to turn my cramfs-system.img into ext3.

Next try is to mount userdata with ext4 :-) Should work, but you will also need to modify init.rc (boot.img), where the mounts are done.

[EDIT]

There seems to be a more simple method:

Just do the adjustments mentioned in Step1, so edit your params and flash them to the device.

Boot the device (might take long) and go to settings->privace->factory data reset

The device will reformat data and cache, now with the new size :-)

[/EDIT]