summaryrefslogtreecommitdiffstats
path: root/tools/fwpatcher
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2006-01-12 10:12:34 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2006-01-12 10:12:34 +0000
commitbdf6f1c559a1037e65a17a8c1a756311d37f7564 (patch)
tree481527a237b679a260ffe6c5f09208126e762cb9 /tools/fwpatcher
parent728d46f567860615c0d3d5eec352a5f0e6b1f38a (diff)
downloadrockbox-bdf6f1c559a1037e65a17a8c1a756311d37f7564.tar.gz
rockbox-bdf6f1c559a1037e65a17a8c1a756311d37f7564.tar.bz2
rockbox-bdf6f1c559a1037e65a17a8c1a756311d37f7564.zip
Script to create the MD5 sum files for fwpatcher
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8344 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/fwpatcher')
-rwxr-xr-xtools/fwpatcher/mksums.pl69
1 files changed, 69 insertions, 0 deletions
diff --git a/tools/fwpatcher/mksums.pl b/tools/fwpatcher/mksums.pl
new file mode 100755
index 0000000000..99786fe161
--- /dev/null
+++ b/tools/fwpatcher/mksums.pl
@@ -0,0 +1,69 @@
+#!/usr/bin/perl
+
+# This script creates the h100sums.h and h300sums.h files for fwpatcher.
+#
+# It expects a file tree with scrambled and descrambled
+# firmwares like this:
+# orig-firmware/
+# h1xx/
+# 1.66jp/
+# ihp_100.bin
+# ihp_100.hex
+# ihp_120.bin
+# ihp_120.hex
+# h3xx/
+# 1.29jp/
+# H300.bin
+# H300.hex
+# etc.
+#
+# It also expects the bootloader binaries in the current directory:
+# bootloader-h100.bin
+# bootloader-h120.bin
+# bootloader-h300.bin
+
+$orig_path = "~/orig-firmware";
+
+mksumfile("100");
+mksumfile("120");
+mksumfile("300");
+
+sub mksumfile {
+ ($model) = @_;
+
+ open FILE, ">h${model}sums.h" or die "Can't open h${model}sums.h";
+
+ print FILE "/* Checksums of firmwares for ihp_$model */\n";
+ print FILE "/* order: unpatched, patched */\n\n";
+
+ if($model < 300) {
+ foreach("1.63eu","1.63k", "1.63us", "1.65eu","1.65k", "1.65us",
+ "1.66eu", "1.66k", "1.66us", "1.66jp") {
+ `../mkboot $orig_path/h1xx/$_/ihp_$model.bin bootloader-h$model.bin ihp_$model.bin`;
+ `../scramble -iriver ihp_$model.bin ihp_$model.hex`;
+ $origsum = `md5sum $orig_path/h1xx/$_/ihp_$model.hex`;
+ chomp $origsum;
+ ($os, $or) = split / /, $origsum;
+ $sum = `md5sum ihp_$model.hex`;
+ chomp $sum;
+ ($s, $r) = split / /, $sum;
+ print FILE "/* $_ */\n";
+ print FILE "{\"$os\", \"$s\"},\n";
+ }
+ } else {
+ foreach("1.28eu", "1.28k", "1.28jp", "1.29eu", "1.29k", "1.29jp",
+ "1.30eu") {
+ `../mkboot -h300 $orig_path/h3xx/$_/H$model.bin bootloader-h$model.bin H$model.bin`;
+ `../scramble -iriver H$model.bin H$model.hex`;
+ $origsum = `md5sum $orig_path/h3xx/$_/H$model.hex`;
+ chomp $origsum;
+ ($os, $or) = split / /, $origsum;
+ $sum = `md5sum H$model.hex`;
+ chomp $sum;
+ ($s, $r) = split / /, $sum;
+ print FILE "/* $_ */\n";
+ print FILE "{\"$os\", \"$s\"},\n";
+ }
+ }
+ close FILE;
+}