Results 1 to 13 of 13

Thread: [HACK] 2nd-init

  1. #1
    Skrilax_CZ's Avatar
    offline Retired Moderator
    Join Date
    Feb 2007
    Location
    Prague
    Posts
    5,244
    Thanks
    1,881
    Thanked 3,138 Times in 1,338 Posts
    Downloads
    28
    Uploads
    29

    Troubleshooting [HACK] 2nd-init

    This is mainly for ROM developers - allows you to "restart" init process with your custom binary and custom rc scripts. Technically using code injection the code to call "execve("/init", {"/init", NULL**, environ);" is injected and the environ variables are read from /proc/1/environ by the binary.

    It has to be combined with the "sh hijack". Info & download is here:
    2ndinit [And Developers]

    So Milestone XT720 users will soon get a "bootstrap" version of Open Recovery
    Last edited by Skrilax_CZ; 10-11-2010 at 01:40 AM.

    Thanks Semseddin for the signature and avatar.

  2. 6 Users Say Thank You to Skrilax_CZ For This Useful Post

    dext3r (10-11-2010), Fran_Z6 (10-13-2010), kidscracker (10-12-2010), Protector (10-11-2010), SuperJoker (10-11-2010), West44 (10-12-2010)

  3. #2
    offline Developer
    Join Date
    May 2010
    Posts
    94
    Thanks
    13
    Thanked 81 Times in 30 Posts
    Downloads
    10
    Uploads
    0
    Hi Skirlax, I wuould love to have more delucidations about the 2nd-init and the sh hijack (of wich I've didn't find anything)
    Now, I'm interested on creating a custom init.rc for my Rom, but where to start?
    In what does it differ from the Ramdisk method of dexter? (in both good and bad way)

    Would love to have some informations because I'm very intrested in this type of hack, and maybe some links or file example wuould help me

    Thx a lot for your time

  4. #3
    Skrilax_CZ's Avatar
    offline Retired Moderator
    Join Date
    Feb 2007
    Location
    Prague
    Posts
    5,244
    Thanks
    1,881
    Thanked 3,138 Times in 1,338 Posts
    Downloads
    28
    Uploads
    29
    It's a "evolution" of that method (that was being used by dext3r and nadlabak in older CM) - so no cons.

    What they did was starting the "init" instance for a second time - thus there were two init instances; the original one "frozen" and the second one doing the job. What you call "Ramdisk method" - this is nothing else than replacing the init, init.rc, etc. from the signed ramdisk image. 2nd-init only changes the way how the new init is called - which is by injecting code to the original init basically to restart itself (look on execve manual) - but if you replaced it, it will restart into the new one.

    "sh hijack" - in init process, a script is called in very early stage (called "init" as well) - basically it calls /system/bin/sh. Now the "sh" doesn't have to be the shell, it can be your own program which will do the necessary things to call 2nd-init and ensures that future calls to sh are handled normally (mounts sh to the real shell binary). An example is shown in the newest CM.

    Thanks Semseddin for the signature and avatar.

  5. #4
    offline Developer
    Join Date
    May 2010
    Posts
    94
    Thanks
    13
    Thanked 81 Times in 30 Posts
    Downloads
    10
    Uploads
    0
    oh MANY thanks
    Now I'm starting to understand something xD I'll read execve manual ASAP;
    Just a curiosity, INIT calls /system/bin/sh, But when I create a rom,The backup will not contain /system/bin (and even /sbin) so how can I call a Custom sh? (I mean, I have to create a Rom by update.zip or there is another method)?

  6. #5
    Skrilax_CZ's Avatar
    offline Retired Moderator
    Join Date
    Feb 2007
    Location
    Prague
    Posts
    5,244
    Thanks
    1,881
    Thanked 3,138 Times in 1,338 Posts
    Downloads
    28
    Uploads
    29
    The /system partition can be fully customised. Thus you can have your own /system/bin/sh.

    Thanks Semseddin for the signature and avatar.

  7. The Following User Says Thank You to Skrilax_CZ For This Useful Post:

    89luca89 (10-22-2010)

  8. #6
    offline Developer
    Join Date
    May 2010
    Posts
    94
    Thanks
    13
    Thanked 81 Times in 30 Posts
    Downloads
    10
    Uploads
    0
    But I mean, I do not know how to create an update.zip installation for a Rom, so I use Nandroid, and nandroid does not backup /system/bin part!!

  9. #7
    Skrilax_CZ's Avatar
    offline Retired Moderator
    Join Date
    Feb 2007
    Location
    Prague
    Posts
    5,244
    Thanks
    1,881
    Thanked 3,138 Times in 1,338 Posts
    Downloads
    28
    Uploads
    29
    It does back it up.

    Thanks Semseddin for the signature and avatar.

  10. #8
    offline Developer
    Join Date
    May 2010
    Posts
    94
    Thanks
    13
    Thanked 81 Times in 30 Posts
    Downloads
    10
    Uploads
    0
    ok nice,
    I',ll try to boot a sh hijack with the original init.rc with just a line or 2 modded only to see how it goes

  11. #9
    offline Itty Bitty Modder
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Downloads
    12
    Uploads
    0
    what about open recovery for XT720 ?

    P.S sorry for my english

  12. #10
    Skrilax_CZ's Avatar
    offline Retired Moderator
    Join Date
    Feb 2007
    Location
    Prague
    Posts
    5,244
    Thanks
    1,881
    Thanked 3,138 Times in 1,338 Posts
    Downloads
    28
    Uploads
    29
    The 1.46 will be released also for the XT720.

    Thanks Semseddin for the signature and avatar.

  13. #11
    offline Itty Bitty Modder
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Downloads
    12
    Uploads
    0
    It is possible at least approximate date of release?

  14. #12
    Skrilax_CZ's Avatar
    offline Retired Moderator
    Join Date
    Feb 2007
    Location
    Prague
    Posts
    5,244
    Thanks
    1,881
    Thanked 3,138 Times in 1,338 Posts
    Downloads
    28
    Uploads
    29
    Posted testing version.

    Thanks Semseddin for the signature and avatar.

  15. #13
    offline Itty Bitty Modder
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Downloads
    12
    Uploads
    0
    thank you!!!
    Last edited by NeoBeZ; 11-18-2010 at 02:09 AM.

LinkBacks (?)

  1. 10-11-2010, 04:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •