Default [How To]Patch up HTC ROM with OTA zip

This is something I think several will find handy so they can rebase ROM's easier.
I posted this just before here: http://forum.xda-developers.com/show...postcount=1162
This method is entirely based on work done by gee one which was posted in this thread: http://forum.xda-developers.com/show....php?t=1286731

You can use my existing thread that tracks OTA updates from HTC
http://forum.xda-developers.com/show....php?t=2119610

Which more recently I have been keeping up to date based on Fota Fetcher originally written by dagobertduck based on method by Dr_Death.
http://forum.xda-developers.com/show...php?p=39278313


This describes the process of patching Telstra 3.17.841.2 base with 3.17.841.9 update.
The first release for each carriers Jellybean has been a full base so far, so are a great point to work from.
Handy since RUU's have been less than available since Football exiting stage left just before Jellybean came out.

This process could be adapted in many ways including using an arm apply_patch on an arm machine etc.
Hopefully I do not skim over some of the finer details and have left it in a way that is easy enough to follow.

1)install Linux(eg Ubuntu) on a x86 machine I personally tested Ubuntu 64bit.

2)get base rom http://fotadl.htc.com/OTA_EVITA_UL_J...svcm80o4g1.zip
3)extract to /HTC/3.17.841.2
4)get ota update rom http://fotadl.htc.com/OTA_EVITA_UL_J...s4ml1cuukv.zip
5)extract to /HTC/3.17.841.9

6)create folder /HTC/patched

7)Compile or download an apply_patch for x86 (gee one posted here: http://forum.xda-developers.com/show...9&postcount=10 )
8)rename applypatch_static to apply_patch
9)make sure its executable; chmod 755 apply_patch
10)move to somewhere convenient like /usr/bin; sudo cp apply_patch /usr/bin/

11)Use gee one's script to convert an Android updater-script ( http://forum.xda-developers.com/show...7&postcount=12 )
12)Paste that in to a text file and name it something eg createscript
13)make it executable; chmod 755 createscript
14)place in /HTC

15)copy /HTC/3.17.841.9/META-INF/com/google/android/updater-script to /HTC
16)./createscript
17)./extract_source ./3.17.841.2/system ./patched **optional
18)./delete_source ./3.17.841.2/system **not required for Telstra 3.17.841.9
19)./tf_file ./patched/3.17.841.2 ./3.17.841.9 **could be pointed at ./3.17.841.2 if you did not want step 17

20)overwrite /HTC/3.17.841.2/system with /HTC/patched/3.17.841.2/system; cp -R ./patched/3.17.841.2/system ./3.17.841.2 **if step 17 done
21)overwrite /HTC/3.17.841.2/system with /HTC/3.17.841.9/system; cp -R ./3.17.841.9/system ./3.17.841.2

22)repackage your rom in /HTC/3.17.841.2/system



Or something like that. Good luck!

createscript uses working dir to find a updater-script - converts script
extract_source input_system_dir output_system_dir - extract files that need updating, perhaps safer than working on the main file set
delete_source input_system_dir - removes files that updater-script was going to remove
tf_file input_rom_dir patch_file_dir - patch files

As a side note users might also like to flash the firmware.zip that ships in OTA zips etc.
I posted instructions for that here:
http://forum.xda-developers.com/show...postcount=1400
Please read that some firmware.zip are very partial updates and may only update portions of the bootloader which could leave your device in a broken state.