What's new
DroidForums.net | Android Forum & News

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[ROM] [6/6/2012] CM7 for the Droid Pro based on GB

Oh I see, so it means that we can't rebuild things like libcamera.so -- for example -- from source because we simply don't have source. But I guess because I saw kernel sourcecode from Moto on opensource.motorola.com -- everything else that we had source should be buildable, right?

So what it entails is that if we would build AOSP as it is now, modify build.prop for it so it fits the Pro and jam some 2ndinit stuff to convince the Pro to load it, and flash it to our phone we won't be able to use our camera, backlights and gps?

Haha I thought that when I first got into developing but I'm afraid it's a lot more complex than that. Linux files have things called dependencies where many files refer to each other and when they are work in unison they create the libraries necessary to run Android. If one thing in the file is a little funky then the phone most likely won't even get past the M logo when you power on the phone
 
I did not write 2nd init, it was originally made by these genius developers for the Motorola Milestone (first device with locked bootloader, it's the GSM version of the OG Droid) and then the developer CVPCS ported it to the Droid X which also appear to work with all subsequent Motorola phones

What the locked bootloaders do is it has a signature in the boot.img file which contains the kernel (the backbone the system) and something called the ramdisk which contains a bunch of scripts necessary to boot the system and a file called init that Motorola made. Normally with phones that have an unlockable bootloader is they disassemble the boot.img and take the kernel and replace the ramdisk with a custom one for CM and reassemble it and flash it to the phone. However, making a custom boot.img will fail the signature checks and the phone won't boot. So what 2nd init does is it hijacks the boot process and unzips the hijack-boot.zip (which contains our ramdisk that we weren't able to modify) and unzips it after the signature check is completed so we can have a custom ramdisk that allows us to boot CM. It's kinda like a trojan horse but in a good way. Hope this helps : D

Certainly. Thanks.

So what's the bare minimum needed in /system to trick the initramdisk to load 2nd-init? Sure there has to be something in /system that tells the motorola initrd to go ahead and unzip hijack-boot.zip and execute it on every boot, right?

From my understanding is that what 2ndinit does after it has successfully hijacked the init process it will check for
/data/.recovery_mode, if it exists then boot to recovery, if it doesn't then boot to CM. Certainly not as elegant as normal recovery but bearable.​

So into development, I think an important question to make my life less miserable is that: Can we make a 2ndinit so that it will pause for a couple of seconds and listen for a certain keystroke (or check if USB is plugged in or whatever we can do conditionally) on boot, if we hold the key down it will boot to recovery, if not it will proceed to CM? That way if I flashed a borked version I could always go to recovery if I mess up in the process of cooking and testing new ROMs. Certainly I don't know if I can bear with sbf_flashing and upgrading and rerooting and bootstrapping every freaking single time I mess up.

Or even easier, if that file does NOT exist then boot into recovery, if that file exists then boot into CM. Now that means if I have a major mess up but still have CWM working, I can simply go to the stock Motorola recovery and format data and it would trigger CWM to come up next time because that would remove the file.


Oh by the way I discovered two very nice tricks:
- Alt Shift Backspace == Alt Control Delete
- The menu for the new stock Motorola recovery won't bring up the menu when we press @ anymore. We have to call the menu by pressing Vol Up + Vol Down.

:P
 
Last edited:
They basically hijacked the boot process the same way they managed to get the clockwork recovery on the motorola phones (since the bootloader requires a signed recovery as well in order to boot) but instead of it telling the phone to run clockwork, it executes 2nd init

CVPCS also implemented into 2nd init an option to always boot into clockwork on reboot, and the only way you can boot the phone normally is to click the reboot now button in clockwork
 
They basically hijacked the boot process the same way they managed to get the clockwork recovery on the motorola phones (since the bootloader requires a signed recovery as well in order to boot) but instead of it telling the phone to run clockwork, it executes 2nd init

CVPCS also implemented into 2nd init an option to always boot into clockwork on reboot, and the only way you can boot the phone normally is to click the reboot now button in clockwork

That is fantastic, where can I find that special 2ndinit binary or how can I activate that mode?
 
Oh thanks for poiting out the source for me. I didn't know that they have the source and makefiles of 2nd-init on CyanogenMod (I thought it's on 2ndinit [And Developers] and that is a lot less information to begin tinkering with).

I guess on https://github.com/CyanogenMod/android_device_motorola_common/blob/gingerbread/hijack/hijack.c I just need to change

Code:
if(0==stat(RECOVERY_MODE_FILE,&info)){


hijack_log("  Recovery mode detected!");
on line 157 to something like
Code:
if(1){


hijack_log("  Recovery mode detected!");

And that should do right?

Sounds fun. I will definitely look into that. I need to concentrate a bit for the GRE test which will take place on Wednesday. After that I will be golden :D
 
Great. Although it doesn't make much sense to me how enabling BOARD_HIJACK_LOG_ENABLE would do, but if that's all I needed to do, it's great.

Also if you could upload your tree to somewhere so people can begin downloading and forking it would be awesome too.

I think one of the things that we're lacking is that we don't have enough people working on the pro, and because we don't have enough people, we don't have a lot information exchange and thus less people are wanting to begin working on it.

Me for example, I would begin tinkering if I could have something that is relatively easy to start building my ROM with. But I didn't because I didn't know where to begin with because of all this mess.

I personally like your ROM so I wouldn't waste my time forking your tree and create my own LURKER ROM with a different font and a different skin and a different launcher but I really wanted to work on AOSP 4.0 for the Pro when time allows. Having spare time to work on something like this could be a tricky thing. Anyhow, having a base source reference like your ROM would help tremendously. :)
 
Last edited:
the thing about log hijack is it assumes that if you're logging, you're developing and that you're in the radical changes stage rather than just tinkering so booting might not necessarily be a 100% chance : D have you downloaded the cm7 source or did you download the 4.0 source?
 
I'd try building a ROM, but I have no idea what any of the technical things mentioned in this thread mean. Maybe I'll try to learn one day, but I've been saying that for a while and it hasn't happened yet.
 
well you'll need linux (preferably ubuntu) and then you'll have to download the source which takes a few hours. if i were you, i'd wait a few weeks until cm9 gets legit for other devices other than the nexus phones (i'm sure the nexus s and n1 will get the first ports) and then you should try everything
 
the thing about log hijack is it assumes that if you're logging, you're developing and that you're in the radical changes stage rather than just tinkering so booting might not necessarily be a 100% chance : D have you downloaded the cm7 source or did you download the 4.0 source?
I did neither, but I will do soon in a couple of days (after the GRE hell).

My plan is this:

- I will begin with the CM7 repo with your patches and see how the process of building ROMs and signing them works (I never tried to cook a ROM for Android, I did rolled my own's (GNU) Linux distro though). I'm actually using kubuntu for all of my dev works at school/work and at home and I haven't been touching Windows except when having to deal with other people's computers at work for a year now, so I'm pretty solid on Linux stuff.

- Then I will build it so that I can boot to CWM every time. Maybe it could be done at the same time with step 1.

- Then I will slowly and carefully study how to create make files for our device with AOSP 4.0 and see how far can I/we get.

I will probably need a lot of help from you so be prepared to answer ;-). I'm not sure though -- again, sparing time to do this might be a very tricky thing.
 
Last edited:
haha sounds like a plan. as of right now, you probably won't need the persistent cwm thing as I haven't had a bootloop in a few months. cooking roms is pretty straight forward so everything of that nature won't be much of a problem. there are instructions for the droid x here Motorola Droid X: Compile CyanogenMod (Linux) - CyanogenMod Wiki and everything is pretty much the same for the droid pro. it'll take about 30 gbs of space for the source and your first build
 
Thank you Lurker. Maybe you pass your GRE with flying colors and then help Calvin with an awesome ICS build for our phone :D
 
I'm enjoying this ROM nearly fully, but I do have a problem. My settings don't seem to apply, and when I change the screen timeout (via Power Widget or other third party Widget) nothing works unless rebooted. Is there something I'm doing wrong?
 
Back
Top