patchrom help

Discussion in 'Porting Advice/Help' started by 1982Strand, Apr 23, 2012.

  1. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Hey guys.
    I'm working with the patchrom and i get an error i'm having a hard time solving.

    It's in the signing process, here's my output:

    /media/DATA/patchrom/tools/sign.sh >/dev/null sign.zip out/ZIP
    /media/DATA/patchrom/tools/sign.sh: line 47: zipalign: command not found
    mv: (translated from danish: can't execute) stat() on 'out/ZIP/system/app/Exchange.apk.signed.aligned': No such file or directory
    /media/DATA/patchrom/tools/sign.sh: line 47: zipalign: command not found
    (and then a lot of the same errors for the different apks)

    And here's the part from the sign.sh regarding the error:

    function sign_for_dir() {
    echo ">>> Sign apks under dir $1..."
    for apk in `find $1 -name "*.apk"`
    do
    echo ">>> Sign for $apk"
    delete_meta_info $apk
    java -jar $SIGNAPK $PEMKEY $PK8KEY $apk $apk.signed
    zipalign 4 $apk.signed $apk.signed.aligned ----- line 47
    mv $apk.signed.aligned $apk
    rm $apk.signed
    done

    And i believe it's NOT error in PATH, i can write java, or zipalign from anywhere.
    It seems to me the java command in line 46 isn't doing it's job for some reason unknown to me :(

    Anyone got a clue on how i can fix this?

    Btw, tried googling a solution, but help is VERY limited with this.. Already tried changing line 47 to:

    ./zipalign 4 $apk.signed $apk.signed.aligned

    and

    zipalign -f -v 4 $apk.signed $apk.signed.aligned

    Both without luck... Putting the zipalign file in /patchrom/tools/ folder didn't do it either..
    Thanks guys, hope someone can help me out :)
     
  2. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    So your telling me if you run

    zipalign at the command line, it will run?

    Code:
    /media/DATA/patchrom/tools/sign.sh: line 47: zipalign: command not found
    This line says otherwise.
     
  3. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Well, funny thing is, it depends wether i type "su" in terminal first or not. works fine in terminal without su. It's with su i get the problem. (And i need to run the patchrom in su or i get a lot of permission denied errors..)
    If i go to the android sdk tools directory (or just anywhere), then type zipalign, it STILL says command not found. If i type ./zipalign it works. And if i drag the zipalign file into the terminal and just press enter, it works. I'm pretty confused here now.
    This is my PATH entries in .bashrc:

    Code:
    # Android tools
    export PATH=$PATH/home/dan/Android/sdk/tools:/home/dan/Android/sdk/platform-tools
     
    # Java
    export PATH=${PATH}:~/Programmer/jdk
    PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/dan/Programmer/jdk:/home/dan/bin:/home/dan/Programmer/jdk1.6.0_31:/home/dan/Programmer/jdk/bin:/home/dan/bin:/home/dan/Programmer/jdk1.6.0_31/bin
    (I got the sdk installed to home/dan/Android/sdk...)

    But do i need to make another entry, pointing directly to the zipalign file and how would that entry look like? Do i need to edit other files than the .bashrc?
     
  4. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    i just saw that i get 2 different outputs when running echo $PATH with and without running su first..

    If i instead run sudo su -p (googled it), the output of echo $PATH is the same, i.e. i can run zipalign from anywhere in the terminal.
    I ran the entire build process again and now IT WORKS! :D

    I Have NO idea what the difference is bewteen su and sudo su -p, or what it means, but it worked.. Thank god.
     
  5. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    su is root, so they'll have different HOME directories. The HOME directories is where that bashrc file is stored, which stores paths.

    I'd try and run everything not under SU. Make your scripts work under your username. Fix that path for you.
     
  6. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Yeah, now it's just those pesky rejects i gotta deal with ;)

    And to clear that up, to manually fix a reject, by creating a diff patch, i need to edit the smali file in the dst_smali_orig directory, right?

    I noticed that when comparing the smali created from my base rom (when making workspace) to the smali in dst_smali_orig, it's not completely identical, besides the .line removals of course. I mean, i see more stuff removed from the base source smali. Is this on purpose by patchrom, or should i add these removed lines again?
     
  7. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    You modify the files in the /root directory of the phone your modifying. Don't touch any of the files in the /temp directory.
     
  8. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Ha, ok thanks :) Completely missed that, feeling stupid right now! :D
     
  9. silentvisitor

    Mar 21, 2012
    20
    3
    13
    Male
  10. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Well, i can't remember exactly how long it took to sync, but i does take a while. Like half an hour to an hour, depending on your connection. And yes, it's quite large :)
    I run all commands in patchrom as root, to avoid permissions (and PATH) problems. But if you have better knowledge in linux than me (almost everyone has, hehe) then you can setup your environment the right way and run all commands normally..

    And that guide you're following, i can't help you with that - it looks like a manual porting guide not using patchrom.. If you want to use the patchrom, there are several guides around. (Which i read to get where i'm at now..) :)

    The logs you posted shows like a million errors. Don't even know where to start with those, sorry.
    You need to find some guys already developing ROMS for your device and ask them about this, they would be a lot more capable of helping you out :) Good luck!
     
  11. silentvisitor

    Mar 21, 2012
    20
    3
    13
    Male
    Thanks for your reply :)
    Could you plz lnk me to the guide which you followed ? Approx what was the size of the download/Directory ?
    Thank you so much !
     
  12. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    My directory is 4.6GB, but I have lots of other non-repo files in there. So i'd venture to say somewhere from 2GB to 3GB. Takes me about 20 minutes to sync from scratch.

    I'd recommend using the .bashrc and PATH correctly instead of using ROOT. Make like /usr/local/bin a PATH object, then dump all your wrapper scripts in there (like apktool and what not), and then add the PATH to the sdk and platform-tools folder (to allow aapt to work).

    Then your good.
     
  13. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Yes. Mr. Peaches is right :) I'm following his advice and trying to get things running "non-root".
    And about the guides, start with reading the developer guide from github, also read about the issues people have had there, then search on google/xda, read the threads about patchrom. Well, that worked for me, i'm not a programmer/developer, so i'm working from the trial and error principle :) :)
     
  14. silentvisitor

    Mar 21, 2012
    20
    3
    13
    Male
    20 minutes ??? It took me around 12 hours cause it was syncing at 12-13kbps only :( and then finally stopped at some point and never progressed. After waiting for 2 hours I finally had to close the Terminal :(
    I was using ~/bin. Is that alright ? Android-SDK is in there too and added to PATH.
     
  15. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    Your internet is the probably 12-13kbps would take forever. I was downloading at like 20mbps. You need to get at the lowest 90kbps to have any chance at downloading this.
     
  16. silentvisitor

    Mar 21, 2012
    20
    3
    13
    Male
    Haha...no Sir, only this was syncing at that speed. Other files were still downloading at 100-128kbps (yeah I know its still slow :( ) Wait...20Mbps ??? Wow.........that's cool :)
    Is it possible to have tarball like the GB version ? It was easier that way. I know syncing is the better method to get updates every week but still....:(
     
  17. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    If I tarball the download. It will be like 7.8GB. So then that will murder my server for that persistent connection of your slow download :/
     
  18. silentvisitor

    Mar 21, 2012
    20
    3
    13
    Male
    But GB version tarball was around 380Mb only and i downloaded it within an hour.
     
  19. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Okay.. So i'd like to ask another question, in regards to the patchrom..
    I've run into another error, all of a sudden, which looks like this:


    Code:
    unzipping target target-files...
     
    using device-specific extensions in .
     
    using prebuilt boot.img...
     
    Traceback (most recent call last):
     
    File "/root/patchrom/tools/releasetools/ota_from_target_files", line 846, in
     
    main(sys.argv[1:])
     
    File "/root/patchrom/tools/releasetools/ota_from_target_files", line 814, in main
     
    WriteFullOTAPackage(input_zip, output_zip)
     
    File "/root/patchrom/tools/releasetools/ota_from_target_files", line 430, in WriteFullOTAPackage
     
    if boot_img and not device_specific.WriteRawImage("/boot", "boot.img"):
     
    File "/root/patchrom/tools/releasetools/common.py", line 687, in WriteRawImage
     
    return self._DoCall("WriteRawImage")
     
    File "/root/patchrom/tools/releasetools/common.py", line 655, in _DoCall
     
    return getattr(self.module, function_name)(*((self,) + args), **kwargs)
     
    File "./releasetools.py", line 6, in WriteRawImage
     
    info.script.Mount("/cust")
     
    File "/root/patchrom/tools/releasetools/edify_generator.py", line 138, in Mount
     
    p = fstab[mount_point]
     
    KeyError: '/cust'
    I didn't change anything in the files mentioned, so i'm not sure what i'm looking for here.. The files i got are identical to the ones on github.
    Any tips are welcome :)
     
  20. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Oh, one more thing, a little off topic.. If Mr. Peaches is reading, is it possible to build your mod of apktool from github? And if so, how? I'd like to test it if i may?
     
  21. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    People started taking my work and releasing it at XDA as there own. I'm no longer pushing updates to that apktool until its finished. Only a couple of MA Staff have access the updated 1.4.6 build. Sorry :(
     
  22. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Ok, i understand :) People are d*cks!
    Looking forward to see it finished!
    Btw, any ideas about the error i get? Thanks for all your help..
     
  23. iBotPeaches

    iBotPeachesScript Gatekeeper

    Oct 31, 2011
    3,811
    1,110
    335
    Kansas
    Post the contents of YOUR ROM folder/metadata/recovery.fstab for me.

    I think that might be it.
     
  24. 1982Strand

    1982StrandMembers

    Apr 2, 2011
    204
    10
    40
    Here you go:

    Code:
    # mount point    fstype        device            [device2]
     
    /boot        mtd        boot
    /cache        yaffs2        cache
    /data        yaffs2        userdata
    /misc        mtd        misc
    /recovery    mtd        recovery
    /sdcard        vfat        /dev/block/mmcblk0p1    /dev/block/mmcblk0
    /system        yaffs2        system
    /sd-ext        ext3        /dev/block/mmcblk0p2
    EDIT: SOLVED. By simply copying the metadata folder from the "honor" directory into my devices folder.. But i wonder if there are any "sideeffects" from this?
     
  25. ingbrzy

    ingbrzyXiaomi.eu Multilang leader
    Staff Member

    Hello.. I have problem with make fullota with patchrom...

    it has this error..

    ingbrzy@ingbrzy-ubuntu:~/patchrom/i9100$ make fullota
    >>> Install framework resources for apktool...
    install framework-miui-res.apk
    /home/ingbrzy/patchrom/tools/apktool --quiet if /home/ingbrzy/patchrom/miui/system/framework/framework-miui-res.apk
    unzip >/dev/null stockrom.zip "system/framework/*.apk" -d out
    install out/system/framework/twframework-res.apk
    install out/system/framework/framework-res.apk
    <<< install framework resources completed!
    >>> build out/framework-res.apk...
    add miui overlay resources
    /home/ingbrzy/patchrom/tools/remove_redef.py >/dev/null out/framework-res
    /home/ingbrzy/patchrom/tools/apktool --quiet b out/framework-res out/framework-res.apk
    Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL1678287356629398603.tmp, -x, -S, /home/ingbrzy/patchrom/i9100/out/framework-res/res, -M, /home/ingbrzy/patchrom/i9100/out/framework-res/AndroidManifest.xml]
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:193)
    at brut.androlib.Androlib.buildResourcesFull(Androlib.java:301)
    at brut.androlib.Androlib.buildResources(Androlib.java:248)
    at brut.androlib.Androlib.build(Androlib.java:171)
    at brut.androlib.Androlib.build(Androlib.java:154)
    at brut.apktool.Main.cmdBuild(Main.java:182)
    at brut.apktool.Main.main(Main.java:67)
    Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, /tmp/APKTOOL1678287356629398603.tmp, -x, -S, /home/ingbrzy/patchrom/i9100/out/framework-res/res, -M, /home/ingbrzy/patchrom/i9100/out/framework-res/AndroidManifest.xml]
    at brut.util.OS.exec(OS.java:87)
    at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.java:191)
    ... 6 more
    Caused by: java.io.IOException: Cannot run program "aapt": java.io.IOException: error=13, Permission denied
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:475)
    at java.lang.Runtime.exec(Runtime.java:610)
    at java.lang.Runtime.exec(Runtime.java:483)
    at brut.util.OS.exec(OS.java:78)
    ... 7 more
    Caused by: java.io.IOException: java.io.IOException: error=13, Permission denied
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:468)
    ... 10 more
    make: *** [out/framework-res.apk] Error 1


    Do you know help me..?

    trying building SGS2 build... thx...


    EDIT:

    SOLVED
     

Share Our Site