From: Hauke Mehrtens Date: Mon, 8 Oct 2012 20:15:42 +0000 (+0000) Subject: tools: add b43-tools X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d14c6b29eb4e2b23cf2d90b15cc8774a72a06d31;p=openwrt%2Fstaging%2Fyousong.git tools: add b43-tools Move the b43-tools build from the mac80211 Makefile into an own package in tools and use the newest version of b43-tools. SVN-Revision: 33668 --- diff --git a/package/mac80211/Makefile b/package/mac80211/Makefile index 787058b01c..35027d3ac4 100644 --- a/package/mac80211/Makefile +++ b/package/mac80211/Makefile @@ -824,35 +824,6 @@ PKG_B43_FWV3_SOURCE:=$(PKG_B43_FWV3_NAME)-$(PKG_B43_FWV3_VERSION).o PKG_B43_FWV3_SOURCE_URL:=http://downloads.openwrt.org/sources/ PKG_B43_FWV3_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3 -ifeq ($(CONFIG_B43_OPENFIRMWARE),y) - PKG_B43_FWCUTTER_NAME:=b43-fwcutter - PKG_B43_FWCUTTER_VERSION:=3e69531aa65b8f664a0ab00dfc3e2eefeb0cb417 - PKG_B43_FWCUTTER_SOURCE:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION).tar.bz2 - PKG_B43_FWCUTTER_PROTO:=git - PKG_B43_FWCUTTER_SOURCE_URL:=http://git.bu3sch.de/git/b43-tools.git - PKG_B43_FWCUTTER_SUBDIR:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION) - PKG_B43_FWCUTTER_OBJECT:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION)/fwcutter/ -else - PKG_B43_FWCUTTER_NAME:=b43-fwcutter - PKG_B43_FWCUTTER_VERSION:=015 - PKG_B43_FWCUTTER_SOURCE:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION).tar.bz2 - PKG_B43_FWCUTTER_PROTO:=default - PKG_B43_FWCUTTER_SOURCE_URL:=http://bu3sch.de/b43/fwcutter/ - PKG_B43_FWCUTTER_MD5SUM:=628e030565222a107bc40300313cbe76 - PKG_B43_FWCUTTER_SUBDIR:=b43-fwcutter-$(PKG_B43_FWCUTTER_VERSION) - PKG_B43_FWCUTTER_OBJECT:=$(PKG_B43_FWCUTTER_NAME)-$(PKG_B43_FWCUTTER_VERSION)/ -endif - -define Download/b43-common - FILE:=$(PKG_B43_FWCUTTER_SOURCE) - URL:=$(PKG_B43_FWCUTTER_SOURCE_URL) - MD5SUM:=$(PKG_B43_FWCUTTER_MD5SUM) - PROTO:=$(PKG_B43_FWCUTTER_PROTO) - VERSION:=$(PKG_B43_FWCUTTER_VERSION) - SUBDIR:=$(PKG_B43_FWCUTTER_SUBDIR) -endef -$(eval $(call Download,b43-common)) - define Download/b43 FILE:=$(PKG_B43_FWV4_SOURCE) URL:=$(PKG_B43_FWV4_SOURCE_URL) @@ -867,19 +838,14 @@ define Download/b43legacy endef $(eval $(call Download,b43legacy)) -define KernelPackage/b43-common + +define KernelPackage/b43 $(call KernelPackage/mac80211/Default) - TITLE:=Generic stuff for Broadcom wireless devices + TITLE:=Broadcom 43xx wireless support URL:=http://linuxwireless.org/en/users/Drivers/b43 KCONFIG:= \ CONFIG_HW_RANDOM=y - DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb -endef - -define KernelPackage/b43 -$(call KernelPackage/b43-common) - DEPENDS+= +@DRIVER_11N_SUPPORT +!TARGET_brcm47xx:kmod-bcma - TITLE:=Broadcom 43xx wireless support + DEPENDS+= +kmod-mac80211 +!TARGET_brcm47xx:kmod-bcma +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43/b43.ko AUTOLOAD:=$(call AutoLoad,30,b43) MENU:=1 @@ -1041,8 +1007,12 @@ Kernel module for Broadcom 43xx wireless support (mac80211 stack) new endef define KernelPackage/b43legacy -$(call KernelPackage/b43-common) + $(call KernelPackage/mac80211/Default) TITLE:=Broadcom 43xx-legacy wireless support + URL:=http://linuxwireless.org/en/users/Drivers/b43 + KCONFIG:= \ + CONFIG_HW_RANDOM=y + DEPENDS+= +kmod-mac80211 +!(TARGET_brcm47xx||TARGET_brcm63xx):kmod-ssb FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/b43legacy/b43legacy.ko AUTOLOAD:=$(call AutoLoad,30,b43legacy) MENU:=1 @@ -1519,25 +1489,8 @@ define KernelPackage/iwl4965/install $(INSTALL_DATA) $(PKG_BUILD_DIR)/$(PKG_LINUX_FIRMWARE_SUBDIR)/iwlwifi-4965-2.ucode $(1)/lib/firmware endef -define Build/b43-common - tar xjf "$(DL_DIR)/$(PKG_B43_FWCUTTER_SOURCE)" -C "$(PKG_BUILD_DIR)" - patch -p1 -d "$(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_OBJECT)" < ./files/b43-fwcutter-fw-dirname.patch - $(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_OBJECT)" \ - CFLAGS="-I$(STAGING_DIR_HOST)/include -include endian.h" \ - QUIET_SPARSE=: - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_OBJECT)/b43-fwcutter $(STAGING_DIR_HOST)/bin/ -ifeq ($(CONFIG_B43_OPENFIRMWARE),y) - $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/ - $(MAKE) -C "$(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/" - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/b43-asm $(STAGING_DIR_HOST)/bin/ - $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_B43_FWCUTTER_SUBDIR)/assembler/b43-asm.bin $(STAGING_DIR_HOST)/bin/ -endif - $(INSTALL_BIN) ./files/host_bin/b43-fwsquash.py $(STAGING_DIR_HOST)/bin/ -endef - define KernelPackage/b43/install rm -rf $(1)/lib/firmware/ - $(call Build/b43-common) ifeq ($(CONFIG_B43_OPENFIRMWARE),y) tar xzf "$(DL_DIR)/$(PKG_B43_FWV4_SOURCE)" -C "$(PKG_BUILD_DIR)" else @@ -1559,9 +1512,7 @@ endif endef define KernelPackage/b43legacy/install - $(call Build/b43-common) $(INSTALL_DIR) $(1)/lib/firmware/ - b43-fwcutter --unsupported -w $(1)/lib/firmware/ $(DL_DIR)/$(PKG_B43_FWV3_SOURCE) ifneq ($(CONFIG_B43LEGACY_FW_SQUASH),) b43-fwsquash.py "G" "$(CONFIG_B43LEGACY_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43legacy" diff --git a/package/mac80211/files/b43-fwcutter-fw-dirname.patch b/package/mac80211/files/b43-fwcutter-fw-dirname.patch deleted file mode 100644 index c2f49ab781..0000000000 --- a/package/mac80211/files/b43-fwcutter-fw-dirname.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/fwcutter.c -+++ b/fwcutter.c -@@ -48,13 +48,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; - diff --git a/package/mac80211/files/host_bin/b43-fwsquash.py b/package/mac80211/files/host_bin/b43-fwsquash.py deleted file mode 100755 index cd8818167e..0000000000 --- a/package/mac80211/files/host_bin/b43-fwsquash.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python -# -# b43 firmware file squasher -# Removes unnecessary firmware files -# -# Copyright (c) 2009 Michael Buesch -# -# 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("") - 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,), - "ucode4.fw" : (4,), - "ucode5.fw" : (5,6,7,8,9,10,), - "ucode11.fw" : (11,12,), - "ucode13.fw" : (13,), - "ucode14.fw" : (14,), - "ucode15.fw" : (15,), - "ucode16_mimo.fw" : (16,), - "ucode24_mimo.fw" : (24,), - "ucode29_mimo.fw" : (29,), - "pcm4.fw" : (1,2,3,4,), - "pcm5.fw" : (5,6,7,8,9,10,), -} - -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,), ("N",), ), - "lp0initvals13.fw" : ( (13,), ("LP",), ), - "lp0initvals14.fw" : ( (14,), ("LP",), ), - "lp0initvals15.fw" : ( (15,), ("LP",), ), - "lcn0initvals24.fw" : ( (24,), ("LCN",), ), - "ht0initvals29.fw" : ( (29,), ("HT",), ), - "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,), ("N",), ), - "lp0bsinitvals13.fw" : ( (13,), ("LP",), ), - "lp0bsinitvals14.fw" : ( (14,), ("LP",), ), - "lp0bsinitvals15.fw" : ( (15,), ("LP",), ), - "lcn0bsinitvals24.fw" : ( (24,), ("LCN",), ), - "ht0bsinitvals29.fw" : ( (29,), ("HT",), ), -} - -for f in fwfiles: - if f in revmapping: - if revs_match(corerevs, revmapping[f]): - 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) - diff --git a/tools/Makefile b/tools/Makefile index 842926ae7d..620da05f00 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -25,6 +25,9 @@ ifneq ($(CONFIG_TARGET_ar71xx),) tools-y += lzma-old squashfs endif tools-y += lzma squashfs4 +ifneq ($(CONFIG_PACKAGE_kmod-b43)$(CONFIG_PACKAGE_kmod-b43legacy),) +tools-y += b43-tools +endif ifneq ($(CONFIG_PACKAGE_firmwarehotplug),) tools-y += sdcc @@ -64,6 +67,7 @@ $(curdir)/missing-macros/compile := $(curdir)/automake/install $(curdir)/e2fsprogs/compile := $(curdir)/automake/install $(curdir)/libelf/compile := $(curdir)/automake/install $(curdir)/sdcc/compile := $(curdir)/bison/install +$(curdir)/b43-tools/compile := $(curdir)/bison/install ifneq ($(CONFIG_CCACHE),) $(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/install)) diff --git a/tools/b43-tools/Makefile b/tools/b43-tools/Makefile new file mode 100644 index 0000000000..576a580dfc --- /dev/null +++ b/tools/b43-tools/Makefile @@ -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:=016 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=git://git.bues.ch/b43-tools.git +PKG_SOURCE_PROTO:=git +PKG_SOURCE_SUBDIR:=$(PKG_NAME) +PKG_SOURCE_VERSION:=38267954aae73659de271c67e6892c744b47f3d8 +PKG_MIRROR_MD5SUM:=7826262ac6870ac27c22a1b6974f8952 +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) \ + $(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)) diff --git a/tools/b43-tools/files/b43-fwsquash.py b/tools/b43-tools/files/b43-fwsquash.py new file mode 100755 index 0000000000..cd8818167e --- /dev/null +++ b/tools/b43-tools/files/b43-fwsquash.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# +# b43 firmware file squasher +# Removes unnecessary firmware files +# +# Copyright (c) 2009 Michael Buesch +# +# 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("") + 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,), + "ucode4.fw" : (4,), + "ucode5.fw" : (5,6,7,8,9,10,), + "ucode11.fw" : (11,12,), + "ucode13.fw" : (13,), + "ucode14.fw" : (14,), + "ucode15.fw" : (15,), + "ucode16_mimo.fw" : (16,), + "ucode24_mimo.fw" : (24,), + "ucode29_mimo.fw" : (29,), + "pcm4.fw" : (1,2,3,4,), + "pcm5.fw" : (5,6,7,8,9,10,), +} + +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,), ("N",), ), + "lp0initvals13.fw" : ( (13,), ("LP",), ), + "lp0initvals14.fw" : ( (14,), ("LP",), ), + "lp0initvals15.fw" : ( (15,), ("LP",), ), + "lcn0initvals24.fw" : ( (24,), ("LCN",), ), + "ht0initvals29.fw" : ( (29,), ("HT",), ), + "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,), ("N",), ), + "lp0bsinitvals13.fw" : ( (13,), ("LP",), ), + "lp0bsinitvals14.fw" : ( (14,), ("LP",), ), + "lp0bsinitvals15.fw" : ( (15,), ("LP",), ), + "lcn0bsinitvals24.fw" : ( (24,), ("LCN",), ), + "ht0bsinitvals29.fw" : ( (29,), ("HT",), ), +} + +for f in fwfiles: + if f in revmapping: + if revs_match(corerevs, revmapping[f]): + 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) + diff --git a/tools/b43-tools/patches/001-fw-dirname.patch b/tools/b43-tools/patches/001-fw-dirname.patch new file mode 100644 index 0000000000..e9bd03249f --- /dev/null +++ b/tools/b43-tools/patches/001-fw-dirname.patch @@ -0,0 +1,16 @@ +--- a/fwcutter/fwcutter.c ++++ b/fwcutter/fwcutter.c +@@ -48,13 +48,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; +