Dual boot

From OpenEZX

Jump to: navigation, search

Contents

How to get a dual boot system on your A780

NOTE: This is time demanding. It takes almost two hours just to flash the phone. It also takes some time to backup your phone.

This guide will give you the opportunity to:

 * boot the original ezx rootfs as normal
 * boot an openezx kernel with rootfs on the Transflash card by holding the cam button while powering on
 * boot an openezx kernel as always with usb-boot and rootfs on the Transflash card. 

Requirements:

On your host: cramfs-tools (called cramfsprogs on Debian)

On your A780: mtd-utils [ It's included in console-a780-mtd-image.tar.bz2, if you use another image be sure to install it, because it isn't included by default ]

For yourself: Guts :-), maybe a beer if you're over age, something to read and a backup-phone if something goes wrong :-( .

As always:

Remember, this might break your device, i am not responsible if something happens. I just do this for fun, and i don't see the point of not sharing this.

YOU DO THIS AT YOUR OWN RISK

Thanks to openezx developers, Openembedded community and motorolafans for letting us do all this geeky stuff.

Files in this Howto

http://www.linuxtogo.org/~goxboxlive/A780/bootloader/

HOWTO_FLASH_A780.TXT 			[This readme]
boot_usb				[Normal usb booter]
console-a780-mtd-image.tar.bz2		[A linux rootfs image including mtd-utils]
zImage-2.6.23-1-mtd-a780		[The usual openezx kernel image to use for backup your phone]
zImage-2.6.23-1-mtd-a780-alternate	[The openezx kernel zImage to use for flashing your phone and after flashing the phone, next time you want to upgrade your zImage just be sure that the zImage includes mtd-a780-alternate ] 


Step by Step Guide

1) Charge your battery full [very important]

2) Extract console-a780-mtd-image.tar.bz2 to transflash partition 2.

3) Backup your partitions on your A780:

[Boot Linux with zImage-2.6.23-1-mtd-a780 using boot_usb and ssh to the phone from your computer]

[Computer as root]:

ssh 192.168.0.202

[A780]:

mkdir -p /backup/original
cat /proc/mtd

[it should give you this output:]

 dev:    size   erasesize  name
 mtd0: 00020000 00008000 "Bootloader"
 mtd1: 000e0000 00020000 "Kernel"
 mtd2: 018e0000 00020000 "rootfs"
 mtd3: 00580000 00020000 "VFM_Filesystem"
 mtd4: 00020000 00020000 "setup"
 mtd5: 00020000 00020000 "Logo"
 root@a780:/$

[Then backup your filesystem]

 dd if=/dev/mtd0 of=/backup/original/mtd0
 dd if=/dev/mtd1 of=/backup/original/mtd1
 dd if=/dev/mtd2 of=/backup/original/mtd2
 dd if=/dev/mtd3 of=/backup/original/mtd3
 dd if=/dev/mtd4 of=/backup/original/mtd4
 dd if=/dev/mtd5 of=/backup/original/mtd5

[it might give you "Illegal instruction" at the end of each dd command as it did with me, but it's OK]

 sync
 reboot

4) Save the files in the backup folder to your computer

[Computer as root]:

 mkdir /media/transflash
 mount -t ext2 /dev/sda2 /media/transflash [I'll assume that the block device of the Transflash card is called /dev/sda. Replace this with the correct device on your system] 		
 mkdir -p ~/a780/original
 mkdir -p ~/a780/resized
 cp /media/transflash/backup/original/* ~/a780/original/
 cd ~/a780/resized/
 cp ~/a780/original/mtd1 moto-kernel.mtd2
 wget http://people.openezx.org/wyrm/00020000.bin
 mv 00020000.bin bootloader2.mtd1
 wget http://linuxtogo.org/~goxboxlive/zImage-2.6.23-1-mtd-a780-alternate
 mv zImage-2.6.23-1-mtd-a780-alternate openezx-kernel.mtd4

5) We are now going to resize the original rootfs.

[Computer as root]:

 mkdir /mtn/mtd2
 mount -o loop -t cramfs ~/a780/mtd2 /mnt/cramfs
 cd /mnt/cramfs
 tar cf /mnt/mtd2.tar * .*
 mkdir /tmp/mtd2
 tar xpf mtd2.tar -C /tmp/mtd2
 cd /tmp/mtd2
 rm usr/sbin/smbd [you will miss samba and won't be able to browse your files on A780 from windows (i think, don't know for sure)] 
 pico etc/init.d/samba [Use your favorite text editor, i am using "pico": Comment out line with # that includes smbd in section (start and (restart] exit with [ctrl + o] +  [enter] + [ctrl + x] [enter]
 rm usr/SYSqtapp/wvimps/wvimps [WVIMPS is Wirelless Village Instant Messenger. It is present on all stock firmwares, but do not show on the Main Menu. There are a few people who have tried to make it work, but it doesn't. So what a heck, just delete it.]
 cd ..
 mkcramfs mtd2 mtd2.rootfs.edited.mtd3	[We use .mtd3 ending because this should now be flashed to mtd3 instead of mtd2] 
 umount /mnt/mtd2
 mv mtd2.rootfs.edited.mtd3 ~/a780/resized/
 cd ~/a780/resized/
 mkdir /media/transflash/backup/resized
 cp * /media/transflash/backup/resized/
 sync
 umount /media/transflash

6) Power on your A780 and charge it full again [very important]

7) Now we need to boot up linux again on A780, but now with a different kernel for flashing your phone :-) (scary)

[Boot Linux with zImage-2.6.23-1-mtd-a780-alternate using boot_usb and ssh to the phone from your computer]

[Computer]:

ssh 192.168.0.202

[A780]

cat /proc/mtd

[it should give you this output:]

 dev:    size   erasesize  name
 mtd0: 00020000 00008000 "Bootloader (RO)"
 mtd1: 00020000 00020000 "Bootloader 2"
 mtd2: 000e0000 00020000 "Moto Kernel"
 mtd3: 01760000 00020000 "rootfs"
 mtd4: 00180000 00020000 "OpenEZX Kernel"
 mtd5: 005a0000 00020000 "ezxlocal"
 mtd6: 00020000 00020000 "setup"
 mtd7: 00020000 00020000 "Logo"
 root@a780:~$

[To save battery before we start to flash turn off your backlight so the battery lasts longer]

echo "0" > /sys/class/backlight/ezx-bl/brightness

[Now flash your phone it might take up to two hours as it did for me, important fully charged battery (i cant say this enough) ]

 cd /backup/resized
 flash_unlock /dev/mtd1
 flashcp -v bootloader2.mtd1 /dev/mtd1
 flash_unlock /dev/mtd2
 flashcp -v moto-kernel.mtd2 /dev/mtd2
 flash_unlock /dev/mtd3
 flashcp -v mtd2.rootfs.edited.mtd3 /dev/mtd3  [Yes this is correct, mtd2.rootfs.edited.mtd3 is going to mtd3 now because of the extra bootloader, this step takes over an hour]
 flash_unlock /dev/mtd4
 flashcp -v openezx-kernel.mtd4 /dev/mtd4
 sync
 reboot

8)

Now you're done, reboot the phone and test out the original environment with normal power on.

9)

Now, test to boot the openezx kernel. Switch off phone and then hold the cam button while powering on, it should boot openezx.

10)

Next time there is an update of the openezx kernel and you want to update, you will just have to flash /dev/mtd4. Just be sure that it includes mtd-a780-alternate (or IOW, activate the CONFIG_MTD_EZX_A780_ALTERNATE option in case you build your own kernel image). Note: the default openezx patch set for 2.6.23 sets mtd-a780-alternate by default. Also, flash_unlock and flashcp are contained in the openembedded mtd-utils package.

 flash_unlock /dev/mtd4
 flashcp -v openezx-NEW-kernel.mtd4 /dev/mtd4

Troubleshooting:

DON'T PANIC! If something went wrong, it is very important that you remain calm!

The phone freezes at the startup animation.

The phone wont turn on with the Motorola firmware, but works with OpenEZX (holding the camera button).

Something went wrong when building or flashing the rootfs, mount it again on your PC, check the files and permissions,
assure that the total size of the cramfs image is less than 24510464 bytes. Boot with zImage-*-mtd-alternate, and flash the
rootfs(mtd3) again.

I can't enter the bootloader screen!

Man, you are screwed! Now you have a nice looking paper weight. (just joking ;) )
Remove the battery. Hold the camera + jog buttons, place the battery while holding the keys. The phone will enter the bootloader
(yes, even without pressing the power button). Use boot_usb to send zImage-*-mtd-alternate and reflash blob2(mtd1) and the *Motorola* zImage(mtd2).


I still can't enter the bootloader screen!

Buy a desktop charger, and charge your battery.


I still can't enter the bootloader screen! And my battery is charged.

Man, you are screwed! Now you have a nice looking paper weight. (Not a joke :( )
Note: by following the above howto this "extreme bricking" is impossible to happen, the zImages provided by goxboxlive,
and the source code on svn.openezx marks the bootloader partition(mtd0) as read-only.
Personal tools