[LG Optimus 2x] Stefan Gündhör:
Today I made the first CWM ICS v28E ROM that can (only) be installed on devices with new bootloader + new partitioning layout + CWM.

Update: meanwhile it is v28G! new builds in download folder.

It contains the same ROM as in my thread here: http://xdaforums.com/showthread.php?t=1986097

So it is a VERY clean stock v28G ROM, flashable via CWM for new bootloader. You can download it here:

Location of all my LG ICS CWM ROM versions: http://d-h.st/users/gueste/?fld_id=7336#files

The purpose of this thread is that I would like you to take this CWM Zip as base and easily build your custom ROMs out of it. There is no need to give credits to me in this case, just think about it as a clean base stock ROM you can modify.

Every ROM you make out of this can run on any O2X/P990 with new unlocked ICS bootloader, new partitioning structure and CWM!​

(make sure you do NOT load the NVFlash version, this tutorial covers the CWM versions.)

Let's take a look at the Zip-structure and the updater-script:

(screenshot from v28E CWM zip, but the structure is the same in v28G / latest ICS build)

updater-script:

show_progress(1.000000, 0);
ui_print("- - - - - - - - - - - - - - - - - - - - - - -");
ui_print("- - LGP990_ICS_v28G_Stock_NewBL - -");
ui_print("- - Stefan Guendhoer Nov 2012 - -");
ui_print("- - - - - - - - - - - - - - - - - - - - - - -");
ui_print("");
run_program("/sbin/busybox", "umount", "/data");
run_program("/sbin/busybox", "umount", "/cache");

ui_print("Wiping /cache");
run_program("/sbin/mke2fs", "/dev/block/mmcblk0p2");
run_program("/sbin/e2fsck", "-fpDC0", "/dev/block/mmcblk0p2");
run_program("/sbin/tune2fs", "-j", "/dev/block/mmcblk0p2");
run_program("/sbin/e2fsck", "-fpDC0", "/dev/block/mmcblk0p2");
run_program("/sbin/tune2fs", "-o", "journal_data_writeback", "/dev/block/mmcblk0p2");
run_program("/sbin/e2fsck", "-fpDC0", "/dev/block/mmcblk0p2");
run_program("/sbin/tune2fs", "-O", "extents,uninit_bg,dir_index", "/dev/block/mmcblk0p2");
run_program("/sbin/e2fsck", "-fpDC0", "/dev/block/mmcblk0p2");
run_program("/sbin/tune2fs", "-o", "journal_data_writeback", "/dev/block/mmcblk0p2");
run_program("/sbin/e2fsck", "-fpDC0", "/dev/block/mmcblk0p2");
run_program("/sbin/tune2fs", "-O", "^has_journal", "/dev/block/mmcblk0p2");
run_program("/sbin/e2fsck", "-fpDC0", "/dev/block/mmcblk0p2");

ui_print("Installing additional data");
run_program("/sbin/busybox", "mount", "/dev/block/mmcblk0p9", "/data");
delete_recursive("/data/dalvik-cache");
delete_recursive("/data/data/com.android.providers.media");
delete_recursive("/data/data/com.android.vending");
package_extract_dir("data", "/data");
set_perm_recursive(1000, 1000, 0771, 0644, "/data/app");
run_program("/sbin/busybox", "umount", "/data");

ui_print("Installing Boot");
set_progress(0.300000);
package_extract_file("boot.img","/dev/block/mmcblk0p6");
ui_print("Installing System");
set_progress(0.650000);
package_extract_file("system.img","/dev/block/mmcblk0p12");

ui_print("");
ui_print("Done!");
set_progress(1.000000);

You might notice at this point, that I've chosen an alternative way of providing and generating the ROM, much easier, because you don't need to write a single symlink in the updater script. Why? because the whole system partition is flashed as an image. This also speeds up the flashing process in CWM.

Also you might notice, that the mounting devices differ from those used in Gingerbread and the old partitioning scheme:

Mounts comparison:

So if you don't want to grapple with the merging from GB structure to ICS structure, then this pre-built base CWM ROM might be exactly the right choice for you to start your own custom ROM upon.

Here is how it works:

the /data/app directory in the ZIP file works like it always worked. you put your additional de-installable apps there. If you need special permissions for some folders or apps, you enter them in the updater-script like always.

now the modification of the system image (system.img):

you need to do this on Linux, so either natively or in a virtual machine!

extract the system.img to any folder of your choice

in this folder: generate a subfolder called "system"

make sure the "system" folder gets the rights "RW - R - R"

change via commandline to the folder where system.img and system folder are located

enter in commandline:

sudo mount -o loop system.img ./system

the system.img has now been mounted like a virtual drive to the system folder. You can edit all the files of the system image you want and you can't exceed the system image file size because the size of the folder is limited to it

in the system folder with the mounted contents you can also apply the permissions and user groups you would usually set in the updater-script. Now you just do it live under linux. Take a look at the chmod of other folders if you add new folders, maybe you have to change it per example with chown -R <user>:<group> <directory>

if you have problems editing the contents, make sure you run a file explorer in root mode. you can open one in Fedora per example with "gksu nautilus"

when you are done with editing the contents of the system.img, you enter

sudo umount ./system

in commandline

after this the content of the folder "system" will be vanished and all changes will have already been saved to the system.img.

you can now place the updated system.img in the CWM zip again

Pro tip:

If you use android kitchen:

Make a new working folder out of any ROM

exit kitchen, delete the contents of the working folder (leave the working folder itself)

paste the boot.img and system.img you want to change in the working folder

like above again create a folder called "system" and chmod it properly

mount the system.img in this folder

start android kitchen

do zipaligning, deodexing or extracting and repacking boot.img

after you are done in kitchen DO NOT build anything, just leave the kitchen

unmount system.img again, the changes you made like zipaligning or deodexing will persist

place boot.img and system.img in CWM zip again

done :cool: