[Q] How Can I open/edit Stock System.img

Discussion in 'Android Hacks and Help' started by Raziel23x, Jan 29, 2012.

  1. Raziel23x

    Raziel23x APK Multi-Tools
    Premium Member Developer

    Joined:
    Jul 21, 2010
    Messages:
    351
    Likes Received:
    1
    Trophy Points:
    33
    Location:
    Novi Michigan
    Ratings:
    +1
    Twitter:
    raziel23x
    I am Looking to open and explore the Stock system.img file of the Bionic to compare both 5.5.886 and the 5.5.893 as I want to make some edits and runs some test for my multi-root application that I am working on

    tried to extract it with unyaffs.exe and gotten this error

    Code:
    C:\ISO\android>unyaffs.exe system.img
         8 [main] unyaffs 7224 _cygtls::handle_exceptions: Exception:
    STATUS_ACCESS_VIOLATION
      1025 [main] unyaffs 7224 open_stackdumpfile: Dumping stack trace to
    unyaffs.exe.stackdump
     966072 [main] unyaffs 7224 _cygtls::handle_exceptions: Exception:
    STATUS_ACCESS_VIOLATION
     988583 [main] unyaffs 7224 _cygtls::handle_exceptions: Error while
    dumping state (probably corrupted stack)
    and here is what the unyaffs.exe.stackdump printed out

    Code:
    Exception: STATUS_ACCESS_VIOLATION at eip=004010B0
    eax=4708BC02 ebx=00000034 ecx=00002800 edx=00D216BA esi=00D11695 edi=00000000
    ebp=0028CCB8 esp=0028CC80 program=C:\ISO\android\unyaffs.exe, pid 8860, thread main
    cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
    Stack trace:
    Frame     Function  Args
    0028CCB8  004010B0  (0028CD2B, 00000000, 6120E728, 00401333)
    0028CCE8  004013AF  (00000002, 00CF8368, 00CF8258, 00008000)
    0028CD68  61007038  (00000000, 0028CDA4, 61006980, 7EFDE000)
    End of stack trace


    Not sure what is going on I should try this on another system.img and
    see if it is actually this
     
  2. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    I had to install cygwin on my computer to test this and then place the files
    unyaffs.exe & system.img (one I made on my emulator) into the C:\cygwin\bin folder where the cygwin1.dll is located and here is the result I got.




    unyaffs.exe system.img
    end of image
    C:\cygwin\bin>

    Only problem is if it did anything like extract the files, I have no idea where to look for it.

    I looked in the app folder in cygwin and there are a bunch of apk's there. So I deleted them and ran the command again and they were back. I am guessing all this
    unyaffs.exe does is just pull the apk's out of the .img file. That is the same thing as pulling /system with adb.
    Now, I wrote a batch file to create an system.img that has permanent root and install the Gmail, Google Services, and Market on the AVD. I had the hardest time making the mkfs.yaffs.arm work, but finally pushed to /system/xbin on the emulator and then I called it to make a system.img file that I pasted into the AVD so that the AVD will always boot up with the market and be rooted.

    I posted over on xda. Here is the what I posted.



    Create you AVD the normal way, I usually make my SD card be 512 Meg, leave the skin at default, make my RAM size 512 and in the Hardware section click "New" and choose SDCard support. Then Create.




    Download the zip folder containing the files required:
    http://dl.dropbox.com/u/35546129/Emulator Files.zip


    Unzip the folder and place on your desktop for easy access.


    There is a file, rootavd.bat, that you can run which will do all the command input for you. You must pay close attention because there are things you must do along the way. I stop the execution with pauses and give instructions that must be done by you before you hit a key and proceed.


    If you want to enter the instructions on your own, the content of the .bat file are listed here with instructions. Read the instructions and complete them whichever method you choose.




    1. emulator -avd RootedMarket -partition-size 200


    Change the RootedMarket to the name of your avd.


    If you run the bat file you must right click the rootavd.bat and click edit. The file opens and you change the name of the avd then save it: File > Save.


    pause


    This tells the .bat file to stop and wait until you are ready to proceed with the installation. You do not have to type it in if you are doing manual installation. The point is to wait until your avd is fully loaded before we proceed.


    2. adb remount


    3. adb pull /system/build.prop


    pause


    Minimize the avd and the command window and open the folder Emulator Files. Find build.prop file, right click and choose edit. Toward the bottom of the file you will see the line: ro.config.nocheckin=yes
    Highlight it and erase it then save the file.


    Bring up the command window and hit a key. (If you are running the bat file)


    4. adb remount


    5. adb push build.prop /system/build.prop


    6. adb shell rm /system/app/SdkSetup.apk


    7. adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock03 /system


    8. adb install com.android.apkinstaller-1.apk


    9. adb shell chmod 777 /system/app


    10 adb push GoogleServicesFramework.apk /sdcard/.


    11 adb push com.android.vending-3.1.3.apk /sdcard/.


    12. adb push gmail.apk /sdcard/.


    13 adb push vending.apk /system/app/.


    14. adb push su /system/xbin/su


    15. adb push busybox /system/xbin/busybox


    16. adb push installbusybox.sh /system/xbin/installbusybox.sh


    17. adb shell chmod 06755 /system/*


    18. adb shell chmod 06755 /system/xbin/*


    19. adb install superuser.apk


    20. adb shell installbusybox.sh


    21. adb push mkfs.yaffs2.arm /system/xbin/mkfs.yaffs2.arm


    22. adb shell chmod 777 /system/xbin/mkfs.yaffs2.arm


    23. adb shell /system/xbin/mkfs.yaffs2.arm /system /data/system.img
    Here is where we build a copy of the new rooted system file.


    24. adb pull /data/system.img
    Now we are pulling the system.img file (a large file) to the folder Emeuator Files. It will take about 25 to 30 minuets. Be patient and wait for the message that says how many bites in how many seconds were transferred.


    Close the command window and the avd.


    Open File Emulator folder and copy system.img (should be about 95 Meg)


    Navigate to C: Users > (your name) > .android > AVD > (the name of the avd) and paste the system image into this folder.


    Navigate to your sdk avd manager and start the avd the normal way.


    Here is where my method varies from all others. I pushed all the files that gave me problems to the sd card. I found that pushing vendor.apk, GoogleServicesFramework.apk, and Gmail.apk to /system/app would not work.


    I sent them to the sd card and installed the apk installer app.


    In your app drawer Open APK Installer and choose the GoogleServicesFramework.apk and choose Install. Then do the same with Gmail.apk, and com.android.vending-3.1.3.apk.


    Back up by hitting the "esc" key on your keyboard untill you are in the app drawer. Click on the Market or Gmail app which will take you to the sigh in screen. Log into Google and complete the procedure.


    Then you should be able to go to the Market.


    To test if you are rooted, go to Dev Tools and scrool to Emulator at the bottom. Open the emulator and you should be asked to grant superuser rights. Choose yes and then type su into the emulator. You should be rewarded with a "#" prompt.


    I wanted to install Root Explorer in this set up; however, it is a paid app that you should purchase on your own and install.


    That is it. Everytime you load this avd it will be rooted and you will have access to the Market. The Market is limited, not like on a real phone because the AVD does not associate with a particular phone which causes the filters at the market from presenting you with all apps available.yaffs2 /dev/block/mtdblock03 /system.

    I hope this helps you, I am just a tinker not a real programmer.
     
    #2 chrstdvd, Feb 6, 2012
    Last edited: Feb 6, 2012
  3. xbill

    xbill New Member

    Joined:
    Jun 13, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    @chrstdvd,
    Thanks for your guide - it has been very helpful.

    After many attempts with other methods to pull the system.img from the emulator, I followed your steps. The emulator was rooted, but trying to install the GoogleServicesFramework.apk from the sdcard threw an error. Something along the lines of: "Package could not be parsed" I pushed the GoogleServicesFramework.apk to the sdcard again, but the same error resulted. The com.android.vending-3.1.3.apk and gmail.apk seemed to install, but when I attempt to run them they force close. I deleted the avd I was working with and created a new one, but the same results. Do I need to use a particular target platform: 2.3.1, 2.3.3, etc ? What's the difference between the Vending.apk and the com.android.vending-3.1.3.apk?

    Any help would be appreciated.
     
    #3 xbill, Apr 4, 2012
    Last edited: Apr 4, 2012
  4. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    Only thing that comes to mind is that when you built your AVD, in the Hardware section did you click New, and scroll down and highlight SD Card support? If not that may be where the problem is coming from.

    Here is a screen shot of My rooted AVD's in the manager.
    View attachment 48867

    I chose one in the Edit window for you to compare.
    View attachment 48866

    If that does not do it for you, then you can try to push the GoogleServicesFramework.apk directly to /system/app instead of the SD Card.

    Let me know, if that fixes the bug for you by placing SD Card support into Hardware section of AVD.

    You can look at this file or set of files which will pull /system from phone to the folder on computer, but not all files and folders. I got tired of messing with it, but it is good enough to save copies of all your /system/app apk's.

    http://dl.dropbox.com/u/35546129/Pull system.zip

    I can upload one of my working AVD's to Dropbox if you want one to play with.

    By the way ICS or 4.0's emulator is to small to do much with, there is not enough system memory to add many apps, so I can not get market or gmail or any other cool stuff to install in it.
     
    #4 chrstdvd, Apr 4, 2012
    Last edited: Apr 4, 2012
  5. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    Oh, The market and Gmail will force close until the GoogleServicesFramework is installed on the emulator, that is why I said that if you can not get it to install from the SD card just push it to /system/app. I have no idea what the difference between Vending.apk and the 3.1.3 are except 3.1 is newer and you get a few more application choices form the Market when it is installed on Emulator.
    .
     
  6. xbill

    xbill New Member

    Joined:
    Jun 13, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    I went ahead and started over. I deleted the original avd and built a new one. Yes, as before, with sdcard support. I made a bigger sdcard (512MB), too.

    This time, I targeted 2.3.3 and I've gotten a bit farther. Although, now my problem is my Google account. I get "Can't establish a reliable data connection to the server." My host system is Windows XP Pro SP3. Firewall is disabled.
    I checked the Date & Time thinking maybe the difference in the time would make the Google server balk. Time is now correct, but it made no difference.
    I can browse with the browser. But, I can't access a Google account and can't run Market with out one.
     
  7. xbill

    xbill New Member

    Joined:
    Jun 13, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    Got it working. I shutdown the rooted emulator. cleared the cache. changed my host laptop from wireless to wired network. restarted the rooted emulator. reinstalled the apks. Market updated to Google Play. seems to be working. Some apps unavailable to emulator. Maybe there's a hack for that too?
     
  8. xbill

    xbill New Member

    Joined:
    Jun 13, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    Is there a way to mod the system.img prior to rebuild and pulling to remove the Japanese IME and make the standard Android keyboard the default?
     
  9. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    Glad to hear you got it working. I had the same problem with my Google account many times. I thought it was because I use Hughes Net as my ISP, you know, if a cloud is in the way, you can not connect. I literally thought that because the first day was stormy, the next day I loaded the thing, the weather was fine, and it worked.

    I do not know anything about an IME. I Googled "What is .." and still do not really know what it is. Later today I will go to the developers web page and search for IME, maybe I will get a better understanding.

    As far as the Market goes, it offers apps based on what your system tells it your phone is. Comes from the build.prop file. I tried pulling the build.prop file from my Droid 2 and my Charge and putting it into the emulator to see if I could fool the Market, but there must be something else involved because I did not get it to work.
     
  10. chrstdvd

    chrstdvd Member

    Joined:
    Sep 30, 2010
    Messages:
    577
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    McKenney Va
    Ratings:
    +0
    Glad to hear you got it working. &nbsp;I had the same problem with my Google account many times. &nbsp;I thought it was because I use Hughes Net as my ISP, you know, if a cloud is in the way, you can not connect. &nbsp;I literally thought that because the first day was stormy, the next day I loaded the thing, the weather was fine, and it worked.<br><br>I do not know anything about an IME. &nbsp;I Googled "What is .." and still do not really know what it is. &nbsp;Later today I will go to the developers web page and search for IME, maybe I will get a better understanding.<br><br>As far as the Market goes, it offers apps based on what your system tells it your phone is. &nbsp;Comes from the build.prop file. &nbsp;I tried pulling the build.prop file from my Droid 2 and my Charge and putting it into the emulator to see if I could fool the Market, but there must be something else involved because I did not get it to work.
     
Search tags for this page
android system img editor
,
android system.img manipulate
,
cygwin extract system.img
,
extract system.img
,
how to extract system img android
,
how to open android img files
,
open android img file
,

open system.img android

,

unyaffs status access violation

,
unyaffs system.img