Initial commit
This commit is contained in:
50
tools/b43-tools/Makefile
Normal file
50
tools/b43-tools/Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=b43-tools
|
||||
PKG_VERSION:=019
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/mbuesch/b43-tools.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_SOURCE_VERSION:=8dce53297966b31b6c70a7a03c2433978dd9f288
|
||||
PKG_MIRROR_HASH:=247eb0297f14fbcc828685cc353150f30fa03bf886e7a477aadc4161d9c0458d
|
||||
HOST_BUILD_DIR=$(BUILD_DIR_HOST)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
|
||||
define Host/Compile
|
||||
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/fwcutter \
|
||||
CFLAGS="$(HOST_CFLAGS) -include endian.h" \
|
||||
$(HOST_MAKE_FLAGS) \
|
||||
$(1) QUIET_SPARSE=:
|
||||
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/assembler \
|
||||
CFLAGS="$(HOST_CFLAGS) -include endian.h" \
|
||||
$(HOST_MAKE_FLAGS) \
|
||||
LDFLAGS= \
|
||||
$(1) QUIET_SPARSE=:
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/fwcutter/b43-fwcutter $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/assembler/b43-asm $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/assembler/b43-asm.bin $(STAGING_DIR_HOST)/bin/
|
||||
$(INSTALL_BIN) ./files/b43-fwsquash.py $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-fwcutter
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-asm
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-asm.bin
|
||||
rm -f $(STAGING_DIR_HOST)/bin/b43-fwsquash.py
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
149
tools/b43-tools/files/b43-fwsquash.py
Executable file
149
tools/b43-tools/files/b43-fwsquash.py
Executable file
@@ -0,0 +1,149 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# b43 firmware file squasher
|
||||
# Removes unnecessary firmware files
|
||||
#
|
||||
# Copyright (c) 2009 Michael Buesch <mb@bu3sch.de>
|
||||
#
|
||||
# Licensed under the GNU/GPL version 2 or (at your option) any later version.
|
||||
#
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
def usage():
|
||||
print("Usage: %s PHYTYPES COREREVS /path/to/extracted/firmware" % sys.argv[0])
|
||||
print("")
|
||||
print("PHYTYPES is a comma separated list of:")
|
||||
print("A => A-PHY")
|
||||
print("AG => Dual A-PHY G-PHY")
|
||||
print("G => G-PHY")
|
||||
print("LP => LP-PHY")
|
||||
print("N => N-PHY")
|
||||
print("HT => HT-PHY")
|
||||
print("LCN => LCN-PHY")
|
||||
print("LCN40 => LCN40-PHY")
|
||||
print("AC => AC-PHY")
|
||||
print("")
|
||||
print("COREREVS is a comma separated list of core revision numbers.")
|
||||
|
||||
if len(sys.argv) != 4:
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
phytypes = sys.argv[1]
|
||||
corerevs = sys.argv[2]
|
||||
fwpath = sys.argv[3]
|
||||
|
||||
phytypes = phytypes.split(',')
|
||||
try:
|
||||
corerevs = map(lambda r: int(r), corerevs.split(','))
|
||||
except ValueError:
|
||||
print("ERROR: \"%s\" is not a valid COREREVS string\n" % corerevs)
|
||||
usage()
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
fwfiles = os.listdir(fwpath)
|
||||
fwfiles = filter(lambda str: str.endswith(".fw"), fwfiles)
|
||||
if not fwfiles:
|
||||
print("ERROR: No firmware files found in %s" % fwpath)
|
||||
sys.exit(1)
|
||||
|
||||
required_fwfiles = []
|
||||
|
||||
def revs_match(revs_a, revs_b):
|
||||
for rev in revs_a:
|
||||
if rev in revs_b:
|
||||
return True
|
||||
return False
|
||||
|
||||
def phytypes_match(types_a, types_b):
|
||||
for type in types_a:
|
||||
type = type.strip().upper()
|
||||
if type in types_b:
|
||||
return True
|
||||
return False
|
||||
|
||||
revmapping = {
|
||||
"ucode2.fw" : ( (2,3,), ("G",), ),
|
||||
"ucode4.fw" : ( (4,), ("G",), ),
|
||||
"ucode5.fw" : ( (5,6,7,8,9,10,), ("G","A","AG",), ),
|
||||
"ucode11.fw" : ( (11,12,), ("N",), ),
|
||||
"ucode13.fw" : ( (13,), ("LP","G",), ),
|
||||
"ucode14.fw" : ( (14,), ("LP",), ),
|
||||
"ucode15.fw" : ( (15,), ("LP",), ),
|
||||
"ucode16_mimo.fw" : ( (16,17,18,19,23,), ("N",), ),
|
||||
# "ucode16_lp.fw" : ( (16,17,18,19,), ("LP",), ),
|
||||
"ucode24_lcn.fw" : ( (24,), ("LCN",), ),
|
||||
"ucode25_mimo.fw" : ( (25,28,), ("N",), ),
|
||||
"ucode25_lcn.fw" : ( (25,28,), ("LCN",), ),
|
||||
"ucode26_mimo.fw" : ( (26,), ("HT",), ),
|
||||
"ucode29_mimo.fw" : ( (29,), ("HT",), ),
|
||||
"ucode30_mimo.fw" : ( (30,), ("N",), ),
|
||||
"ucode33_lcn40.fw" : ( (33,), ("LCN40",), ),
|
||||
"ucode40.fw" : ( (40,), ("AC",), ),
|
||||
"ucode42.fw" : ( (42,), ("AC",), ),
|
||||
"pcm4.fw" : ( (1,2,3,4,), ("G",), ),
|
||||
"pcm5.fw" : ( (5,6,7,8,9,10,), ("G","A","AG",), ),
|
||||
}
|
||||
|
||||
initvalmapping = {
|
||||
"a0g1initvals5.fw" : ( (5,6,7,8,9,10,), ("AG",), ),
|
||||
"a0g0initvals5.fw" : ( (5,6,7,8,9,10,), ("A", "AG",), ),
|
||||
"b0g0initvals2.fw" : ( (2,4,), ("G",), ),
|
||||
"b0g0initvals5.fw" : ( (5,6,7,8,9,10,), ("G",), ),
|
||||
"b0g0initvals13.fw" : ( (13,), ("G",), ),
|
||||
"n0initvals11.fw" : ( (11,12,), ("N",), ),
|
||||
"n0initvals16.fw" : ( (16,17,18,23,), ("N",), ),
|
||||
"n0initvals24.fw" : ( (24,), ("N",), ),
|
||||
"n0initvals25.fw" : ( (25,28,), ("N",), ),
|
||||
"n16initvals30.fw" : ( (30,), ("N",), ),
|
||||
"lp0initvals13.fw" : ( (13,), ("LP",), ),
|
||||
"lp0initvals14.fw" : ( (14,), ("LP",), ),
|
||||
"lp0initvals15.fw" : ( (15,), ("LP",), ),
|
||||
# "lp0initvals16.fw" : ( (16,17,18,), ("LP",), ),
|
||||
"lcn0initvals24.fw" : ( (24,), ("LCN",), ),
|
||||
"ht0initvals26.fw" : ( (26,), ("HT",), ),
|
||||
"ht0initvals29.fw" : ( (29,), ("HT",), ),
|
||||
"lcn400initvals33.fw" : ( (33,), ("LCN40",), ),
|
||||
"ac0initvals40.fw" : ( (40,), ("AC",), ),
|
||||
"ac1initvals42.fw" : ( (42,), ("AC",), ),
|
||||
"a0g1bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("AG",), ),
|
||||
"a0g0bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("A", "AG"), ),
|
||||
"b0g0bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("G",), ),
|
||||
"n0bsinitvals11.fw" : ( (11,12,), ("N",), ),
|
||||
"n0bsinitvals16.fw" : ( (16,17,18,23,), ("N",), ),
|
||||
"n0bsinitvals24.fw" : ( (24,), ("N",), ),
|
||||
"n0bsinitvals25.fw" : ( (25,28,), ("N",), ),
|
||||
"n16bsinitvals30.fw" : ( (30,), ("N",), ),
|
||||
"lp0bsinitvals13.fw" : ( (13,), ("LP",), ),
|
||||
"lp0bsinitvals14.fw" : ( (14,), ("LP",), ),
|
||||
"lp0bsinitvals15.fw" : ( (15,), ("LP",), ),
|
||||
# "lp0bsinitvals16.fw" : ( (16,17,18,), ("LP",), ),
|
||||
"lcn0bsinitvals24.fw" : ( (24,), ("LCN",), ),
|
||||
"ht0bsinitvals26.fw" : ( (26,), ("HT",), ),
|
||||
"ht0bsinitvals29.fw" : ( (29,), ("HT",), ),
|
||||
"lcn400bsinitvals33.fw" : ( (33,), ("LCN40",), ),
|
||||
"ac0bsinitvals40.fw" : ( (40,), ("AC",), ),
|
||||
"ac1bsinitvals42.fw" : ( (42,), ("AC",), ),
|
||||
}
|
||||
|
||||
for f in fwfiles:
|
||||
if f in revmapping:
|
||||
if revs_match(corerevs, revmapping[f][0]) and\
|
||||
phytypes_match(phytypes, revmapping[f][1]):
|
||||
required_fwfiles += [f]
|
||||
continue
|
||||
if f in initvalmapping:
|
||||
if revs_match(corerevs, initvalmapping[f][0]) and\
|
||||
phytypes_match(phytypes, initvalmapping[f][1]):
|
||||
required_fwfiles += [f]
|
||||
continue
|
||||
print("WARNING: Firmware file %s not found in the mapping lists" % f)
|
||||
|
||||
for f in fwfiles:
|
||||
if f not in required_fwfiles:
|
||||
print("Deleting %s" % f)
|
||||
os.unlink(fwpath + '/' + f)
|
||||
|
||||
16
tools/b43-tools/patches/001-fw-dirname.patch
Normal file
16
tools/b43-tools/patches/001-fw-dirname.patch
Normal file
@@ -0,0 +1,16 @@
|
||||
--- a/fwcutter/fwcutter.c
|
||||
+++ b/fwcutter/fwcutter.c
|
||||
@@ -50,13 +50,8 @@
|
||||
#include "fwcutter.h"
|
||||
#include "fwcutter_list.h"
|
||||
|
||||
-#if defined(__DragonFly__) || defined(__FreeBSD__)
|
||||
-#define V3_FW_DIRNAME "v3"
|
||||
-#define V4_FW_DIRNAME "v4"
|
||||
-#else
|
||||
#define V3_FW_DIRNAME "b43legacy"
|
||||
#define V4_FW_DIRNAME "b43"
|
||||
-#endif
|
||||
|
||||
static struct cmdline_args cmdargs;
|
||||
|
||||
14
tools/b43-tools/patches/002-no_libfl.patch
Normal file
14
tools/b43-tools/patches/002-no_libfl.patch
Normal file
@@ -0,0 +1,14 @@
|
||||
--- a/assembler/main.c
|
||||
+++ b/assembler/main.c
|
||||
@@ -1268,6 +1268,11 @@ static void initialize(void)
|
||||
#endif /* YYDEBUG */
|
||||
}
|
||||
|
||||
+int yywrap(void)
|
||||
+{
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int err, res = 1;
|
||||
Reference in New Issue
Block a user