Dual Boot GEN2

From OpenEZX
Jump to: navigation, search

ALL THE INFORMATION AND CODE IN THIS PACKAGE ARE PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. DONT BLAME ME IF YOU BRICK YOUR PHONE.

ALL THE CODE AND BINARY FILES IN THIS PACKAGE ARE FREE TO USE AND REDISTRIBUTE, WITH A GPL LICENSE OR SIMILAR.

Contents

Flashing procedure -GEN2-Only-

What's needed

  • gen-blob sources and a proper toolchain to build it, or alternatively pick an already compiled gen-blob here.
  • The newest moto-boot-usb built from the source on svn, or phonetools, to flash and backup the phone (older moto-boot-usb version could brick your phone without warnings, oldest cannot even flash and use the needed command we need).
  • moto-boot-usb must be the latest version (a previous version fails to sanitizer user input, and a small mistake can lead to a disaster !)

Follow this only on RokrE2, RokrE6, A1200, A910 (gen2 devices)

On gen2 devices, the kernel is located at 0xA0000 and is offset by 2048 bytes on the flash partition.

Enter the bootloader and prepare the phone to be flashed:

./moto-boot-usb setflag usb
./moto-boot-usb gen-blob 0

Backup your existing kernel:

./moto-boot-usb read 0xA0000 1048576 backup-of-kernel-partition
# Then remove the famous 2048 bytes offset:
dd if=backup-of-kernel-partition bs=1k skip=2 of=24-kernel-backup

Keep these two backups, we will use them both later:

Now copy and rename this "24-kernel-backup" file to "default" on the /boot/ folder of the (micro) SD card. Make also sure the file /boot/menu.lst is in the (micro) Sd as well and point to that "default" kernel too.

Check gen-blob's size (must not exceed 128KiB)

ls -l gen-blob

Flash gen-blob WARNING: For gen2 phones only! :

dd if=/dev/zero bs=1 count=2048 of=needed-offset
cat needed-offset gen-blob > gen-blob-to-be-flashed-to-0xA0000
#flash using moto-boot-usb/gen-blob, example: moto-boot-usb flash <addr> <file> 
./moto-boot-usb flash 0xA0000 gen-blob-to-be-flashed-to-0xA0000

After the flash

  • Boot with vol- (next song on E2) pressed for the boot menu or with vol+ (previous song on E2) for the usb mode.
  • You can power off on usb mode with "moto-boot-usb off".
  • You can still have access to the MBM flash mode with the usual combo.

Re-flashing the original kernel, after genblob, in the device (optional)

Re-flashing a (prepared) 2.4 original kernel require you a few minuts more, but bring some advantages...(the ability to boot the motorola kernel, and even charge the battery without a (micro)SD in the phone).

But:

  • You should always do a backup (possibly, a full backup) before replacing anything on the phone...
  • A little mistake could erase the partiton next to the kernel one ("resource partition"), etc...

Gen-blob always search at offset 0xC0000 and if it find a special 'magic' flag, then it will boot this kernel by default.

Prepare the 2.4 kernel to be re-flashed

You remember? Sooner, we did a backup of the kernel partition (third command described on this page):

So, hopefully, you kept that backup file... :-)

Now you need to remove the 2048 bytes offset, and resize the file:

dd if=backup-of-kernel-partition bs=1 skip=2048 count=917500 of=kernel-with-no-extra-bytes

Download and add the magic flag to the kernel for genblob to recognize it:

# download a flag to put at the beggining of the kernel before flashing it.
wget http://people.openezx.org/wyrm/gen-blob/magic-boot-from-flash
cat magic-boot-from-flash kernel-with-no-extra-bytes > kernel-to-be-flashed-to-0xC0000

Checks before re-flashing the 2.4 kernel on the phone

Then you need to assert the resulting 'kernel-to-be-flashed-to-0xC0000' file is exactly 917504 bytes big:

ls -l kernel-to-be-flashed-to-0xC0000 
# If the result is bigger than 917504 bytes, then don't flash it! You made a mistake somewhere...

Then you can also check if the file hasn't been cut at its end: EXAMPLE 1:

hexdump kernel-to-be-flashed-to-0xC0000 | tail
[...]
[...]
[...]
hexdump kernel-to-be-flashed-to-0xC0000 | tail
00d8e80 ffff ffff ffff ffff ffff ffff ffff ffff
*
00e0000

EXAMPLE 2:

hexdump kernel-to-be-flashed-to-0xC0000 | tail
[...]
[...]
[...]
00d5970 5911 000d 2c6c 0000 ddb8 000d 0000 0000
00d5980 0000 0000 0000 0000 0000 0000 0000 0000
*
00e0000

One of these line (the last!) must end with at least a few ' f f f f ' or ' 0 0 0 0 '...

Reflash

If your checks has passed successfully, then you can flash the kernel

WARNING: For gen2 phones only! :

#(Re-)Flash the original kernel
./moto-boot-usb flash 0xC0000 kernel-to-be-flashed-to-0xC0000
Personal tools