diff --git a/0001-fwcutter-mklist.py-Update-to-new-library-and-skip-so.patch b/0001-fwcutter-mklist.py-Update-to-new-library-and-skip-so.patch new file mode 100644 index 0000000..455a700 --- /dev/null +++ b/0001-fwcutter-mklist.py-Update-to-new-library-and-skip-so.patch @@ -0,0 +1,57 @@ +From 4c01539a4e8c9e87ce41789ec1e00ffae2e563aa Mon Sep 17 00:00:00 2001 +From: Larry Finger +Date: Thu, 20 Aug 2009 12:30:11 -0500 +Subject: [PATCH 1/3] fwcutter: mklist.py - Update to new library and skip some sections + +Switch from the deprecated md5 library to hashlib. + +Detect the ro section that describes the firmware version, +print the address of the data, and and skip some ro sections +that are not of interest. + +Signed-off-by: Larry Finger +Signed-off-by: Michael Buesch +--- + fwcutter/mklist.py | 12 ++++++++++-- + 1 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/fwcutter/mklist.py b/fwcutter/mklist.py +index 1bc8351..40e6cb8 100755 +--- a/fwcutter/mklist.py ++++ b/fwcutter/mklist.py +@@ -30,7 +30,7 @@ + import sys + import os + import re +-import md5 ++import hashlib + + if len(sys.argv) != 2: + print "Usage: %s path/to/wl.o" % sys.argv[0] +@@ -55,7 +55,7 @@ if rodata_fileoffset == None: + print "ERROR: Could not find .rodata fileoffset" + sys.exit(1) + +-md5sum = md5.md5(file(fn, "r").read()) ++md5sum = hashlib.md5(file(fn, "r").read()) + + print "static struct extract _%s[] =" % md5sum.hexdigest() + print "{" +@@ -80,6 +80,14 @@ for sym in syms: + size -= 8 + if "pcm" in name: + type = "EXT_PCM" ++ if "bommajor" in name: ++ print "\t/* ucode major version at offset 0x%x */" % pos ++ continue ++ if "bomminor" in name: ++ print "\t/* ucode minor version at offset 0x%x */" % pos ++ continue ++ if "ucode_2w" in name: ++ continue + m = ucode_re.match(name) + if m: + corerev = int(m.group(1)) +-- +1.6.4 + diff --git a/0002-fwcutter-Add-two-new-sources-for-478.104-firmware.patch b/0002-fwcutter-Add-two-new-sources-for-478.104-firmware.patch new file mode 100644 index 0000000..78d9668 --- /dev/null +++ b/0002-fwcutter-Add-two-new-sources-for-478.104-firmware.patch @@ -0,0 +1,153 @@ +From 1cffac30d8e02a4d216337b8ef4d9fe6dabfb688 Mon Sep 17 00:00:00 2001 +From: Larry Finger +Date: Thu, 20 Aug 2009 16:51:38 -0500 +Subject: [PATCH 2/3] fwcutter: Add two new sources for 478.104 firmware + +Add 2 new files with 478.104 firmware, which includes Rev 16. + +Signed-off-by: Larry Finger +Signed-off-by: Michael Buesch +--- + fwcutter/fwcutter_list.h | 119 +++++++++++++++++++++++++++++++++++++++++++++- + 1 files changed, 118 insertions(+), 1 deletions(-) + +diff --git a/fwcutter/fwcutter_list.h b/fwcutter/fwcutter_list.h +index c48bc6d..65c8671 100644 +--- a/fwcutter/fwcutter_list.h ++++ b/fwcutter/fwcutter_list.h +@@ -238,7 +238,106 @@ static struct extract _2dd738b8feb8b3559fd9d8fbaf3bfffc[] = + EXTRACT_LIST_END + }; + +-/* ++static struct extract _1a258b2d93efa641c32ddf3c3a962028[] = ++{ ++ /* { .name = "ucode4", .offset = 0xAFE08, .type = EXT_UCODE_1, .length = 0x4EA0 }, */ ++ /* { .name = "pcm4", .offset = 0xE8FE0, .type = EXT_PCM, .length = 0x520 }, */ ++ /* { .name = "b0g0initvals4", .offset = 0xA2878, .type = EXT_IV, .length = 0xE80 }, */ ++ /* { .name = "a0g0bsinitvals4", .offset = 0xA45C0, .type = EXT_IV, .length = 0x30 }, */ ++ /* { .name = "b0g0bsinitvals4", .offset = 0xA3700, .type = EXT_IV, .length = 0x30 }, */ ++ /* { .name = "a0g0initvals4", .offset = 0xA3738, .type = EXT_IV, .length = 0xE80 }, */ ++ { .name = "ucode5", .offset = 0xB4CAC, .type = EXT_UCODE_2, .length = 0x56F0 }, ++ { .name = "pcm5", .offset = 0xE9504, .type = EXT_PCM, .length = 0x520 }, ++ { .name = "a0g0bsinitvals5", .offset = 0xA6578, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0bsinitvals5", .offset = 0xA5018, .type = EXT_IV, .length = 0x118 }, ++ { .name = "a0g0initvals5", .offset = 0xA5138, .type = EXT_IV, .length = 0xA18 }, ++ { .name = "a0g1initvals5", .offset = 0xA5B58, .type = EXT_IV, .length = 0xA18 }, ++ { .name = "b0g0initvals5", .offset = 0xA45F8, .type = EXT_IV, .length = 0xA18 }, ++ { .name = "a0g1bsinitvals5", .offset = 0xA6698, .type = EXT_IV, .length = 0x118 }, ++ { .name = "ucode9", .offset = 0xBA3A0, .type = EXT_UCODE_2, .length = 0x6248 }, ++ { .name = "a0g0bsinitvals9", .offset = 0xA89C0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0initvals9", .offset = 0xA67B8, .type = EXT_IV, .length = 0xAF0 }, ++ { .name = "a0g1bsinitvals9", .offset = 0xA8AE0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0bsinitvals9", .offset = 0xA72B0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "a0g0initvals9", .offset = 0xA73D0, .type = EXT_IV, .length = 0xAF0 }, ++ { .name = "a0g1initvals9", .offset = 0xA7EC8, .type = EXT_IV, .length = 0xAF0 }, ++ { .name = "ucode11", .offset = 0xC05EC, .type = EXT_UCODE_2, .length = 0x8000 }, ++ { .name = "n0initvals11", .offset = 0xA8C00, .type = EXT_IV, .length = 0xBC8 }, ++ { .name = "n0bsinitvals11", .offset = 0xA97D0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "n0absinitvals11", .offset = 0xA98F0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "ucode13", .offset = 0xC85F0, .type = EXT_UCODE_2, .length = 0x7AC8 }, ++ { .name = "b0g0bsinitvals13", .offset = 0xABA70, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0initvals13", .offset = 0xAAED0, .type = EXT_IV, .length = 0xB98 }, ++ { .name = "a0g1bsinitvals13", .offset = 0xAC730, .type = EXT_IV, .length = 0x118 }, ++ { .name = "a0g1initvals13", .offset = 0xABB90, .type = EXT_IV, .length = 0xB98 }, ++ { .name = "lp0bsinitvals13", .offset = 0xAADB0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "lp0initvals13", .offset = 0xA9A10, .type = EXT_IV, .length = 0x1398 }, ++ { .name = "ucode14", .offset = 0xD00BC, .type = EXT_UCODE_2, .length = 0x7910 }, ++ { .name = "lp0initvals14", .offset = 0xAC850, .type = EXT_IV, .length = 0xB80 }, ++ { .name = "lp0bsinitvals14", .offset = 0xAD3D8, .type = EXT_IV, .length = 0x118 }, ++ { .name = "ucode15", .offset = 0xD79D0, .type = EXT_UCODE_3, .length = 0x8768 }, ++ { .name = "lp0initvals15", .offset = 0xAD4F8, .type = EXT_IV, .length = 0xC68 }, ++ { .name = "lp0bsinitvals15", .offset = 0xAE168, .type = EXT_IV, .length = 0x118 }, ++ { .name = "ucode16", .offset = 0xE013C, .type = EXT_UCODE_3, .length = 0x8EA0 }, ++ { .name = "lp0bsinitvals16", .offset = 0xAFCE8, .type = EXT_IV, .length = 0x118 }, ++ { .name = "n0bsinitvals16", .offset = 0xAEF20, .type = EXT_IV, .length = 0x118 }, ++ { .name = "sslpn0initvals16", .offset = 0xAF040, .type = EXT_IV, .length = 0x0 }, ++ { .name = "n0initvals16", .offset = 0xAE288, .type = EXT_IV, .length = 0xC90 }, ++ { .name = "lp0initvals16", .offset = 0xAF050, .type = EXT_IV, .length = 0xC90 }, ++ { .name = "sslpn0bsinitvals16", .offset = 0xAF048, .type = EXT_IV, .length = 0x0 }, ++ EXTRACT_LIST_END ++}; ++static struct extract _bb8537e3204a1ea5903fe3e66b5e2763[] = ++{ ++ /* ucode major version at offset 0xa8b70 */ ++ /* ucode minor version at offset 0xa8b74 */ ++ /* { .name = "ucode4", .offset = 0xB6108, .type = EXT_UCODE_1, .length = 0x4EA0 }, */ ++ /* { .name = "pcm4", .offset = 0xEF2E0, .type = EXT_PCM, .length = 0x520 }, */ ++ /* { .name = "b0g0initvals4", .offset = 0xA8B78, .type = EXT_IV, .length = 0xE80 }, */ ++ /* { .name = "a0g0bsinitvals4", .offset = 0xAA8C0, .type = EXT_IV, .length = 0x30 }, */ ++ /* { .name = "b0g0bsinitvals4", .offset = 0xA9A00, .type = EXT_IV, .length = 0x30 }, */ ++ /* { .name = "a0g0initvals4", .offset = 0xA9A38, .type = EXT_IV, .length = 0xE80 }, */ ++ { .name = "ucode5", .offset = 0xBAFAC, .type = EXT_UCODE_2, .length = 0x56F0 }, ++ { .name = "pcm5", .offset = 0xEF804, .type = EXT_PCM, .length = 0x520 }, ++ { .name = "b0g0bsinitvals5", .offset = 0xAB318, .type = EXT_IV, .length = 0x118 }, ++ { .name = "a0g0bsinitvals5", .offset = 0xAC878, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0initvals5", .offset = 0xAA8F8, .type = EXT_IV, .length = 0xA18 }, ++ { .name = "a0g1initvals5", .offset = 0xABE58, .type = EXT_IV, .length = 0xA18 }, ++ { .name = "a0g0initvals5", .offset = 0xAB438, .type = EXT_IV, .length = 0xA18 }, ++ { .name = "a0g1bsinitvals5", .offset = 0xAC998, .type = EXT_IV, .length = 0x118 }, ++ { .name = "ucode9", .offset = 0xC06A0, .type = EXT_UCODE_2, .length = 0x6248 }, ++ { .name = "a0g1initvals9", .offset = 0xAE1C8, .type = EXT_IV, .length = 0xAF0 }, ++ { .name = "a0g0bsinitvals9", .offset = 0xAECC0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0bsinitvals9", .offset = 0xAD5B0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0initvals9", .offset = 0xACAB8, .type = EXT_IV, .length = 0xAF0 }, ++ { .name = "a0g1bsinitvals9", .offset = 0xAEDE0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "a0g0initvals9", .offset = 0xAD6D0, .type = EXT_IV, .length = 0xAF0 }, ++ { .name = "ucode11", .offset = 0xC68EC, .type = EXT_UCODE_2, .length = 0x8000 }, ++ { .name = "n0bsinitvals11", .offset = 0xAFAD0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "n0absinitvals11", .offset = 0xAFBF0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "n0initvals11", .offset = 0xAEF00, .type = EXT_IV, .length = 0xBC8 }, ++ { .name = "ucode13", .offset = 0xCE8F0, .type = EXT_UCODE_2, .length = 0x7AC8 }, ++ { .name = "b0g0initvals13", .offset = 0xB11D0, .type = EXT_IV, .length = 0xB98 }, ++ { .name = "a0g1bsinitvals13", .offset = 0xB2A30, .type = EXT_IV, .length = 0x118 }, ++ { .name = "a0g1initvals13", .offset = 0xB1E90, .type = EXT_IV, .length = 0xB98 }, ++ { .name = "lp0bsinitvals13", .offset = 0xB10B0, .type = EXT_IV, .length = 0x118 }, ++ { .name = "b0g0bsinitvals13", .offset = 0xB1D70, .type = EXT_IV, .length = 0x118 }, ++ { .name = "lp0initvals13", .offset = 0xAFD10, .type = EXT_IV, .length = 0x1398 }, ++ { .name = "ucode14", .offset = 0xD63BC, .type = EXT_UCODE_2, .length = 0x7910 }, ++ { .name = "lp0initvals14", .offset = 0xB2B50, .type = EXT_IV, .length = 0xB80 }, ++ { .name = "lp0bsinitvals14", .offset = 0xB36D8, .type = EXT_IV, .length = 0x118 }, ++ { .name = "ucode15", .offset = 0xDDCD0, .type = EXT_UCODE_3, .length = 0x8768 }, ++ { .name = "lp0bsinitvals15", .offset = 0xB4468, .type = EXT_IV, .length = 0x118 }, ++ { .name = "lp0initvals15", .offset = 0xB37F8, .type = EXT_IV, .length = 0xC68 }, ++ { .name = "ucode16", .offset = 0xE643C, .type = EXT_UCODE_3, .length = 0x8EA0 }, ++ { .name = "n0bsinitvals16", .offset = 0xB5220, .type = EXT_IV, .length = 0x118 }, ++ { .name = "sslpn0initvals16", .offset = 0xB5340, .type = EXT_IV, .length = 0x0 }, ++ { .name = "n0initvals16", .offset = 0xB4588, .type = EXT_IV, .length = 0xC90 }, ++ { .name = "lp0initvals16", .offset = 0xB5350, .type = EXT_IV, .length = 0xC90 }, ++ { .name = "sslpn0bsinitvals16", .offset = 0xB5348, .type = EXT_IV, .length = 0x0 }, ++ { .name = "lp0bsinitvals16", .offset = 0xB5FE8, .type = EXT_IV, .length = 0x118 }, ++ EXTRACT_LIST_END ++};/* + * Links change, so let's not put them into the README. + * I still put them here so we know where the file was obtained. + */ +@@ -299,6 +398,24 @@ static const struct file files[] = + .flags = FW_FLAG_LE | FW_FLAG_V4 | FW_FLAG_UNSUPPORTED, + .extract = _2dd738b8feb8b3559fd9d8fbaf3bfffc, + }, ++ { ++ /* ftp://downloads.netgear.com/files/GPL/WNDR3300-V1.0.29_gpl_src.zip */ ++ .name = "wl_apsta.o", ++ .id = "FW15", ++ .ucode_version = "478.104", ++ .md5 = "1a258b2d93efa641c32ddf3c3a962028", ++ .flags = FW_FLAG_LE | FW_FLAG_V4, ++ .extract = _1a258b2d93efa641c32ddf3c3a962028, ++ }, ++ { ++ /* http://downloads.openwrt.org/sources/broadcom-wl-4.178.10.4.tar.bz2 */ ++ .name = "wl_apsta.o", ++ .id = "FW15", ++ .ucode_version = "478.104", ++ .md5 = "bb8537e3204a1ea5903fe3e66b5e2763", ++ .flags = FW_FLAG_LE | FW_FLAG_V4, ++ .extract = _bb8537e3204a1ea5903fe3e66b5e2763, ++ }, + }; + + #define FILES (sizeof(files) / sizeof(files[0])) +-- +1.6.4 + diff --git a/0003-fwcutter-Use-ARRAY_SIZE.patch b/0003-fwcutter-Use-ARRAY_SIZE.patch new file mode 100644 index 0000000..35bd3ea --- /dev/null +++ b/0003-fwcutter-Use-ARRAY_SIZE.patch @@ -0,0 +1,85 @@ +From 37164fe78406e201302ec8bd975698bec48183b9 Mon Sep 17 00:00:00 2001 +From: Michael Buesch +Date: Fri, 21 Aug 2009 15:59:08 +0200 +Subject: [PATCH 3/3] fwcutter: Use ARRAY_SIZE + +Signed-off-by: Michael Buesch +--- + fwcutter/fwcutter.c | 6 +++--- + fwcutter/fwcutter.h | 3 +++ + fwcutter/fwcutter_list.h | 8 ++++---- + 3 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/fwcutter/fwcutter.c b/fwcutter/fwcutter.c +index 5d5aa80..0d82806 100644 +--- a/fwcutter/fwcutter.c ++++ b/fwcutter/fwcutter.c +@@ -462,10 +462,10 @@ static void print_supported_files(void) + "\t" + "\n\n"); + /* print for legacy driver first */ +- for (i = 0; i < FILES; i++) ++ for (i = 0; i < ARRAY_SIZE(files); i++) + if (file_ok(&files[i]) && !(files[i].flags & FW_FLAG_V4)) + print_file(&files[i]); +- for (i = 0; i < FILES; i++) ++ for (i = 0; i < ARRAY_SIZE(files); i++) + if (file_ok(&files[i]) && files[i].flags & FW_FLAG_V4) + print_file(&files[i]); + printf("\n"); +@@ -491,7 +491,7 @@ static const struct file *find_file(FILE *fd) + signature[8], signature[9], signature[10], signature[11], + signature[12], signature[13], signature[14], signature[15]); + +- for (i = 0; i < FILES; ++i) { ++ for (i = 0; i < ARRAY_SIZE(files); i++) { + if (file_ok(&files[i]) && + strcasecmp(md5sig, files[i].md5) == 0) { + printf("This file is recognised as:\n"); +diff --git a/fwcutter/fwcutter.h b/fwcutter/fwcutter.h +index ac2df63..4a887b6 100644 +--- a/fwcutter/fwcutter.h ++++ b/fwcutter/fwcutter.h +@@ -9,6 +9,9 @@ + #define fwcutter_stringify(x) fwcutter_stringify_1(x) + #define FWCUTTER_VERSION fwcutter_stringify(FWCUTTER_VERSION_) + ++#undef ARRAY_SIZE ++#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) ++ + typedef uint16_t be16_t; /* Big-endian 16bit */ + typedef uint32_t be32_t; /* Big-endian 32bit */ + +diff --git a/fwcutter/fwcutter_list.h b/fwcutter/fwcutter_list.h +index 65c8671..5175bbd 100644 +--- a/fwcutter/fwcutter_list.h ++++ b/fwcutter/fwcutter_list.h +@@ -287,6 +287,7 @@ static struct extract _1a258b2d93efa641c32ddf3c3a962028[] = + { .name = "sslpn0bsinitvals16", .offset = 0xAF048, .type = EXT_IV, .length = 0x0 }, + EXTRACT_LIST_END + }; ++ + static struct extract _bb8537e3204a1ea5903fe3e66b5e2763[] = + { + /* ucode major version at offset 0xa8b70 */ +@@ -337,7 +338,9 @@ static struct extract _bb8537e3204a1ea5903fe3e66b5e2763[] = + { .name = "sslpn0bsinitvals16", .offset = 0xB5348, .type = EXT_IV, .length = 0x0 }, + { .name = "lp0bsinitvals16", .offset = 0xB5FE8, .type = EXT_IV, .length = 0x118 }, + EXTRACT_LIST_END +-};/* ++}; ++ ++/* + * Links change, so let's not put them into the README. + * I still put them here so we know where the file was obtained. + */ +@@ -417,6 +420,3 @@ static const struct file files[] = + .extract = _bb8537e3204a1ea5903fe3e66b5e2763, + }, + }; +- +-#define FILES (sizeof(files) / sizeof(files[0])) +- +-- +1.6.4 + diff --git a/b43-fwcutter.spec b/b43-fwcutter.spec index 56ea69d..52bbfa8 100644 --- a/b43-fwcutter.spec +++ b/b43-fwcutter.spec @@ -1,6 +1,6 @@ Name: b43-fwcutter Version: 012 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Firmware extraction tool for Broadcom wireless driver Group: System Environment/Base @@ -9,6 +9,9 @@ URL: http://bu3sch.de/b43/fwcutter/ Source0: http://bu3sch.de/b43/fwcutter/%{name}-%{version}.tar.bz2 Source1: README.Fedora BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Patch1: 0001-fwcutter-mklist.py-Update-to-new-library-and-skip-so.patch +Patch2: 0002-fwcutter-Add-two-new-sources-for-478.104-firmware.patch +Patch3: 0003-fwcutter-Use-ARRAY_SIZE.patch %description This package contains the 'b43-fwcutter' tool which is used to @@ -19,6 +22,10 @@ instructions on using this tool. %prep %setup -q +%patch1 -p2 +%patch2 -p2 +%patch3 -p2 + cp %{SOURCE1} . %build @@ -41,6 +48,9 @@ rm -rf $RPM_BUILD_ROOT %doc README README.Fedora %changelog +* Fri Aug 28 2009 Bill Nottingham 012-2 +- Update with some patches from git + * Mon Aug 24 2009 John W. Linville 012-1 - Update for b43-fwcutter-012