[2ndboot][04-10-2012] Custom kernel... this time with radio

Search This thread

czechop

Senior Member
Aug 21, 2012
231
573
It seems that finally I was able to boot custom kernel with working radio:)
It's not very stable yet(it stops/crashes at bootanimation quite frequently), and is quite laggy just after boot, but once it boots it seems to be almost usable. Wifi works, sdcard also. Haven't checked bluetooth.

Credits for this goes to:
* milestone1 devs... for sharing 2ndboot source code and providing so much info regarding milestone1/2 phones
* Motorola:) ... for providing source code(not fully working, but was a great help anyway) for enabling UART over micro usb for debugging purposes(without this I woudn't make any progress)
* tezet... for making quite good;) roms used by 2ndboot

If you wish to try it(BEWARE THAT IT MIGHT BRICK YOUR PHONE, SO DON'T SAY THAT I HAVEN'T WARNED YOU :D), then do as follows:

1. Install tezet's JB10(if you don't have one already).
2. extract 2ndboot.tar(attached) into /data folder, check that /data/2ndboot/hbootuser file has execute permissions.
3. overwrite /system/bootmenu/script/2nd-boot.sh(DON'T TOUCH 2nd-init.sh!!!) with the one from tar(2nd-boot.sh.tar) and check it has execute permissions.
4. reboot into bootmenu
5. change the default boot method to 2ndboot
6. Restart your phone. Most likely it will crash few times at bootlogo, but be patiant, it finally should boot:)
7. If you wish to get back to 2nd-init, then enter bootmenu again and change default boot method back to 2nd-init, or manually boot 2nd-init

Please let me know if someone actually run it and was able to boot(so that to find out if I haven't forgot to include some more files(see changelog for 03.10.2012:D)

KNOWN LIMITATIONS
  • Boots very sloooowly:)
  • Its' quite laggy just after boot.
  • GPS does not seem to work yet

CHANGELOG

01.10.2012 - corrected battery problems(thanks to Quarx and kabaldan)
03.10.2012 - corrected ramdisk(previous one was calling some script which I forgot to attach to this post:eek:, new one has this script inside), so that now you should be able to boot it; updated instructions how to install it; enabled TLS in the kernel(thanks to kabaldan)
04.10.2012 - touch driver updated, now should work with lastest JB(thanks to Eleanor_Ir, Quarx), adb fixed(I hope:), stability fix(thanks to Quarx)


NOTES for devs
In milestone2(as probably in many others UMTS phones made by Motorola) the BP is somehow very sensible and does not like to be disconnected/reenumerated. The main goal of this 2ndboot is then to not allow it to be disconnected. To do this, in the new kernel I've skipped a few resets(EHCI, TLL, individual port resets), and instead of enumerating BP, I've used the hardcoded usb device address(which for milestone2 seems to be equal to 2).
I attach patch(radio.patch) with the changes I've done to the kernel sources from here:

http://sourceforge.net/projects/milestone.motorola/files/MILS2_U6_4.1-22/

This seems to work(sometime:D) for both milestone2 and defy.

For other motorola phones:
1. First of all, check with lsusb what's the address and vendor/product id of your BP(for milestone2 it's 0x22b8 and 0x40e6).
2. If the BP usb device address is 2, then just apply the patch(probably it will need some small modifications), and check if it works.
3. If the BP usb device address is not 2, then edit usb/core/hub.c function hub_port_init(providing that it's there for your kernel), and replace 0x02 in the place where usb_control_msg to get descriptors is sent with address of your device

If it does not work, then you can try the following:
Create a procedure to send usb GetDescriptors request using omap3 ehci registers, and call it at different boot stages/usb initialization stages to find out how long the radio remains attached, and comment/change appropriate fragments of kernel code, to preserve this until usb port is initialized. If you wish, I can share the procedure I've written(in the patch file this is that czecho_get_descriptors called in many places) for milestone2, but it probably would need some modification to work with your device).

2ndboot module sources are here:
https://github.com/czechop/2ndboot
 

Attachments

  • 2nd-boot.sh.tar
    10 KB · Views: 544
  • Screenshot_2012-09-27-19-11-21.jpg
    Screenshot_2012-09-27-19-11-21.jpg
    23.7 KB · Views: 6,521
  • radio.patch
    10.9 KB · Views: 494
  • 2ndboot.tar
    3.8 MB · Views: 573
Last edited:

Anonymous_

Senior Member
Jul 2, 2010
390
131
Wow, thats perfect :) This could bring M2 development to another level.

Holding thumbs up and keep it up!
 

skeevydude

Inactive Recognized Contributor
Feb 10, 2012
3,072
3,042
39
Hot Springs
I'm gonna try on the Motorola Bravo as soon as PA is done uploading. Hopefully this'll work on Froyo kernels as well :fingers-crossed:

What kernel are you using? A recompiled MS2 GB kernel unmodified?

Awesome job man. This could possibly be the start of a new generation of roms for our common platform if this works on other similar phones like the Defy\Bravo. Only time will tell :D.
 

boorce.com

Member
Jan 25, 2011
41
24
Lille (Nord)
Great work !

I see that your work is based on Moto's Linux kernel (2.6 branch as far as I remember...)

Any hope of using another kernel source one day ?
 

czechop

Senior Member
Aug 21, 2012
231
573
I'm gonna try on the Motorola Bravo as soon as PA is done uploading. Hopefully this'll work on Froyo kernels as well :fingers-crossed:

What kernel are you using? A recompiled MS2 GB kernel unmodified?

Awesome job man. This could possibly be the start of a new generation of roms for our common platform if this works on other similar phones like the Defy\Bravo. Only time will tell :D.

Yes, I use MS2 GB U6_4.1-22(http://sourceforge.net/projects/milestone.motorola/files/MILS2_U6_4.1-22/) kernel... but with modified usb host driver.
 

czechop

Senior Member
Aug 21, 2012
231
573
Great work !

I see that your work is based on Moto's Linux kernel (2.6 branch as far as I remember...)

Any hope of using another kernel source one day ?

It should be easy to apply some(perhaps most) 2.6.32 upstream patches to the motorola kernel sources.
Don't know however how difficult it would be to start from another kernel version. Don't know also how motorola proprietary modules/libs would behave with newever kernel version. But, as they say, impossible is nothing:)
 
  • Like
Reactions: djlooka

czechop

Senior Member
Aug 21, 2012
231
573
In kernel only modified usb driver or some more changes for boot?

In 2ndboot module I've added code to disable lcd before starting new kernel(otherwise new kernel could not initialise properly dss), and in new kernel I've only modified usb driver(perhaps more things will need to be modified, as I'm facing problem with BATTD sayins something about power ic fail, BTW, does someone know what that could mean?), so that it skips restaring EHCI, TLL and don't start enumeration, but just used the old usb device address(assigned by the original kernel), which for M2 is always 2(at least during my tests).
 
  • Like
Reactions: hackergnome

czechop

Senior Member
Aug 21, 2012
231
573
I2c Fail can be caused by wrong permissions for /dev/cpp*
I tried your prebuilt binaries on defy http://pastebin.com/jKjQ2ykn
Black screen + buttons lights and reboot after ~20sec

Thanks for hint regarding permissions...will check that:)

Regarding prebuilt binaries on defy, hard to say what's wrong(not sure how much the phones differ). Anyway, you probably would need to use devtree from your device. Also you could unpack ramdisk, and check the init.*.rc scripts if they are ok(e.g. I mount system partion using p21, not sure if that's the same for defy, and staff like that).
 

Top Liked Posts

  • There are no posts matching your filters.
  • 161
    It seems that finally I was able to boot custom kernel with working radio:)
    It's not very stable yet(it stops/crashes at bootanimation quite frequently), and is quite laggy just after boot, but once it boots it seems to be almost usable. Wifi works, sdcard also. Haven't checked bluetooth.

    Credits for this goes to:
    * milestone1 devs... for sharing 2ndboot source code and providing so much info regarding milestone1/2 phones
    * Motorola:) ... for providing source code(not fully working, but was a great help anyway) for enabling UART over micro usb for debugging purposes(without this I woudn't make any progress)
    * tezet... for making quite good;) roms used by 2ndboot

    If you wish to try it(BEWARE THAT IT MIGHT BRICK YOUR PHONE, SO DON'T SAY THAT I HAVEN'T WARNED YOU :D), then do as follows:

    1. Install tezet's JB10(if you don't have one already).
    2. extract 2ndboot.tar(attached) into /data folder, check that /data/2ndboot/hbootuser file has execute permissions.
    3. overwrite /system/bootmenu/script/2nd-boot.sh(DON'T TOUCH 2nd-init.sh!!!) with the one from tar(2nd-boot.sh.tar) and check it has execute permissions.
    4. reboot into bootmenu
    5. change the default boot method to 2ndboot
    6. Restart your phone. Most likely it will crash few times at bootlogo, but be patiant, it finally should boot:)
    7. If you wish to get back to 2nd-init, then enter bootmenu again and change default boot method back to 2nd-init, or manually boot 2nd-init

    Please let me know if someone actually run it and was able to boot(so that to find out if I haven't forgot to include some more files(see changelog for 03.10.2012:D)

    KNOWN LIMITATIONS
    • Boots very sloooowly:)
    • Its' quite laggy just after boot.
    • GPS does not seem to work yet

    CHANGELOG

    01.10.2012 - corrected battery problems(thanks to Quarx and kabaldan)
    03.10.2012 - corrected ramdisk(previous one was calling some script which I forgot to attach to this post:eek:, new one has this script inside), so that now you should be able to boot it; updated instructions how to install it; enabled TLS in the kernel(thanks to kabaldan)
    04.10.2012 - touch driver updated, now should work with lastest JB(thanks to Eleanor_Ir, Quarx), adb fixed(I hope:), stability fix(thanks to Quarx)


    NOTES for devs
    In milestone2(as probably in many others UMTS phones made by Motorola) the BP is somehow very sensible and does not like to be disconnected/reenumerated. The main goal of this 2ndboot is then to not allow it to be disconnected. To do this, in the new kernel I've skipped a few resets(EHCI, TLL, individual port resets), and instead of enumerating BP, I've used the hardcoded usb device address(which for milestone2 seems to be equal to 2).
    I attach patch(radio.patch) with the changes I've done to the kernel sources from here:

    http://sourceforge.net/projects/milestone.motorola/files/MILS2_U6_4.1-22/

    This seems to work(sometime:D) for both milestone2 and defy.

    For other motorola phones:
    1. First of all, check with lsusb what's the address and vendor/product id of your BP(for milestone2 it's 0x22b8 and 0x40e6).
    2. If the BP usb device address is 2, then just apply the patch(probably it will need some small modifications), and check if it works.
    3. If the BP usb device address is not 2, then edit usb/core/hub.c function hub_port_init(providing that it's there for your kernel), and replace 0x02 in the place where usb_control_msg to get descriptors is sent with address of your device

    If it does not work, then you can try the following:
    Create a procedure to send usb GetDescriptors request using omap3 ehci registers, and call it at different boot stages/usb initialization stages to find out how long the radio remains attached, and comment/change appropriate fragments of kernel code, to preserve this until usb port is initialized. If you wish, I can share the procedure I've written(in the patch file this is that czecho_get_descriptors called in many places) for milestone2, but it probably would need some modification to work with your device).

    2ndboot module sources are here:
    https://github.com/czechop/2ndboot
    84
    I've fixed the sluggishness and slow booting: reason was L2 cache was not being enabled back in the hboot, and then TI pigs wrote the suspend / resume code in a manner that they didn't check whether L2 cache was enabled or disabled when suspending, so resume code enabled it and the sluggishness was gone.

    Will provide source to the repo shortly. Or well, you can take it from here: http://git.omapzoom.org/?p=repo/u-b...0ecf27b631a88faca612108110bd581f546dc;hb=HEAD (l2cache_enable)

    EDIT: Sources are here: https://github.com/nadlabak/2ndboot (there is a tiny setup made that is board dependant, so read the readme)
    78
    Info about 3.0 kernel
    New log: http://quarx2k.ru/uart.txt
    All cpcap stuff are work correct now.
    Voltage,nand,sd,i2c problems fixed.
    Todo make work Dispaly and usb
    65
    Problem with machine ID fixed and uart:)
    https://github.com/Quarx2k/jordan-kernel/commit/53c02daf80fefa43a8f81cb4c33ad4371eb9b73e

    Bug from stock rom there too. I prevented uart from dying, to see logs in later boot.
    In stock kernel i fixed by kill initialize uart on ttyS2, but there not helped.
    http://quarx2k.ru/uart.txt log
    60
    yea, it worked! but randomly reboots.
    I tested on stock moto kernel
    before 2ndboot

    Linux localhost 2.6.32.9-g6977577 #1 PREEMPT Mon Nov 7 23:37:21 KST 2011 armv7l
    GNU/Linux

    after

    Linux (none) 2.6.32.9-ge281b6e #1 PREEMPT Thu Feb 2 10:03:42 CST 2012 armv7l GNU
    /Linux

    and custom too:)

    Linux (none) 2.6.32.9 #1 PREEMPT Fri Sep 28 14:11:14 MSK 2012 armv7l GNU/Linux