[G2 and Desire Z General] 0x64746b:
Hi there,

I just found catherall's thread on [how to boot CM 7.1 from the external SD card][0] on a Desire Z/G2 with the infamously fried eMMC.

I used his instructions to boot CM 7.2 (the last stable version for the Vision); since the above thread ends with a dangling question on how to update the system to be booted, I thought I'd document my efforts.

It's just an ext4 file system:

$ file system.img
system.img: Linux rev 1.0 ext4 filesystem data, UUID=b4db3ed8-7d52-46a0-85fb-46fb67c5e837 (needs journal recovery) (extents) (huge files)
$ adb shell
~ # mount | grep system
/dev/block/loop0 on /tmp/boot.img-ramdisk/system type ext4 (rw,nodev,noatime,nodiratime,nouser_xattr,commit=19,barrier=0,data=ordered)

Disclaimer: On the original image, `file` actually identifies the FS as a `mounted or unclean` ext2; it's definitely an ext4 with journaling, though. Accordingly a `mount -t ext2` will fail with a `wrong fs type`.

You can create a new one with

$ dd if=/dev/zero of=system.img bs=4k count=64000
$ /sbin/mkfs.ext4 system.img
# mount -o loop -t ext4 system.img /media/new_sys

This is potentially due to missing binaries:

$ diff -r /media/orig_sys update-cm-7.1.0-vision-signed/system | head -n 5
Only in /media/orig_sys/bin: cat
Only in /media/orig_sys/bin: cmp
Only in /media/orig_sys/bin: date
Only in /media/orig_sys/bin: dd
Only in /media/orig_sys/bin: dmesg

If you download a version of CM, at least the `toolbox` and the `busybox` binaries will be missing from the `system/bin` and `system/xbin` directories respectively. I couldn't be bothered to check for up-to-date versions but just copied the ones provided by catherall before copying over the new CM version:

# cp -r /media/orig_sys/bin /media/orig_sys/xbin /media/new_sys
# cp -r cm-7.2.0-vision/system/* /media/new_sys

This will obviously update all the files that come with CM 7.2 and just keep what's not included in the box.

While you're at it, you might want to add up-to-date gapps:

# cp -r gapps-gb-20131214-signed/system/* /media/new_sys

This gives you a booting CM 7.2. Just replace the `system.img` that comes with catherall's `.zip` with the one you just created and off you go ;)

Unpleasant issue: Booting from SD seems to require a specifically prepared kernel, so the `boot.img` that comes with a different ROM/CM version won't work. So until someone finds out how to prepare a kernel for booting from SD, you will have to continue to boot the one provided by catherall. However, the WIFI driver has not been compiled into the kernel but lives in a separate kernel module in `/system/lib/modules/bcm4329.ko`. Which we (by copying over the `/system` dir from the CM 7.2 build) replaced with a version incompatible with the old kernel we have to boot. So if you intend to boot through `fastboot` and use WIFI (and why wouldn't you? ;P), we will have to put the old kernel module back:

# cp /media/orig_sys/lib/modules/bcm4329.ko /media/new_sys/lib/modules/

Weirdly enough, in the CM 7.2 version I downloaded, the permissions for the `dhcpd-run-hooks` script were broken, so I at least needed to fix those too:

# chmod 550 /media/new_sys/etc/dhcpd/dhcpd-run-hooks

So, `umount` your pristine new `system.img`, move it to your SD card and boot into CM 7.2.

HTH

D.

PS I naively tried to create a larger 1 GB `data.img`, copying over the content from the existing one, but the phone didn't boot with that one. I might have made a mistake (was rather late at that point -.- and I didn't investigate any further), but it seems like the size of the partitions may be hardcoded somewhere. If someone has any additional information, please let me know :) Thx!

PPS If anyone ([MENTION]@catherall[/MENTION]? ;P) knows anything about the kernel issue, I'd be highly interested :)

PPPS After creating this account (to be fair, I've been profiting from this community since the old Windows Mobile days), I was informed that as an account noob, I obviously didn't have anything to contribute to this community and was ordered to place my undoubtedly profane question (which certainly had been answered may times before, I was only too lazy/dumb to search) outside the elite developer forums [/rage]. Maybe one of the Mods can stitch the [original thread][0] and this st0pid workaround back together again? :/ Thanks!

[0]: http://xdaforums.com/showthread.php?t=1572924