fix pcmcia modules loading (thanks to Mr-packet)
[openwrt.git] / openwrt / target / linux / rules.mk
1 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
2 -e 's/mipsel/mips/' \
3 -e 's/powerpc/ppc/' \
4 -e 's/sh[234]/sh/' \
5 )
6
7 ifeq ($(KERNEL),2.6)
8 LINUX_KMOD_SUFFIX=ko
9 else
10 LINUX_KMOD_SUFFIX=o
11 endif
12
13 define KMOD_template
14 ifeq ($$(strip $(4)),)
15 KDEPEND_$(1):=m
16 else
17 KDEPEND_$(1):=$($(4))
18 endif
19
20 ifeq ($$(strip $(5)),)
21 IDEPEND_$(1):=kernel-$(LINUX_VERSION)-$(BOARD) ($(PKG_RELEASE))
22 else
23 IDEPEND_$(1):=kernel-$(LINUX_VERSION)-$(BOARD) ($(PKG_RELEASE)), $(5)
24 endif
25
26 PKG_$(1) := $(PACKAGE_DIR)/kmod-$(2)_$(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE)_$(ARCH).ipk
27 I_$(1) := $(PKG_BUILD_DIR)/ipkg/$(2)
28
29 ifeq ($$(KDEPEND_$(1)),m)
30 ifneq ($(BR2_PACKAGE_KMOD_$(1)),)
31 TARGETS += $$(PKG_$(1))
32 endif
33 ifeq ($(BR2_PACKAGE_KMOD_$(1)),y)
34 INSTALL_TARGETS += $$(PKG_$(1))
35 endif
36 endif
37
38 $$(PKG_$(1)): $(LINUX_DIR)/.modules_done
39 rm -rf $$(I_$(1))
40 $(SCRIPT_DIR)/make-ipkg-dir.sh $$(I_$(1)) ../control/kmod-$(2).control $(LINUX_VERSION)-$(BOARD)-$(PKG_RELEASE) $(ARCH)
41 echo "Depends: $$(IDEPEND_$(1))" >> $$(I_$(1))/CONTROL/control
42 ifneq ($(strip $(3)),)
43 mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION)
44 cp $(3) $$(I_$(1))/lib/modules/$(LINUX_VERSION)
45 endif
46 ifneq ($(6),)
47 mkdir -p $$(I_$(1))/etc/modules.d
48 for module in $(7); do \
49 echo $$$$module >> $$(I_$(1))/etc/modules.d/$(6)-$(2); \
50 done
51 endif
52 $(8)
53 $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR) $(MAKE_TRACE)
54
55 endef
56
57
This page took 0.046376 seconds and 5 git commands to generate.