[lantiq]
[openwrt/svn-archive/archive.git] / package / ltq-dsl / Makefile
1 #
2 # Copyright (C) 2011 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=ltq-dsl
12 PKG_BASE_NAME:=drv_dsl_cpe_api_danube
13 PKG_VERSION:=3.24.4.4
14 PKG_RELEASE:=2
15 PKG_SOURCE:=$(PKG_BASE_NAME)-$(PKG_VERSION).tar.gz
16 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/drv_dsl_cpe_api-$(PKG_VERSION)
17 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/
18 PKG_MD5SUM:=c45bc531c1ed2ac80f68fb986b63bb87
19
20 FW_BASE_NAME:=dsl_danube_firmware_adsl
21 FW_A_VER:=02.04.04.00.00.01
22 FW_B_VER:=02.04.01.07.00.02
23 FW_A_FILE_VER:=244001
24 FW_B_FILE_VER:=241702
25 FW_A_MD5:=f717db3067a0049a26e233ab11238710
26 FW_B_MD5:=349de7cd20368f4ac9b7e8322114a512
27
28 include $(INCLUDE_DIR)/package.mk
29
30 define KernelPackage/ltq-dsl
31 SECTION:=sys
32 CATEGORY:=Kernel modules
33 SUBMENU:=Network Devices
34 TITLE:=Lantiq dsl driver
35 URL:=http://www.lantiq.com/
36 DEPENDS:=@TARGET_lantiq_xway +kmod-atm
37 FILES:=$(PKG_BUILD_DIR)/src/mei/lantiq_mei.ko \
38 $(PKG_BUILD_DIR)/src/drv_dsl_cpe_api.ko \
39 $(PKG_BUILD_DIR)/src/mei/lantiq_atm.ko
40 AUTOLOAD:=$(call AutoLoad,50,lantiq_mei drv_dsl_cpe_api lantiq_atm)
41 MAINTAINER:=John Crispin <blogic@openwrt.org>
42 endef
43
44 define Package/kmod-ltq-dsl-firmware/default
45 SECTION:=sys
46 CATEGORY:=Kernel modules
47 SUBMENU:=Network Devices
48 TITLE:=Firmware
49 URL:=http://www.lantiq.com/
50 DEPENDS:=@TARGET_lantiq_xway kmod-ltq-dsl
51 MAINTAINER:=John Crispin <blogic@openwrt.org>
52 endef
53
54 define Package/kmod-ltq-dsl-firmware-a
55 $(call Package/kmod-ltq-dsl-firmware/default)
56 TITLE+=Annex-A Danube
57 endef
58
59 define Package/kmod-ltq-dsl-firmware-b
60 $(call Package/kmod-ltq-dsl-firmware/default)
61 TITLE+=Annex-B Danube
62 endef
63
64 define KernelPackage/ltq-dsl/description
65 Lantiq DSL CPE API for Amazon SE, Danube and Vinax.
66 endef
67
68 define KernelPackage/ltq-dsl/config
69 source "$(SOURCE)/Config.in"
70 endef
71
72 define Download/annex-a
73 FILE:=$(FW_BASE_NAME)_a-$(FW_A_VER).tar.gz
74 URL:=http://mirror2.openwrt.org/sources/
75 MD5SUM:=$(FW_A_MD5)
76 endef
77 $(eval $(call Download,annex-a))
78
79 define Download/annex-b
80 FILE:=$(FW_BASE_NAME)_b-$(FW_B_VER).tar.gz
81 URL:=http://mirror2.openwrt.org/sources/
82 MD5SUM:=$(FW_B_MD5)
83 endef
84 $(eval $(call Download,annex-b))
85
86 IFX_DSL_MAX_DEVICE=1
87 IFX_DSL_LINES_PER_DEVICE=1
88 IFX_DSL_CHANNELS_PER_LINE=1
89
90 CONFIGURE_ARGS += --enable-kernel-include="$(LINUX_DIR)/include" \
91 --with-max-device="$(IFX_DSL_MAX_DEVICE)" \
92 --with-lines-per-device="$(IFX_DSL_LINES_PER_DEVICE)" \
93 --with-channels-per-line="$(IFX_DSL_CHANNELS_PER_LINE)" \
94 --enable-danube \
95 --enable-add-drv-cflags="-DMODULE" \
96 --disable-dsl-delt-static \
97 --disable-adsl-led \
98 --enable-dsl-ceoc \
99 --enable-dsl-pm \
100 --enable-dsl-pm-total \
101 --enable-dsl-pm-history \
102 --enable-dsl-pm-showtime \
103 --enable-dsl-pm-channel-counters \
104 --enable-dsl-pm-datapath-counters \
105 --enable-dsl-pm-line-counters \
106 --enable-dsl-pm-channel-thresholds \
107 --enable-dsl-pm-datapath-thresholds \
108 --enable-dsl-pm-line-thresholds \
109 --enable-dsl-pm-optional-parameters \
110 --enable-linux-26 \
111 --enable-kernelbuild="$(LINUX_DIR)" \
112 ARCH=$(LINUX_KARCH)
113
114 EXTRA_CFLAGS = -fno-pic -mno-abicalls -mlong-calls -G 0
115
116 ifeq ($(CONFIG_LANTIQ_DSL_DEBUG),y)
117 CONFIGURE_ARGS += \
118 --enable-debug=yes \
119 --enable-debug-prints=yes
120 EXTRA_CFLAGS += -DDEBUG
121 endif
122
123 define Build/Prepare
124 $(PKG_UNPACK)
125 $(INSTALL_DIR) $(PKG_BUILD_DIR)/src/mei/
126 $(CP) ./src/* $(PKG_BUILD_DIR)/src/mei/
127 $(Build/Patch)
128 $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(FW_BASE_NAME)_a-$(FW_A_VER).tar.gz
129 $(TAR) -C $(PKG_BUILD_DIR) -xzf $(DL_DIR)/$(FW_BASE_NAME)_b-$(FW_B_VER).tar.gz
130 endef
131
132 define Build/Configure
133 (cd $(PKG_BUILD_DIR); aclocal && autoconf && automake)
134 $(call Build/Configure/Default)
135 endef
136
137 define Build/Compile
138 cd $(LINUX_DIR); \
139 ARCH=mips CROSS_COMPILE="$(KERNEL_CROSS)" \
140 $(MAKE) M=$(PKG_BUILD_DIR)/src/mei/ V=1 modules
141 $(call Build/Compile/Default)
142 endef
143
144 define Build/InstallDev
145 $(INSTALL_DIR) $(1)/usr/include
146 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api.h $(1)/usr/include
147 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_ioctl.h $(1)/usr/include
148 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_adslmib.h $(1)/usr/include
149 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_adslmib_ioctl.h $(1)/usr/include
150 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_g997.h $(1)/usr/include
151 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_types.h $(1)/usr/include
152 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_pm.h $(1)/usr/include
153 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_api_error.h $(1)/usr/include
154 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_danube_ctx.h $(1)/usr/include
155 $(CP) $(PKG_BUILD_DIR)/src/include/drv_dsl_cpe_cmv_danube.h $(1)/usr/include
156 endef
157
158 define Package/kmod-ltq-dsl-firmware-a/install
159 $(INSTALL_DIR) $(1)/lib/firmware/
160 $(CP) $(PKG_BUILD_DIR)/$(FW_BASE_NAME)_a_$(FW_A_FILE_VER).bin $(1)/lib/firmware/ModemHWE.bin
161 endef
162
163 define Package/kmod-ltq-dsl-firmware-b/install
164 $(INSTALL_DIR) $(1)/lib/firmware/
165 $(CP) $(PKG_BUILD_DIR)/$(FW_BASE_NAME)_b_$(FW_B_FILE_VER).bin $(1)/lib/firmware/ModemHWE.bin
166 endef
167
168 $(eval $(call KernelPackage,ltq-dsl))
169 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-a))
170 $(eval $(call BuildPackage,kmod-ltq-dsl-firmware-b))