[Samsung Galaxy Nexus] twistedumbrella:
You want to take the ROM you are trying to boot and copy it to the computer.

Unzip the file and you will have the META-INF folder, system folder, boot.img (and possibly a data folder)

View attachment 1839614

Download this zip, unzip it, and place the boot.img in the same directory with these files.

Open up a terminal and run:

unpackbootimg –i boot.img

You will now have some new files:

boot.img-base
boot.img-cmdline
boot.img-pagesize
boot.img-ramdisk.gz
boot.img-zImage

You will want to make a directory to keep the ramdisk in:

mkdir ramdisk
cd ramdisk
gzip -dc ../boot.img-ramdisk.gz | cpio –i

Once you have this directory, it may already include busybox in the folder sbin or sbin/bb, but if it doesn't you can download busybox and put it in the sbin folder View attachment 1837201

Now, in the main ramdisk folder you will find two files that need to be modified, there are fstab.tuna and init.tuna.rc

The fstab.tuna is the file that sets all the mounts for the build, so you will want it to look like this:

# Android fstab file.
#
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK

/dev/block/platform/omap/omap_hsmmc.0/by-name/cache /system ext4 ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/efs /factory ext4 ro wait
/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata /rdata ext4 noatime,nosuid,nodev,nomblk_io_submit,errors=panic wait,check,encryptable=/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata

The init.tuna.rc can be different with different kernels, so you will need to replace lines instead of everything. You want to find the section that looks like:

on boot
mount debugfs /sys/kernel/debug /sys/kernel/debug
chmod 0666 /dev/pvrsrvkm

# autosuspend root hubs immediatly after attached devices
write /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms 0
write /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms 0

on fs
mkdir /factory 0775 radio radio
mount_all /fstab.tuna
setprop ro.crypto.fuse_sdcard true

It should be in the top third of the page. Once you find it, you will want to change the "on fs" portion to:

on fs
mkdir /rdata 0771 system system
mkdir /factory 0775 radio radio
mount_all /fstab.tuna
setprop ro.crypto.fuse_sdcard true
mkdir /rdata/media/2nd
mkdir /rdata/media/2nd/data 0775 system system
mkdir /rdata/media/2nd/cache 0775 system cache
exec /sbin/busybox mount --bind /rdata/media/2nd/data /data
exec /sbin/busybox mount --bind /rdata/media/2nd/cache /cache

Once this is done, scroll down to almost the bottom of the file and you will find a line that starts with:

service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated

You need to make sure that the data directory matches up, so change that first part to:

service sdcard /system/bin/sdcard /rdata/media /mnt/shell/emulated

Once you have made these changes, go back to the folder with the unpackbootimg and ramdisk folder in it. Now you are packing the image back up.

./mkbootfs ramdisk | gzip > newramdisk.cpio.gz
./mkbootimg --cmdline 'no_console_suspend=1' --kernel zImage --ramdisk newramdisk.cpio.gz -o 2nd.img

This will give you the file 2nd.img that should be placed in the /data/media/boot/ folder on your phone.

Now you will want to go back to the folder where you unzipped the ROM. Open the META-INF folder and find the "com" folder inside it. Open this, followed by "google", then "android", then you will find the "updater-script" file.

Open this file. and find every line that says:

format("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system");

and delete those lines. Those lines format system and since you aren't installing on system that will break your current ROM.

Next, you want to find all the lines that contain:

"/dev/block/platform/omap/omap_hsmmc.0/by-name/system"

They will look similar to:

mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/system", "/system");

Some have an additional "0", but what's important is to change the first "system" to "cache", so it looks similar to:

mount("ext4", "EMMC", "/dev/block/platform/omap/omap_hsmmc.0/by-name/cache", "/system");

You may also want to remove the portion that installs the boot.img but that part is not required.

Once this is all done, you will want to move the files that were made by the boot.img unpacking, ramdisk folder, and the scripts you downloaded out of the ROM folder. All that should be left is the original META-INF, system folder, boot.img (and possibly data folder). Zip all of this back up and move it to your sdcard.

You will want to install this new ROM you just made first, followed by the uBoot install. This will make sure the uBoot installs over the boot.img of the ROM. Congrats, you are all done ;)

There is also an app http://xdaforums.com/showthread.php?p=39437365 that will convert the ROM part so all you have to worry about is the boot.img

The original purpose of using cache with uBoot was so I could keep using those builds with this method, so everything will still match up.