Page 1 of 4 123 ... LastLast
Results 1 to 15 of 58

Thread: tvapppatch.tcl support

  1. #1
    Join Date
    May 2004
    Posts
    253

    tvapppatch.tcl support

    tvapppatch.tcl is an alternative to the superpatch family of patchers. It is public domain, and eliminates the need to apply multiple diffs to get support for modern software releases. The release thread is here.
    Last edited by mike_s; 09-27-2016 at 09:43 AM. Reason: point to new release thread

  2. #2
    Join Date
    Aug 2004
    Posts
    4,075
    Thanks! This should help clean up the messy state the superpatch is in. I encourage people to start using this.

    I did run across a bug: there was a missing fconfigure when opening tivoapp for rw access. Some patches get garbled without this.

    I also added a command line option that makes the remounts optional. With this change, you can run this on a linux box as a non-root user, if you like to apply patches off the tivo.

    If you agree with the changes, please update the version in the files forum post.

  3. #3
    Join Date
    May 2004
    Posts
    253
    Thanks, Jamie. Changes made, posted as v1.3

  4. #4
    Join Date
    Sep 2004
    Location
    STL
    Posts
    136

    Nice Job Mike!

    I didn't see anyone giving kudos to this. So here goes,

    I very quickly patched two 9.3.2a-01-2-140 (TCD24004A's) and one
    9.3.2a-01-2-264 (SD-H400)

    Very smooth... thanks for the effort!

  5. #5
    Join Date
    May 2007
    Posts
    456
    I didn't understand how to use it so I went with the supperpatch method.

  6. #6
    Join Date
    Jan 2005
    Posts
    1,008
    Quote Originally Posted by Soapm View Post
    I didn't understand how to use it so I went with the supperpatch method.
    Ok, I'll indulge...let's make things easy.

    First, put both the 'tvapppatch.tcl' and 'tvapppatches.tcl' in the same directory on your tivo. The 'tvapppatches.tcl' file is your "patch" file with all of the tivoapp offsets. The initial release files actually already had the offsets for 9.3.2. and 9.3.2a. By default the script will patch a running tivoapp. So if you had already upgraded and rebooted, and wanted to patch the current running tivoapp (let's say 9.3.2a) you would just run:
    Code:
    ./tvapppatch.tcl
    Now, let's say you already upgraded but didn't reboot yet; so your "new" root filesystem is now mounted on the alternate partition at /mnt. You could patch the new tivoapp before rebooting (saving yourself one reboot!) with something like:
    Code:
    ./tvapppatch.tcl -t /mnt/tvbin/tivoapp
    In this case, you wouldn't need to specify the software version with the -v switch (e.g. -v 9.3.2a-01-2-649) because your tivo already thinks it's upgraded to the latest software and it's waiting for a reboot. Of course, make sure you make a backup copy of tivoapp as the script won't do this automatically with this method.

    One last example; let's say you're patching for software 11.0-01-2-652 which offsets were not included in the distributed 'tvapppatches.tcl' file. So you would take the information here. Unfortunately, that's not tvapppatch friendly, so you'll have to translate. You would want to paste the following into 'tvapppatches.tcl' and then run it as above. Make sure you use a UNIX-friendly text editor (like metapad, etc.) so you don't save DOS-style line endings.
    Code:
    if { [regexp {^11\.0-} $sw] } {set patcha "patch_11.0"}
    array set patch_11.0 {
    0x05ceb74 "104000aa 100000aa"
    0x076e960 "00008021 24100001"
    }
    I recommend tivoapp patch porters also provide the offsets in the 'tvapppatches.tcl' format to simplify use of this utility.
    ScanMan --> Just another Tivo hacker...
    Killhdinitrd SA S2 Monte S2 Unscramble Upgrade Tivo Software

  7. #7
    Join Date
    Dec 2001
    Location
    Seattle, WA
    Posts
    174

    Patching tivoapp...missing "

    I am upgrading a S2 240 model from 9.3-01-2-140 to 9.3.2-01-2-140 by hand. I have run installSw.itcl and copied all of my files over.

    My last step was to run tvapppatch. I want to patch the new tivoapp file in place before booting into 9.3.2-01-2-140 for the first time.

    My new tivo partition is mounted at /tivo (not at /mnt as the example uses)

    The command I ran was:
    ./tvapppatch.tcl -t /tivo/tvbin/tivoapp

    This is the output...

    Code:
    usage: tvapppatch.tcl [-p <patchfile>][-t <tivoappfile>]
                          [-v <sw version>][-confirm yes|no]
                          [-remount yes|no]
    defaults:             -p ./tvapppatches.tcl -t /tvbin/tivoapp
                          -v (running sw) -confirm yes
                          -remount yes
    
    We will be patching /tivo/tvbin/tivoapp.
    
    Patching active TiVo Software version 9.3.2-01-2-140
    Looking for patches in ./tvapppatches.tcl...patch_9.3.2 found!...OK
    Make sure you've backed up your tivoapp!
    Ready to patch (Y/N)? y
    
    Verifying patch locations...OK
    Patching tivoapp...missing "
        while compiling
    "puts stderr "Abort: problem while patching...cleaning up.
          catch {close $tafile}
          catch {file delete -force $options(tmp) }
          if { $opti..."
        invoked from within
    "if { [catch {
          array set patch [array get $patcha]
          file copy $options(t) $options(tmp);
          set tafile [open $options(tmp) r+]
          fcon..."
        (file "./tvapppatch.tcl" line 145)
    Any ideas?

  8. #8
    Join Date
    Aug 2004
    Posts
    4,075
    There is a missing quote character at the end of line 171:
    Code:
          puts stderr "Abort: problem while patching...cleaning up.
    should be:
    Code:
          puts stderr "Abort: problem while patching...cleaning up."
    That's, in itself, probably isn't the problem, but if you fix it you may get more useful error information out.

    It might take a little more effort to capture the error message from the "catch" and report it. Here's an example of how to capture the error message: link.
    Last edited by Jamie; 12-25-2008 at 09:53 PM.

  9. #9
    Join Date
    May 2004
    Posts
    253
    Use your favorite text editor and add a double quote (") to the end of the line, thusly:
    Code:
    puts stderr "Abort: problem while patching...cleaning up."
    Sorry I didn't catch that - it will only have that problem if there's an issue with patching your tivoapp. I can only guess what the problem might be. I assume your /tivo directory a mount point for the "new" partition. Make sure it's mounted RW. tvapppatch.tcl will only remount RW the root (/) partition.

    I'll post a fixed version in a day or two.

  10. #10
    Join Date
    Dec 2001
    Location
    Seattle, WA
    Posts
    174
    Thanks for the help. I added in the missing quote...

    I rebooted into 9.3.2-01-2-140 and decided to try again since this is the more common configuration. I made sure that the file system is mounted RW. However, the patch still fails...

    Code:
    S2-240-TiVo# ./tvapppatch.tcl
    
    tvapppatch 1.3, 12/16/2008
    usage: tvapppatch.tcl [-p <patchfile>][-t <tivoappfile>]
                          [-v <sw version>][-confirm yes|no]
                          [-remount yes|no]
    defaults:             -p ./tvapppatches.tcl -t /tvbin/tivoapp
                          -v (running sw) -confirm yes
                          -remount yes
    
    We will be patching the running tivoapp.
    When done, the patched file will be /tvbin/tivoapp, and
    the running tivoapp will be renamed to /tvbin/tivoapp.foo.
    (it can't be deleted while running)
    
    Patching active TiVo Software version 9.3.2-01-2-140
    Looking for patches in ./tvapppatches.tcl...patch_9.3.2 found!...OK
    Make sure you've backed up your tivoapp!
    Ready to patch (Y/N)? y
    
    Verifying patch locations...OK
    Patching tivoapp...Abort: problem while patching...cleaning up.
    I looked at Jamies link about using catch to trap errors, but looking at the code, it seems like there are already catch statements there.

    Is there any way to get more verbose error descriptions? How can I read the exit code when the program terminates?

    Is there a way I can do the patch manually?

  11. #11
    Join Date
    Dec 2001
    Location
    Seattle, WA
    Posts
    174

    Success!

    After more testing, it turns out I didn't have enough space on hda4 to support a second copy of tivoapp. I moved my backup of tivoapp over to /var and tried again.

    Success!

    Code:
    tvapppatch 1.3, 12/16/2008
    usage: tvapppatch.tcl [-p <patchfile>][-t <tivoappfile>]
                          [-v <sw version>][-confirm yes|no]
                          [-remount yes|no]
    defaults:             -p ./tvapppatches.tcl -t /tvbin/tivoapp
                          -v (running sw) -confirm yes
                          -remount yes
    
    We will be patching the running tivoapp.
    When done, the patched file will be /tvbin/tivoapp, and
    the running tivoapp will be renamed to /tvbin/tivoapp.foo.
    (it can't be deleted while running)
    
    Patching active TiVo Software version 9.3.2-01-2-140
    Looking for patches in ./tvapppatches.tcl...patch_9.3.2 found!...OK
    Make sure you've backed up your tivoapp!
    Ready to patch (Y/N)? y
    
    Verifying patch locations...OK
    Patching tivoapp...OK
    The running tivoapp has been moved to /tvbin/tivoapp.foo.
    it may be removed after a reboot.
    Thanks for everyone's help.

    One other thing...

    Might I suggest you document what the patches are in the tvapppatches.tcl file?

    A bit of research tells me:
    0x0acca34 "14400026 10400026" # 30 second skip
    0x07329c0 "00008021 24100001" # backdoors
    0x05a86a0 "104000aa 100000aa" # NoCSO

    It would be nice if the new database format supported a comment field...

  12. #12
    Join Date
    Aug 2004
    Posts
    4,075
    Quote Originally Posted by FreydNot View Post
    ...

    I looked at Jamies link about using catch to trap errors, but looking at the code, it seems like there are already catch statements there.

    Is there any way to get more verbose error descriptions? How can I read the exit code when the program terminates?

    ...
    Look carefully at the examples in the link I posted. Note the optional 3rd argument to catch (errmsg, in the examples). See the 'catch' documention: link.

  13. #13
    Join Date
    May 2004
    Posts
    253
    I just posted a new version. Fixes the missing quote, improves error reporting, general cleanup.

  14. #14
    Join Date
    Aug 2004
    Posts
    4,075
    Quote Originally Posted by FreydNot View Post
    ...
    One other thing...

    Might I suggest you document what the patches are in the tvapppatches.tcl file?

    A bit of research tells me:
    0x0acca34 "14400026 10400026" # 30 second skip
    0x07329c0 "00008021 24100001" # backdoors
    0x05a86a0 "104000aa 100000aa" # NoCSO

    It would be nice if the new database format supported a comment field...
    We could add another array level with a list of named patches. For example, something like this:
    Code:
    if { [regexp {^9\.3\.2-} $sw] } {set patcha "patchlist_9.3.2"} 
    array set patchlist_9.3.2 { 
        30secskip "patch_9.3.2_30sec" 
        backdoors "patch_9.3.2_backdoors" 
        nocso     "patch_9.3.2_nocso" 
    } 
    array set patch_9.3.2_30sec     { 0x0acca34 "14400026 10400026" } 
    array set patch_9.3.2_backdoors { 0x07329c0 "00008021 24100001" } 
    array set patch_9.3.2_nocso     { 0x05a86a0 "104000aa 100000aa" }
    This is in keeping with the model that the patch list is just tcl code that is sourced.

    tvappatch.tcl would have to be modified to accept this doubly nested array structure, perhaps as an alternative to the flat structure.

  15. #15
    Join Date
    May 2004
    Posts
    253

    1.5 release

    I just posted the 1.5 release. This adds support for optional descriptions, while maintaining compatibility with the Superpatch array format. Also added are "-verbose yes|no" and "-help" options.

    I realize this is a bit different than what was originally suggested. Unfortunately, tcl appears not to allow any way of inserting comments as was suggested. As long as tvapppatch.tcl is run without the "-confirm no" option, you can view the patch descriptions and cancel out when asked.

    Jamie's suggestion would work, but break compatibility with the superpatch array format. I made an executive decision which allows the descriptions to be optional.
    Last edited by mike_s; 12-27-2008 at 04:08 PM.

Posting Permissions

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