[MOD][HOW TO][Update: 05-Aug-2011] 2nd-init port for Milestone2 - Milestone 2 Android Development

Credit for koush for Droid2 Bootstrap
Credit for edgardcastro for sharing lots of information about 2nd-boot on Milestone1
Credit for Skrilax_CZ for 2nd-init and sh hijack
If you just want to install 2nd-init on your phone you can skip the whole guide and flash update-2nd-init.zip into your phone. As usual I will not hold responsibility to any damages it may cause.
WARNING: Use this ONLY if you know exactly what you are doing. This guide will make major changes in the /system partition and may turn the phone inoperative. I won’t hold responsibility if you brick your phone or to any damages it may cause.
Pre-requisites: A computer with Android SDK and ADB drivers installed and working. It’s recommended to have RSD Lite 4.9 and the appropriate SBF image just in case anything goes wrong.
This guide was made using a Brazilian Motorola Milestone2 based on Brazil Retail SBF and a computer running Windows Vista 32-bits. I started it from the scratch by flashing my phone with RSD Lite 4.9 and performing a full data/cache wipe, just to make sure any changes were discarded.
Note: Commands that should be entered in command prompt will be listed as: “C:\> <command>”. Commands issued to ADB Shell will be listed as: “# <command>”.
1. Enable USB Debugging on your phone;
2. Get permanent root. I used the app z4root which can be found here on XDA;
3. Install Droid2 Bootstrap. It may be downloaded from Market to support the developer. More info here http://www.koushikdutta.com/2010/08/droid-x-recovery.html;
4. Open Droid2 Bootstrap and click “Bootstrap Recovery”;
5. Use bootstrap to reboot into Clockwork Recovery and backup your phone;
6. Reboot;
7. C:\> adb remount
8. # stop
9. # mkdir /system/etc/rootfs
10. # cp /*.rc /system/etc/rootfs
11. # mkdir /system/etc/init.d
12. # cp /system/bin/sh /system/bin/_sh
13. # cp /init_prep_keypad.sh /system/bin
14. C:\> adb push sh_hijack.sh /system/bin/
15. C:\> adb push 2nd-init /system/bin/
16. C:\> adb push sysinit /system/bin/
WARNING: at this point you should keep a terminal window (adb shell) opened before replacing the 'sh' binary. This is so because you wont be able to open a new abd shell window to run the chmod command.
17. C:\> adb push sh /system/bin/
18. # chmod 755 /system/bin/sh
19. # chmod 755 /system/bin/sh_hijack.sh
20. # chmod 755 /system/bin/2nd-init
21. # chmod 755 /system/bin/sysinit
22. # ln -s /system/bin/busybox /system/xbin/mount
23. # ln -s /system/bin/busybox /system/xbin/rmdir
24. # ln -s /system/bin/busybox /system/xbin/cp
25. # ln -s /system/bin/busybox /system/xbin/umount
26. # ln -s /system/bin/busybox /system/xbin/run-parts
27. # reboot
28. At this point you should be getting into Clockwork Recovery every time, no matter how many times you have rebooted or if you’ve taken the battery of or not. THIS IS NORMAL. It means that the 2nd-boot + sh hijack is working as it should. The boots into clock recovery are caused by a conflict between sh hijack and logwrapper hijack (used by Droid2 Bootstrap). Continue the guide to fix this issue.
29. In clock recovery menu go to: mounts and storage>mount /system;
30. Open ADB Shell again (it will be available in clockwork recovery as well);
31. # cp /system/bin/logwrapper.bin /system/bin/mylogwrapper
32. C:\> adb pull /system/etc/rootfs/
33. Open init.rc and init.mapphone_umts.rc into a text editor that preserves unix end-line format (e.g.: notepad++). Find all entries of “/system/bin/logwrapper” replacing for “/system/bin/mylogwrapper”.
34. In init.mapphone_umts.rc find entry for “exec /init_prep_keypad.sh” replacing for “exec /system/bin/init_prep_keypad.sh”. Add the following text to the end of this file to be able to run all scripts in /system/etc/init.d at boot time:
Code:
service bootscripts /system/bin/sysinit
class post-zygote_services
disabled
oneshot
35. Save and close.
36. C:\> adb push init.rc /system/etc/rootfs/
37. C:\> adb push init.mapphone_umts.rc /system/etc/rootfs/
38. # chmod 755 /system/etc/rootfs/init.rc
39. # chmod 755 /system/etc/rootfs/init.mapphone_umts.rc
40. Choose “Reboot system now” in clock recovery menu;
You’re all set! Now it is just a matter of changing the rc files in /system/etc/rootfs to customize your system boot.
If you want to log the system boot you may also copy the provided log-init.sh script into /system/etc/rootfs and uncomment the line “exec /log_init.sh” from my init.rc file. Doing so will create the /data/logcat.log file that may get huge in sometime.
2nd-init files and my modified *.rc files attached.
Have fun!
UPDATED to version 2.0.0 (froyo) this version exploits /system/bin/mount_ext3.sh instead of sh binary. It's a new method I developed in order of starting 2nd-init earlier but also keeping compatibility with Droid2bootstrapper (recovery takes place first). This might help me booting Leaked GB from 2nd-init, which wasn't possible on the previous version. Take note it's not ready yet to apply on GB.

I just missed the exec /system/bin/init_prep_keypad thanks!

What is this for?
Sent from my A953 using XDA App

inheme said:
What is this for?
Sent from my A953 using XDA App
Click to expand...
Click to collapse
A method to customize initialization scripts of android system. It's a major hack used be some Milestone1 custom ROM's. I've succeeded into porting this to MS2, and I think some modders here of XDA may be interested into adding this to custom ROM's. It may be added to the stock ROM (as I did) but it is not something that everyone is willing to try.
Word of advise: If you don't know what it is you don't need it

Ok thanks for the explanation
So it means that custom roms will be easier to create?
Sent from my A953 using XDA App

That's some major news for our little community.
Tell me if I'm wrong, but since init starts after the kernel is loaded, it's not useful at all for loading a custom kernel, true?
But having a custom init script is a step to CyanogenMod 6 port on Milestone 2, still true?
Anyways, great job, and great howto.

momus87 said:
That's some major news for our little community.
Tell me if I'm wrong, but since init starts after the kernel is loaded, it's not useful at all for loading a custom kernel, true?
Click to expand...
Click to collapse
To load a custom kernel we'll need that kexec hack that team freemymoto is working on.
But having a custom init script is a step to CyanogenMod 6 port on Milestone 2, still true?
Click to expand...
Click to collapse
Well, it's possible, but I believe the big issue here is the impossibility of running custom kernels. Even so, a skilled Modder may be able to overcome that and port CM6 to MS2 using Motorola's stock kernel. It has been done for the MS1.
Anyways, great job, and great howto.
Click to expand...
Click to collapse
You're welcome.

Thanks, r2beta0... this is going to help us out a lot!

r2beta0 said:
Well, it's possible, but I believe the big issue here is the impossibility of running custom kernels. Even so, a skilled Modder may be able to overcome that and port CM6 to MS2 using Motorola's stock kernel. It has been done for the MS1.
You're welcome.
Click to expand...
Click to collapse
Guess that would be me
nah just kidding. I've just happened to have some luck porting Froyo and Gingerbread to the bootloader-locked x10 mini pro. I've just ordered my milestone 2 and I will work on CM6. AWESOME JOB on the 2nd init man! Really, thanks!!
edit: just can't stop thanking you! You saved me a lot of work and porting CM will be easy as sh*t for me now! THANKS

Mikevhl said:
Guess that would be me
nah just kidding. I've just happened to have some luck porting Froyo and Gingerbread to the bootloader-locked x10 mini pro. I've just ordered my milestone 2 and I will work on CM6. AWESOME JOB on the 2nd init man! Really, thanks!!
edit: just can't stop thanking you! You saved me a lot of work and porting CM will be easy as sh*t for me now! THANKS
Click to expand...
Click to collapse
You're welcome! You can count on me to provide as much help as I can to free our MS2's from Motorola's hand. I would be very grateful if you could share your knowledge of porting CM to locked devices. I was trying to port MIUI and Shadow mod BR to MS2 but I got stuck when dealing with proprietary files.
Sent from my A953 using XDA App

@r2beta0
Could this port work on Motorola defy?
Sent from my MOTO Defy

demolition23 said:
@r2beta0
Could this port work on Motorola defy?
Sent from my MOTO Defy
Click to expand...
Click to collapse
It's very likely, since the 2 devices are very similar. Most of the files I attached are from Milestone1 and works perfectly on MS2. Though I recommend you to NOT replace your *.rc files with the attached ones since they could be not compatible. It would be better if you edit your own files. Also try it ONLY if you have a working version of ClockworkMod Recovery (or other custom recovery). You may adapt this guide for your device and post it here on XDA, just remember to mention my name on credits

Already posted and hoping someone to port this..
http://forum.xda-developers.com/showthread.php?t=1003449

demolition23 said:
Already posted and hoping someone to port this..
http://forum.xda-developers.com/showthread.php?t=1003449
Click to expand...
Click to collapse
BTW, why do you want to use 2nd-init? You know, this guide is more inclined for devs/mods who want (need) to include this feature on their ROM's. With this you can change the way things are loaded on linux system before android starts up. But to take advantage of that you should know a lot about how linux works and so on. Regular users should look for a ROM based on the features he needs. Most ROM's already have 2nd-init implemented, but it's not something users are aware of.

Possible issue I've come across:
When replacing sh, i can no longer re-open the shell for obvious reasons... potentially I need to already have a second terminal open with shell running in it already?
SBFing and trying again :3

smacky_wolf said:
Possible issue I've come across:
When replacing sh, i can no longer re-open the shell for obvious reasons... potentially I need to already have a second terminal open with shell running in it already?
SBFing and trying again :3
Click to expand...
Click to collapse
I had no such issue here. When executing the steps of this guide I kept two windows opened all the time. One command prompt to run adb push/pull and another window running adb shell.
Thanks to point that out! I will post a warning in the main post. You should have a adb shell window already running to be able to run chmod just after replacing sh.
But don't worry, you don't need to SBF. Just reboot into clockwork recovery, mount /system via menu, and open your adb shell. It uses a different shell so you can fix the problem in /system/bin.

Looks like Motorola Defy now has CyanogenMod 7 using 2nd-init script! Wish same were the case for MS2.

syl0n said:
Looks like Motorola Defy now has CyanogenMod 7 using 2nd-init script! Wish same were the case for MS2.
Click to expand...
Click to collapse
I'm on it, but development is slow

No necessary to use 2nd init.
Just install "droid 2 bootstrap" and Rom Manager will work perfectly.

keylight65 said:
No necessary to use 2nd init.
Just install "droid 2 bootstrap" and Rom Manager will work perfectly.
Click to expand...
Click to collapse
What are you talking about? This guide isn't related to ROM Manager.

Related

Ash as login shell

Hi All,
The Ash shell provides a few advantages over the Android default sh shell such as command history and cursor handling at the prompt. There are other benefits, but these are the first that come in most handy (to me).
The following tutorial will get you ash as the login shell with as yet no ill effects:
Note: that in my case, I'm using my android2sd construct and thus this modification is being done to my active overlay profile setup, thus to undo it I can simply boot into "safe\\normal" mode and undo the changes without possibly locking me out of the console should it have failed (which it didn't) But you can edit the Android /system/bin/sh file in this manner directly.
Ash as Login Shell:
OK, make the /system fs read-write:
mount -o remount,rw /system
Click to expand...
Click to collapse
Note: that the fs type is not needed, and in my case is not yaffs but ext3, Android will figure it out proper.
Next,
cp -a /system/bin/sh /system/bin/sh0
Click to expand...
Click to collapse
(this is for backup purposes and allows us to undo the change if so desired, or delete it if no longer needed).
Note: I'm using JF1.51 roms, so busybox ash is available as /system/xbin/bb/ash, so that is what I am using here; use ash however you are able to access it.
echo "#!/system/xbin/bb/ash">/system/bin/sh
echo "/system/xbin/bb/ash \[email protected]">>/system/bin/sh
Click to expand...
Click to collapse
Please note the use of (redirect\\overwrite)> and (redirect\\append)>>.
This will overwrite sh with a script to load the desired shell, executing any command-line arguments passed, and preserve the permissions of the original sh file. You can manually set the permissions the same as they are for our sh0 backup if the permissions (root.shell)(0755) don't seem to keep.
Finally reset the read-only state of /system:
mount -o remount,ro /system
Click to expand...
Click to collapse
Now if you shell-in\\telnet-in you should get the ash prompt which unlike the Android sh default prompt, includes the present working directory(pwd) ie: '/#' instead of just '#'.
Note: A reboot should not cause the loss of the modification, but if does, copy the new sh script to your /data/local/bin location or something and copy it back via boot script or something.
Shell Scripts:
If you're like me, you discovered that Android didn't need the interpreter declaration comment in scripts, and thus may not have used them...Well, you will need to update your scripts to include them by adding something similar to the following as the first line of your scripts:
#!/system/xbin/bb/ash
Click to expand...
Click to collapse
Again, please note that I am using JF1.51 roms and the location of the busybox ash shell is what I'm listing; put the full location to the shell you intend to use as this location.
Without the interpreter declaration, ash simply complains 'not found' at the first command, as ash doesn't know how to interpret the script, and doesn't seem to default to the login shell.
Hope someone finds this helpful!
sweet. This is going to be very useful
BAM. thats sexy. i just did this on CM3.6.7.1. works like a charm.
scratches head. i'm lost. what does this do and how does this make my g1 better?
temporizer said:
scratches head. i'm lost. what does this do and how does this make my g1 better?
Click to expand...
Click to collapse
im not sure about the other features, but the one i installed it for is to have your working directory in front of ur prompt. ex:
Code:
/# cd /sdcard
/sdcard # cd /system/sd
/system/sd #
etc...
EDIT: Also, if you use ConnectBot, you'll notice with the regular sh, if u scroll up with tracball, you get BS characters on the prompt. with THIS one, when you scroll up, you get last command entered. VERY handy for when you mistype one character on a long-ass command.
I love you
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
great job, i'm going to get ash working on my G1 (CM-3.6.7.1)
Thanks.
kanstin said:
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
Click to expand...
Click to collapse
I tried this and it worked even after a reboot...
Sweet, I love the scroll back with trackball in the terminal!!! Me thinks this should get absorbed into the next Cyan release.
kanstin said:
Couldn't you do this?
Code:
mv /system/bin/sh /system/bin/sh0
ln -s /system/xbin/bb/ash /system/bin/sh
Click to expand...
Click to collapse
Yes, I reckon you could. Though I had done a few experiments where the symlink failed, but I'm fairly sure it was do to the link: /system/xbin/bb/ash -->../busybox and /system/bin/../busybox not existing...so I did it via script. Many ways to skin a cat they say.
Thank you all... this is fricken awesome!!
temporizer said:
scratches head. i'm lost. what does this do and how does this make my g1 better?
Click to expand...
Click to collapse
It gives a more advanced shell for when you use the command line interface or telnet into your G1. If you don't use the command line a lot, it won't help you.
As for specific benefits to the advanced version, it was listed in the first post.
Hi,
imho this is rather a hack that exposes you to the risk at least on CM to loose your
shell during boot as xbin.sqf the compressed squashfs filesystem containing
busybox is mounted rather late in the boot process. A cleaner solution would be to
move busybox to system/bin and link it to sh. That way you ensure that sh will
always be accessible during boot and also later on, thus not interfering with
further developments. A alternative could be to compile a standalone version
of busybox containing only ash (for size reasons, as size in /system/bin is precious)
copy that to /system/bin and link sh to it.
Seems to work fine on Dude's. Not really sure how it should open, but I type "ash" at the prompt and I get the /$ and /# if superuser. I also get the command history by rolling the trackball, which is a very nice feature.
Can i install this without using my PC?
temporizer said:
Can i install this without using my PC?
Click to expand...
Click to collapse
Should work using terminal.
Tried it on JACHero 2.7.1
I tried the hard link one and I get a read only fs error on the first move command. What should I chmod to get past that?
mugafuga said:
I tried the hard link one and I get a read only fs error on the first move command. What should I chmod to get past that?
Click to expand...
Click to collapse
Do this first before the mv and the symlink.
mount -o remount,rw /system
farmatito said:
Hi,
imho this is rather a hack that exposes you to the risk at least on CM to loose your
shell during boot as xbin.sqf the compressed squashfs filesystem containing
busybox is mounted rather late in the boot process. A cleaner solution would be to
move busybox to system/bin and link it to sh. That way you ensure that sh will
always be accessible during boot and also later on, thus not interfering with
further developments. A alternative could be to compile a standalone version
of busybox containing only ash (for size reasons, as size in /system/bin is precious)
copy that to /system/bin and link sh to it.
Click to expand...
Click to collapse
Is this in any way accurate? I dedicate my g1 to cyan's roms and wouldn't want anything to hinder any of the goodness that is cyanogenMod. Advice?
Load ash when terminal is started?
temporizer said:
Is this in any way accurate? I dedicate my g1 to cyan's roms and wouldn't want anything to hinder any of the goodness that is cyanogenMod. Advice?
Click to expand...
Click to collapse
Safest method will be to change to ash shell once terminal app is started (same as typing "ash" to switch shell from sh to ash). I don't know how to do it in android (in linux you could add it to your login script).
So if someone knows how to execute a command when we login using the terminal app, then switching to ash shell would work without fear of breaking any other functionality.

Busybox for the EVO

Does anyone have a compiled busybox for the EVO yet. Preferably in update.zip format. I'd like to get Debian working on the phone and Busybox is a requirement.
Im confused, I got busybox installed from titanium backup. Is that the same one you need? If so install titanium backup, hit 'problems' and install busybox that way.
I made a custom rom I just posted with BusyBox preinstalled. I will see if I can post an update.zip with busybox in it soon.
ChrisDos said:
Does anyone have a compiled busybox for the EVO yet. Preferably in update.zip format. I'd like to get Debian working on the phone and Busybox is a requirement.
Click to expand...
Click to collapse
here is one of my busybox binaries which should get you going. you'll have to manually install it, adb push to sdcard and then using root, mv to /data and chmod 755. should be good to go. if you're using unrevoked root, you can put it in the shadow directory and it'll appear in /system/bin.
http://forum.sdx-developers.com/android-2-1-development/(source)-sdx-busybox-for-android-2-1/ - where we maintain our latest version of busybox thanks to LouZiffer. I use this binary in all my ROMs. Its our community trade off for features with size..
my personally hosted mirror isnt always as updated as the link above - http://www.joeyconway.com/sdx/busybox/busybox (its the recovery version from link above with more features)
i'm sure somebody will throw up an update.zip which might be easier for most users.
joeykrim said:
here is one of my busybox binaries which should get you going
http://www.joeyconway.com/sdx/busybox/busybox
Click to expand...
Click to collapse
Even better Will installing it out of recovery work since it needs to add symlinks? You will probably need to go into recovery, and then adb shell busybox --install.
chuckhriczko said:
Even better Will installing it out of recovery work since it needs to add symlinks? You will probably need to go into recovery, and then adb shell busybox --install.
Click to expand...
Click to collapse
yea, so depends. if you're as root in normal android mode, unrevoked or one of toast/maejrep's rooted ROMs you can manually install w/o rebooting to recovery. if you dont have root in normal android mode, no custom ROM and no unrevoked root, you'll need to go into the recovery mode with root access.
i think the command to put sym links into /sbin which would be in the default PATH is:
busybox --install -s /sbin
i havent really experimented to see what people are using as their default install locations ... sorry for the rough guide!
I installed busybox entirely from my phone using the directions laid out in the troubleshooting section on the TitaniumBackup webpage (sorry, new user cannot post link, but you can link to it from the app in the market). I have toast's root and radio and flipz's .6 ROM, and I was able to do it all using a terminal on the phone, so, no recovery.
Thank you all. I got busybox installed and working fine. Though I guess I'll have to wait until an official ROM comes out with Ext4 support as it won't let me mount the partition that contains the Debian install. I suppose I could format the partition with yaffs2, but I haven't done any research into that file system. I might just have to be patient until an ASOP based ROM is released or someone includes a kernel with Ext4 support.
Thanks everyone. I appreciate all the hard work put towards this phone.
ChrisDos said:
Thank you all. I got busybox installed and working fine. Though I guess I'll have to wait until an official ROM comes out with Ext4 support as it won't let me mount the partition that contains the Debian install. I suppose I could format the partition with yaffs2, but I haven't done any research into that file system. I might just have to be patient until an ASOP based ROM is released or someone includes a kernel with Ext4 support.
Thanks everyone. I appreciate all the hard work put towards this phone.
Click to expand...
Click to collapse
can you post the files and directions to so i can get it installed? thanks
ChrisDos said:
Thank you all. I got busybox installed and working fine. Though I guess I'll have to wait until an official ROM comes out with Ext4 support as it won't let me mount the partition that contains the Debian install. I suppose I could format the partition with yaffs2, but I haven't done any research into that file system. I might just have to be patient until an ASOP based ROM is released or someone includes a kernel with Ext4 support.
Thanks everyone. I appreciate all the hard work put towards this phone.
Click to expand...
Click to collapse
if you use toast's kernel source released here, you can compile a working kernel with ext4 support ... just throwing out ideas cuz i'd hate to see you stop with your progress!
Busybox Installation Instructions
I use Linux, well, for all my computers, including my phone
So these instructions are biased for Linux...
Boot into torch's recovery.
Download busybox from joeykrim:
http://www.joeyconway.com/sdx/busybox/busybox
Place it in a directory and create this script:
Install_Busybox.sh:
#!/bin/bash
echo "Mounting /system"
adb shell mount -v /system
echo "Mounting /data"
adb shell mount -v /data
sleep 3
adb push busybox /data
adb shell chmod 755 /data/busybox
adb shell /data/busybox --install -s /system/xbin
echo "Waiting for system to stabilize before unmounting"
sleep 3
adb shell umount -v /system
adb shell umount -v /data
chmod 755 Install_Busybox.sh
./Install_Busybox.sh
Windows/Mac users can just manually run the adb commands and it should work fine.
joeykrim said:
if you use toast's kernel source released here, you can compile a working kernel with ext4 support ... just throwing out ideas cuz i'd hate to see you stop with your progress!
Click to expand...
Click to collapse
Well, I compile kernels all the time for my laptop and Myth boxes. Is there a bit of a how-to for compiling the kernel for ARM and install it/replace the current kernel. It's be nice to find out how-to on how to make an update.zip to provide the install for everyone else as well.

The easiest 1.47.651.1 root+nand unlock you'll ever see without a gui (Updated)

Make sure your battery has a decent amount of charge in it, you don't want to run out of juice in the middle of this.
You will need to have the android sdk installed, as you will need to use the adb tool.
Windows users will need to install HTC Sync in order to get the usb driver for the phone installed.
Part 1: In which we find that the Evo spreads easier than a Thai whore during tourist season
Code:
adb shell "rm /data/local/rights/mid.txt"
adb shell "ln -s /dev/mtd/mtd1 /data/local/rights/mid.txt"
adb reboot
Part 2: In which we find that engineers have no personality, but they make one hell of a bootloader
Put the files from Toast's Part 2, for nand unlock onto the sdcard (PC36IMG.zip, mtd-eng.img, recovery.img, flash_image)
then (after making sure the sdcard is remounted to the phone if you used disk mode to xfer the files):
Code:
adb shell "cat /sdcard/flash_image > /data/local/rights/flash_image"
adb shell "chmod 755 /data/local/rights/flash_image"
adb shell "/data/local/rights/flash_image misc /sdcard/mtd-eng.img"
adb reboot bootloader
When asked if you want to update, say yes. Relax for a while, the update takes some time.
When the phone eventually boots back up:
Part 3: In which I find the whore, and make her install a custom recovery
Code:
adb shell "cat /sdcard/flash_image > /data/flash_image"
adb shell "chmod 755 /data/flash_image"
adb shell "/data/flash_image recovery /sdcard/recovery.img"
After this you should be fully rooted with nand unlock.
I highly recommend going through Whitslack's Starting Over method to bring your software and radios up to date.
You're done.
Pity this only came to light a few days before people are going to be upgrading to a new OTA.
No, this will not work for anyone who updated to 2.2.
epic!!! 789
niice!
Nice Find!
At least now people can be rooted prior to the new OTA!
damn it!
___
Sweet! Wish I had that method starting out. Lol.
Sent from my PC36100 using XDA App
does this method really work??
BAttitude7689 said:
does this method really work??
Click to expand...
Click to collapse
Yes it does.
ok, so i have no idea how that works... care to go into it alittle bit more?
khshapiro said:
ok, so i have no idea how that works... care to go into it alittle bit more?
Click to expand...
Click to collapse
The init scripts chmod 777 mid.txt on boot (this means that anyone can do anything to the file basically). By removing the file and linking it to mtd1, the chmod now makes mtd1 accessible by everyone after a reboot, which means that you can go directly to toast's part2 which starts with flashing mtd-eng.img.
Incidentally it appears the droid eris guys have been using this flaw to their advantage for a while as well ;D.
So no, really? What is "root?"
You do fine work, sir
posting in a legendary thread
Couldn't you then just use wits "start over" method for part two to make the process even shorter?
netarchy said:
Part 1:
Code:
adb shell rm /data/local/rights/mid.txt
adb shell ln -s /dev/mtd/mtd1 /data/local/rights/mid.txt
adb reboot
Click to expand...
Click to collapse
What would be more interesting is for someone on the new OTA non-root to see if this exists in the Froyo release. I'll look around for a posting of the OTA update non-rooted and try it on my smashed phone. At least I won't care if that thing looses root.
Could we get a "The easiest 1.47.651.1 root method with nand unlock" for dummies? I have no clue what to do with this code.
You need to use an ADB shell for this using the Android SDK....
I tried to use the Evo-Recovery shell and received permission denied errors.
I am not a DEV by any means, and do not claim any credit for any of this. However, for people who need help, this may offer some assistance -- this is definitely the easiest root method out there.
1. Download and Install Android SDK - Learn Here
http://forum.xda-developers.com/showthread.php?t=694250
2. Open up a Command Prompt by holding windows button & pressing R or by pressing Run and typing CMD.
3. Navigate your way in DOS to the Android SDK folder, then to the Tools Folder
4. Then enter in the code in part 1. After each line press enter...the line will repeat below it.
5. Follow Toasts Part 2 -- Link: http://forum.xda-developers.com/showthread.php?t=701835 -- Video found here: http://www.youtube.com/watch?v=tUXTB0eydwE.
5A. Because you didn't do Toast's Part 1 of Root first (you used an exploit provided by the OP), you will NOT have a NAND Backup. Put the Custom ROM you want to load on your SD card, and after unlocking NAND protection and doing the wipes, load it from the custom recovery in lieu of restoring your NAND backup.
6. You're now rooted w/ NAND Unlocked!
7. I would then suggest going here, and running this so you have a fully rooted, stock ROM with all your radio/wimax up to date: http://forum.xda-developers.com/showthread.php?t=715915.
Anyone know if this method will work on an unrevoked3'd Evo? I am trying to acquire full root and I was going to use SimpleRoot today but if this will work...
Thank you for this! Question about number part 7. YOu suggest running the fully rooted stock 1.47.651.1 afterwards. Would it be a bad idea to Just run the fully rooted stock froyo 3.23.651.3 or even any other custom rom for that matter? i.e OMJ's EVO 2.2 Custom rom? Thanks
regulator207 said:
Couldn't you then just use wits "start over" method for part two to make the process even shorter?
Click to expand...
Click to collapse
No because you need the engineering hboot to flash it since it's not signed by HTC.
Should work on 1.32 or 1.47. Nice.
Someone should test if this still works in the new 2.2 update. Good chance it does.
damit!
justinisyoung said:
damn it!
___
Click to expand...
Click to collapse
Hey! That's what I was gonna say!

[ROOT] Easy Root, works with any Stock ROM (Including 2.31.651.7!)

Disclaimer: This is not one-click. However, it IS relatively short and straightforward, and does not require you to downgrade.
Credits: The 743C exploit, and ChainsDD for Superuser.
You need:
Android SDK installed and working.
The zip attached to this post.
If you're still on Cupcake (Android 1.5) you'll need su and Superuser from http://bit.ly/su2361cd
So, let's get down to business.
Unzip the attached file into your /android-sdk/tools/ directory, it'll make your life (and ours) easier.
Open up your command line, change to the SDK tools directory, and enter these commands:
Code:
adb push rageagainstthecage-arm5.bin /data/local/tmp
adb shell chmod 755 /data/local/tmp/rageagainstthecage-arm5.bin
Now execute the exploit:
Code:
adb shell
/data/local/tmp/rageagainstthecage-arm5.bin
Wait for the exploit to finish.
Code:
exit
If it doesn't exit cleanly, chances are it worked, just close your terminal or command prompt and open a new one.
Test that it worked:
Code:
adb kill-server
adb start-server
adb shell
If you see a $, it DID NOT work, execute the exploit again. (Step 3)
If you see a #, it WORKED, continue:
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
exit
adb push su /system/xbin
adb shell chmod 4755 /system/xbin/su
adb install Superuser.apk
You may need to ctrl-c once it says Success!
Next time you 'su' in adb shell, make sure to click Allow in Superuser!
You may instead install Superuser from the Market if you wish.
Clean up the exploit:
Code:
adb shell rm /data/local/tmp/rageagainstthecage-arm5.bin
If you ever do a "Factory Reset", Superuser will go away, but you DO NOT lose root. Just reinstall Superuser.
What next? The choice is yours! Remove stock apps, get some good 'ol WiFi tethering, or flash something different!
*NOTE*
The above steps DO NOT put a recovery on your phone, though it is VERY EASY.
Once you're rooted, install ROM Manager by Koushik Dutta from the Market. Open it up, click "Flash ClockworkMod Recovery".
Select your model (Hero CDMA), and hit Allow when the Superuser Prompt shows up.
*NOTE*
The above steps DO NOT install Busybox on your phone.
Simply install Busybox from Stephen (Stericson), available on the market.
Start the app and click Allow when prompted by Superuser.
How To Uninstall
Code:
adb shell
su
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
rm /system/xbin/su
rm /etc/passwd
rm /etc/group
Uninstall Superuser.apk then reboot, and you're set!
tehdarkknight said:
Disclaimer: This is not one-click. However, it IS relatively short and straightforward.
Credits: The 743C exploit, and ChainsDD for Superuser.
You need:
Android SDK installed and working.
The zip attached to this post.
So, let's get down to business.
Unzip the attached file into your /android-sdk/tools/ directory, it'll make your life (and ours) easier.
Open up your command line, change to the SDK tools directory, and enter these commands:
Code:
adb push rageagainstthecage-arm5.bin /data/local/tmp
adb shell chmod 755 /data/local/tmp/rageagainstthecage-arm5.bin
Now execute the exploit:
Code:
adb shell
/data/local/tmp/rageagainstthecage-arm5.bin
Wait for the exploit to finish.
Code:
exit
If it doesn't exit cleanly, chances are it worked, just close your terminal or command prompt and open a new one.
Test that it worked:
Code:
adb kill-server
adb start-server
adb shell
If you see a $, it DID NOT work, execute the exploit again. (Step 3)
If you see a #, it WORKED, continue:
Code:
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
exit
adb push su /system/xbin
adb shell chmod 4755 /system/xbin/su
adb install Superuser.apk
You may need to ctrl-c once it says Success!
Next time you 'su' in adb shell, make sure to click Allow in Superuser!
That's it!
I won't give directions on installing a recovery or flashing another rom, there are plenty of threads detailing how to do so.
Click to expand...
Click to collapse
Pretty straightforward. This will probably help a lot of newer hero owners, because amazingly, people are still buying them every day!
If I get a chance to test it out, I will.
Nice job. Should be stickied so people don't run around searching through all the old rooting threads which aren't as compatible with the newer RUU versions.
Worked nicely on a refurb Hero that Sprint sent due to the dust problem.
Thanks!
Works great for me
Why am I having trouble doing this? I was able to do it on one Hero though not after many retries, but not on another.
tehdarkknight said:
Disclaimer: This is not one-click. However, it IS relatively short and straightforward, and does not require you to downgrade.
Credits: The 743C exploit, and ChainsDD for Superuser.
Click to expand...
Click to collapse
Great! I can't live without WiFi tethering my iPad which is why I haven't done the 2.31.651.7 HTC OTA update at all.
So, I take it that this exploit will root the Official RUU_Hero_C_Sprint_2.31.651.7_signed_release.exe file then too? I ask because I really don't like to do 'update patches'. I prefer to flash and start fresh so I'm planning on flashing the RUU and then doing this root exploit. Yes, No???
DaWeav said:
Great! I can't live without WiFi tethering my iPad which is why I haven't done the 2.31.651.7 HTC OTA update at all.
So, I take it that this exploit will root the Official RUU_Hero_C_Sprint_2.31.651.7_signed_release.exe file then too? I ask because I really don't like to do 'update patches'. I prefer to flash and start fresh so I'm planning on flashing the RUU and then doing this root exploit. Yes, No???
Click to expand...
Click to collapse
I tested it with the very same RUU, it works.
tehdarkknight said:
I tested it with the very same RUU, it works.
Click to expand...
Click to collapse
SUPER!
Because when I saw this post, I tried to download the latest OTA patch, but my phone just responds 'Your phone is up to date. There are no updates available for your phone'. Strange, because I'm on 2.27.651.6 and the OTAcerts.ZIP is in tact.
Oh well, FEAR NOT, because after I get back from the store this morning, then get the TV tuned to the split screen with football on one and the baseball playoffs on the other, and get Leo Laporte's TechGuy radio show screaming...it'll be the perfect time to flash my phone to factory fresh.
Thanks.
Works perfectly on latest and "greatest" stock ROM... excellent
DaWeav said:
SUPER!
Because when I saw this post, I tried to download the latest OTA patch, but my phone just responds 'Your phone is up to date. There are no updates available for your phone'. Strange, because I'm on 2.27.651.6 and the OTAcerts.ZIP is in tact.
Click to expand...
Click to collapse
Same thing happened to me, that's why I tested this method with the RUU
What are the advantages to ruu'ing to. 7 and rooting again? I rooted my .5 hero and have had no problems....is there something significant that makes the extra work worth it?
Sent from my HERO200 using XDA App
tehdarkknight said:
Same thing happened to me, that's why I tested this method with the RUU
Click to expand...
Click to collapse
Well, I just did the RUU, then did this root, then loaded WiFi Tether, and I'm back in business with my iPad tethering.
Vandelay007 said:
What are the advantages to ruu'ing to. 7 and rooting again? I rooted my .5 hero and have had no problems....is there something significant that makes the extra work worth it?
Click to expand...
Click to collapse
One reason is that when I tried to download the latest OTA update today, I could not. And another reason is before I RUU'd, I had less than 50MB of available memory, but now I have 96MB available with all of my programs loaded again. So for me, it just seems more and more that Android (or HTC Sense) is like Windows boxes since it seems I have to reload the Android OS every now and then to clean things out.
Vandelay007 said:
What are the advantages to ruu'ing to. 7 and rooting again? I rooted my .5 hero and have had no problems....is there something significant that makes the extra work worth it?
Sent from my HERO200 using XDA App
Click to expand...
Click to collapse
Well, if you're using Sprint's official stock .5 rom, with no tweaks applied, you gain the advantage of having an up-to-date rom with the latest bugfixes from Sprint, plus I would say my root method is less invasive and more transparent than other root methods. My personal opinion is that it feels like a root method that can't be abused easily.
SuperOneClick
But I don't need storage space with firerats custom mtd partition....I have over 200mb free with over 50 apps and zero of them on m SD card
Sent from my HERO200 using XDA App
this isnt working.... I can't get passed step 3... my phones just restarts, and then i can't get any further than that.
devonkosa said:
this isnt working.... I can't get passed step 3... my phones just restarts, and then i can't get any further than that.
Click to expand...
Click to collapse
Give us some info. What's your ROM version?
aosp said:
SuperOneClick
Click to expand...
Click to collapse
Is SuperOneClick the same method of rooting?
chiill said:
Is SuperOneClick the same method of rooting?
Click to expand...
Click to collapse
Yes it is....
Ok guyz, I'm going to help yall out !!!!
Look at this and this works I just did it.... any questions pm me then I will post up on here....
http://forum.xda-developers.com/showthread.php?t=803682
This is for rooting your hero and other android devices, even at .7 on the Hero.... I just did this and I laughed at out quick and easy this was... Just make sure you are charge only, and you unzip the downloaded file,.. then open up the SuperOneClickv1.3-ShortFuse.zip on your computer somewhere and open up the SuperOneClick program, and bam you are done....
http://forum.xda-developers.com/atta...5&d=1286657043

[HOW TO?] Install and run 2nd-init for defy

Original post HERE from r2beta0
DANGER!!! Its NOT for Defy! Needs to mobify the 2nd-init first
Hopping some devs to fix it for Defy!
r2beta0 said:
Credit for koush for Droid2 Bootstrap
Credit for edgardcastro for sharing lots of information about 2nd-boot on Milestone1
Credit for Skrilax_CZ for 2nd-init and sh hijack
WARNING: Use this ONLY if you know exactly what you are doing. This guide will make major changes in the /system partition and may turn the phone inoperative. I won’t hold responsibility if you brick your phone or to any damages it may cause.
Pre-requisites: A computer with Android SDK and ADB drivers installed and working. It’s recommended to have RSD Lite 4.9 and the appropriate SBF image just in case anything goes wrong.
This guide was made using a Brazilian Motorola Milestone2 based on Brazil Retail SBF and a computer running Windows Vista 32-bits. I started it from the scratch by flashing my phone with RSD Lite 4.9 and performing a full data/cache wipe, just to make sure any changes were discarded.
Note: Commands that should be entered in command prompt will be listed as: “C:\> <command>”. Commands issued to ADB Shell will be listed as: “# <command>”.
1. Enable USB Debugging on your phone;
2. Get permanent root. I used the app z4root which can be found here on XDA;
3. Install Droid2 Bootstrap. It may be downloaded from Market to support the developer. More info here http://www.koushikdutta.com/2010/08/droid-x-recovery.html;
4. Open Droid2 Bootstrap and click “Bootstrap Recovery”;
5. Use bootstrap to reboot into Clockwork Recovery and backup your phone;
6. Reboot;
7. C:\> adb remount
8. # stop
9. # mkdir /system/etc/rootfs
10. # cp /*.rc /system/etc/rootfs
11. # mkdir /system/etc/init.d
12. # cp /system/bin/sh /system/bin/_sh
13. # cp /init_prep_keypad.sh /system/bin
14. C:\> adb push sh_hijack.sh /system/bin/
15. C:\> adb push 2nd-init /system/bin/
16. C:\> adb push sysinit /system/bin/
17. C:\> adb push sh /system/bin/
18. # chmod 755 /system/bin/sh
19. # chmod 755 /system/bin/sh_hijack.sh
20. # chmod 755 /system/bin/2nd-init
21. # chmod 755 /system/bin/sysinit
22. # ln -s /system/bin/busybox /system/xbin/mount
23. # ln -s /system/bin/busybox /system/xbin/rmdir
24. # ln -s /system/bin/busybox /system/xbin/cp
25. # ln -s /system/bin/busybox /system/xbin/umount
26. # ln -s /system/bin/busybox /system/xbin/run-parts
27. # reboot
28. At this point you should be getting into Clockwork Recovery every time, no matter how many times you have rebooted or if you’ve taken the battery of or not. THIS IS NORMAL. It means that the 2nd-boot + sh hijack is working as it should. The boots into clock recovery are caused by a conflict between sh hijack and logwrapper hijack (used by Droid2 Bootstrap). Continue the guide to fix this issue.
29. In clock recovery menu go to: mounts and storage>mount /system;
30. Open ADB Shell again (it will be available in clockwork recovery as well);
31. # cp /system/bin/logwrapper.bin /system/bin/mylogwrapper
32. C:\> adb pull /system/etc/rootfs/
33. Open init.rc and init.mapphone_umts.rc into a text editor that preserves unix end-line format (e.g.: notepad++). Find all entries of “/system/bin/logwrapper” replacing for “/system/bin/mylogwrapper”.
34. In init.mapphone_umts.rc find entry for “exec /init_prep_keypad.sh” replacing for “exec /system/bin/init_prep_keypad.sh”. Add the following text to the end of this file to be able to run all scripts in /system/etc/init.d at boot time:
Code:
service bootscripts /system/bin/sysinit
class post-zygote_services
disabled
oneshot
35. Save and close.
36. C:\> adb push init.rc /system/etc/rootfs/
37. C:\> adb push init.mapphone_umts.rc /system/etc/rootfs/
38. # chmod 755 /system/etc/rootfs/init.rc
39. # chmod 755 /system/etc/rootfs/init.mapphone_umts.rc
40. Choose “Reboot system now” in clock recovery menu;
You’re all set! Now it is just a matter of changing the rc files in /system/etc/rootfs to customize your system boot.
If you want to log the system boot you may also copy the provided log-init.sh script into /system/etc/rootfs and uncomment the line “exec /log_init.sh” from my init.rc file. Doing so will create the /data/logcat.log file that may get huge in sometime.
2nd-init files and my modified *.rc files attached.
Have fun!
Click to expand...
Click to collapse
As r2beta0 said for defy porting:
r2beta0 said:
It's very likely, since the 2 devices are very similar. Most of the files I attached are from Milestone1 and works perfectly on MS2. Though I recommend you to NOT replace your *.rc files with the attached ones since they could be not compatible. It would be better if you edit your own files. Also try it ONLY if you have a working version of ClockworkMod Recovery (or other custom recovery). You may adapt this guide for your device and post it here on XDA, just remember to mention my name on credits
Click to expand...
Click to collapse
Thanks, that looks interesting. I'll look into it later.
Just a big WARNING: if it behaves at it is described on the Defy, DON'T DO THAT, at least not with Tenfar or Kb7sqi 's CWM recovery ports, as booting into Recovery you won't have root adb shell access.
Someone can explain me what is it?
adlx.xda said:
Just a big WARNING: if it behaves at it is described on the Defy, DON'T DO THAT, at least not with Tenfar or Kb7sqi 's CWM recovery ports, as booting into Recovery you won't have root adb shell access.
Click to expand...
Click to collapse
Install SD Recovery of the market
Disable Debugging
Reboot your phone to the Recovery, while plugged in to a computer
Check if you can use adb... I was able to yesterday
diamond_lover said:
Someone can explain me what is it?
Click to expand...
Click to collapse
I'm guessing this is the first step to being able to go into clockwork mod recovery from a cold boot.
Sent from my Moto Defy using Tapatalk
So, anyone tried? Or is working in that?
So figured I would give this a shot, and well it doesnt work. Phone just sticks at moto logo.
Yes its true in clockwork you cant get root (#) - so I just pulled the .rc files I needed to edit ahead of time and pushed them to the phone before the first reboot. Thus avoiding needing to boot into clockwork after the described bootloop.
If I get time I will play around with this some more.
What is thisss ??
Sent from my MB525 using XDA Premium App
fritolays said:
So figured I would give this a shot, and well it doesnt work. Phone just sticks at moto logo.
Yes its true in clockwork you cant get root (#) - so I just pulled the .rc files I needed to edit ahead of time and pushed them to the phone before the first reboot. Thus avoiding needing to boot into clockwork after the described bootloop.
If I get time I will play around with this some more.
Click to expand...
Click to collapse
or you can just make a flashable zip, which i had no luck with.

Categories

Resources