1#
2# Copyright (C) 2016 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=b43legacy-firmware
11PKG_VERSION:=3.130.20.0
12PKG_RELEASE:=1
13
14PKG_SOURCE:=wl_apsta-$(PKG_VERSION).o
15PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
16PKG_MD5SUM:=e08665c5c5b66beb9c3b2dd54aa80cb3
17
18include $(INCLUDE_DIR)/package.mk
19
20define Package/b43legacy-firmware
21  SECTION:=firmware
22  CATEGORY:=Firmware
23  URL:=$(PKG_SOURCE_URL)
24  TITLE:=Broadcom bcm43xx b43legacy firmware
25endef
26
27define Package/b43legacy-firmware/config
28  if PACKAGE_b43legacy-firmware
29
30	config B43LEGACY_FW_SQUASH
31		bool "Remove unnecessary firmware files"
32		default y
33		help
34		  This options allows you to remove unnecessary b43legacy firmware files
35		  from the final rootfs image. This can reduce the rootfs size by
36		  up to 50k.
37
38		  If unsure, say Y.
39
40	config B43LEGACY_FW_SQUASH_COREREVS
41		string "Core revisions to include"
42		depends on B43LEGACY_FW_SQUASH
43		default "1,2,3,4"
44		help
45		  This is a comma seperated list of core revision numbers.
46
47		  Example (keep files for rev4 only):
48		    4
49
50		  Example (keep files for rev2 and rev4):
51		    2,4
52
53  endif
54endef
55
56define Build/Prepare
57	mkdir -p $(PKG_BUILD_DIR)
58endef
59
60define Build/Compile
61
62endef
63
64define Package/b43legacy-firmware/install
65	$(INSTALL_DIR) $(1)/lib/firmware
66	b43-fwcutter --unsupported -w $(1)/lib/firmware/ $(DL_DIR)/$(PKG_SOURCE)
67  ifneq ($(CONFIG_B43LEGACY_FW_SQUASH),)
68	b43-fwsquash.py "G" "$(CONFIG_B43LEGACY_FW_SQUASH_COREREVS)" "$(1)/lib/firmware/b43legacy"
69  endif
70endef
71
72$(eval $(call BuildPackage,b43legacy-firmware))
73