patchrom help

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

  1. 1982Strand

    1982Strand Members

    Trophy Points:
    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. Google Adsense

  3. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    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.
  4. 1982Strand

    1982Strand Members

    Trophy Points:
    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?
  5. 1982Strand

    1982Strand Members

    Trophy Points:
    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.
  6. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    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.
  7. 1982Strand

    1982Strand Members

    Trophy Points:
    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?
  8. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    You modify the files in the /root directory of the phone your modifying. Don't touch any of the files in the /temp directory.
  9. 1982Strand

    1982Strand Members

    Trophy Points:
    40
    Ha, ok thanks :) Completely missed that, feeling stupid right now! :D
  10. silentvisitor

    silentvisitor Members

    Trophy Points:
    3
  11. 1982Strand

    1982Strand Members

    Trophy Points:
    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!
  12. silentvisitor

    silentvisitor Members

    Trophy Points:
    3
    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 !
  13. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    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.
  14. 1982Strand

    1982Strand Members

    Trophy Points:
    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 :) :)
  15. silentvisitor

    silentvisitor Members

    Trophy Points:
    3
    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.
  16. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    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.
  17. silentvisitor

    silentvisitor Members

    Trophy Points:
    3
    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....:(
  18. iBotPeaches

    iBotPeaches Script Gatekeeper Staff Member

    Trophy Points:
    335
    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 :/
  19. silentvisitor

    silentvisitor Members

    Trophy Points:
    3
    But GB version tarball was around 380Mb only and i downloaded it within an hour.
  20. 1982Strand

    1982Strand Members

    Trophy Points:
    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 :)
  21. 1982Strand

    1982Strand Members

    Trophy Points:
    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?

Share Our Site