forked from piotr022/UV_K5_playground
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
48 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,31 @@ | ||
import sys | ||
class FwDecompozer: | ||
def __init__(self, vector_table_size, file): | ||
def __init__(self, vector_table_size, vector_table_address, file): | ||
self.vector_table_size = vector_table_size * 4 | ||
self.vector_table_address = vector_table_address | ||
self.file = open(file, 'rb') | ||
|
||
def save_vector_table(self, filename): | ||
output = open(filename, 'wb') | ||
self.file.seek(0) | ||
self.file.seek(self.vector_table_address, 0) | ||
output.write(self.file.read(self.vector_table_size)) | ||
output.close() | ||
|
||
def save_stripped_fw(self, filename): | ||
def save_part1(self, filename): | ||
output = open(filename, 'wb') | ||
self.file.seek(0) | ||
output.write(self.file.read(self.vector_table_address)) | ||
output.close() | ||
|
||
def save_part2(self, filename): | ||
output = open(filename, 'wb') | ||
self.file.seek(self.vector_table_size, 0) | ||
self.file.seek(self.vector_table_address + self.vector_table_size, 0) | ||
output.write(self.file.read()) | ||
output.close() | ||
|
||
if __name__ == '__main__': | ||
args = sys.argv | ||
fw = FwDecompozer(int(args[1]), args[2]) | ||
fw.save_vector_table(args[3]) | ||
fw.save_stripped_fw(args[4]) | ||
fw = FwDecompozer(int(args[1]), int(args[2]), args[3]) | ||
fw.save_vector_table(args[4]) | ||
fw.save_part1(args[5]) | ||
fw.save_part2(args[6]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters