Skip to content

2nd init Install Instructions

StringCheeseCR edited this page Dec 19, 2011 · 7 revisions

2nd-init Install Instructions

1) Download from current zip from GIT https://github.com/mastafunk/funkstrap-aka-x2boot/zipball/master

2) Extract the contents of the zip

3) On phone mount /system R/W

4) Copy contents of the zip /system to your phones /system
   4a) I first pushed the x2boot folder to /sdcard/ using adb - adb push x2boot /sdcard/
   4b) I then created x2boot in /system on the phone
   4c) I then copied the files from /sdcard/x2boot to /system/x2boot
   (Note: You should then have the following /system/x2boot/rootfs, /system/x2boot/sbin, 
          /system/x2boot/hijack, and /system/x2boot/README)
   4d) Recommended: Change directory to /system/x2boot/sbin and chmod 777 *
       (Some testers have needed to do this to get around permission denied messages in 2nd-init)    

5) Copy the files, not the directories, from your phones / to /system/x2boot/rootfs/
   (note: overwrite the default.prop that came in rootfs)
   (Files to copy from /system to /system/x2boot/rootfs - default.prop, init, init.goldfish.rc,
    init.mapphone_cdma.rc, init.mapphone_umts.rc, init.rc, init_prep_keypad.sh, ueventd.goldfish.rc,
    ueventd.rc, vendor)

6) Change directory to: /system/bin

******************************************************************************************************
*** Warning - if you do step 7 you MUST do steps 8-10 before rebooting or else you will need to SBF ***
*** You can't boot your phone without a mot_boot_mode                                              ***
******************************************************************************************************
7) Rename mot_boot_mode to mot_boot_mode.bin
     Option 1 - Use Root Explorer
     Option 2 - Use Terminal Emulator / ADB as root to run command: mv mot_boot_mode to mot_boot_mode.bin
	 
Steps 8-10 need to be run in Terminal Emulator or ADB shell as su
8) Create a link using the following command: ln -s /system/x2boot/hijack /system/bin/mot_boot_mode
9) Change directory to: /system/x2boot/
10) Run command: chmod 777 hijack (just to be safe)

11) Change directory to: /system/x2boot/rootfs

12) Edit init.rc (To put a logcheck in your new init.rc)
    12a) Find the line - exec /system/bin/mot_boot_mode
         (Note: It's about 3/4 of the way down the file)
    12b) Add this line after it - write /data/2nd-init/inittest 1

13) Clean up /data/2nd-init if it contains files

14) Delete /data/logcat-pre.log if it exists

15) On phone mount / and /system R/0

   Test 2nd-init
   -------------
   1) Shutdown phone
   2) Hold Vol Down button while holding down the Power button
   3) Once Fastboot appears hit Vol Down until you see USB Enum
   4) Press Vol Up
   5) The phone should boot without seeing a green LED   

All logs will be in /data/2nd-init
   
To kill the logging
====================
Reboot without 2nd-init
or
#ps | grep logcat
look for the PID for /sbin/logcat
then type: kill PID  (ex: kill 1370)