blob: 31efd5c9bb95da7b22309efaacfccc931de889ec [file] [log] [blame]
Eric Andersen7129da02003-01-18 21:27:22 +00001#############################################################
2#
3# pcmcia card services
4#
5#############################################################
6# Copyright (C) 2001-2003 by Erik Andersen <andersen@codepoet.org>
7# Copyright (C) 2002 by Tim Riker <Tim@Rikers.org>
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU Library General Public License as
11# published by the Free Software Foundation; either version 2 of the
12# License, or (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# Library General Public License for more details.
18#
19# You should have received a copy of the GNU Library General Public
20# License along with this program; if not, write to the Free Software
21# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22# USA
23
Eric Andersen60f17fa2003-12-20 00:01:42 +000024PCMCIA_SOURCE:=pcmcia-cs-3.2.7.tar.gz
Eric Andersen922fb352003-06-14 00:46:16 +000025PCMCIA_SITE:=http://aleron.dl.sourceforge.net/sourceforge/pcmcia-cs
Eric Andersen60f17fa2003-12-20 00:01:42 +000026PCMCIA_DIR:=$(BUILD_DIR)/pcmcia-cs-3.2.7
Eric Andersen7129da02003-01-18 21:27:22 +000027PCMCIA_CAT:=zcat
28
29$(DL_DIR)/$(PCMCIA_SOURCE):
30 $(WGET) -P $(DL_DIR) $(PCMCIA_SITE)/$(PCMCIA_SOURCE)
31
32pcmcia-source: $(DL_DIR)/$(PCMCIA_SOURCE)
33
34$(PCMCIA_DIR)/.unpacked: $(DL_DIR)/$(PCMCIA_SOURCE)
Eric Andersenbb05a9a2004-10-09 21:19:47 +000035 $(PCMCIA_CAT) $(DL_DIR)/$(PCMCIA_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
Eric Andersen7129da02003-01-18 21:27:22 +000036 touch $(PCMCIA_DIR)/.unpacked
37
38$(PCMCIA_DIR)/.patched: $(PCMCIA_DIR)/.unpacked
Eric Andersen44eedc52004-10-09 02:49:33 +000039 toolchain/patch-kernel.sh $(PCMCIA_DIR) package/pcmcia/ pcmcia\*.patch
Eric Andersen7129da02003-01-18 21:27:22 +000040 touch $(PCMCIA_DIR)/.patched
41
42$(PCMCIA_DIR)/.configured: $(PCMCIA_DIR)/.patched
Eric Andersen2e312fa2003-06-05 02:35:46 +000043 ( cd $(PCMCIA_DIR) ; ./Configure --kernel=$(LINUX_SOURCE_DIR) --noprompt \
Eric Andersen7129da02003-01-18 21:27:22 +000044 --rcdir=/etc --arch=$(ARCH) --trust --srctree --nocardbus \
Eric Andersen2e312fa2003-06-05 02:35:46 +000045 --sysv --kcc=$(KERNEL_CROSS)gcc --ucc=$(TARGET_CC) --ld=$(TARGET_CROSS)ld \
Eric Andersen7129da02003-01-18 21:27:22 +000046 --target=$(TARGET_DIR))
Eric Andersen4f889ad2003-11-19 17:17:56 +000047 $(SED) "s/pump/udhcpc/" $(PCMCIA_DIR)/etc/network
48 $(SED) "s/ide_cs/ide-cs/" $(PCMCIA_DIR)/etc/config
49 $(SED) "s/bind \"wvlan_cs\"/bind \"orinoco_cs\"/g" $(PCMCIA_DIR)/etc/config
Eric Andersen7129da02003-01-18 21:27:22 +000050 touch $(PCMCIA_DIR)/.configured
51
52$(PCMCIA_DIR)/cardmgr/cardmgr: $(PCMCIA_DIR)/.configured
53 $(MAKE) -C $(PCMCIA_DIR) -i all
54 -A=`find $(PCMCIA_DIR) -type f -perm +111` ; \
55 for fo in $$A; do \
56 file $$fo | grep "ELF" | grep "executable" > /dev/null 2>&1; \
57 if [ $$? = 0 ] ; then \
58 $(STRIP) $$fo; \
59 fi; \
60 done
61 touch -c $(PCMCIA_DIR)/cardmgr/cardmgr
62
63$(TARGET_DIR)/sbin/cardmgr: $(PCMCIA_DIR)/cardmgr/cardmgr
64 rm -rf $(TARGET_DIR)/etc/pcmcia;
65 $(MAKE) -i -C $(PCMCIA_DIR) install
Eric Andersen7129da02003-01-18 21:27:22 +000066 rm -rf $(TARGET_DIR)/usr/man;
67 rm -rf $(TARGET_DIR)/usr/share/man;
68 rm -rf $(TARGET_DIR)/usr/X11R6/man;
69 rm -rf $(TARGET_DIR)/etc/rc.d;
70 rm -rf $(TARGET_DIR)/etc/rc?.d;
Eric Andersenfedfb7d2003-06-05 17:57:27 +000071 rm -f $(TARGET_DIR)/etc/init.d/pcmcia*;
Eric Andersen7129da02003-01-18 21:27:22 +000072 rm -f $(TARGET_DIR)/sbin/dump_cis $(TARGET_DIR)/sbin/pack_cis
73 rm -f $(TARGET_DIR)/usr/share/pnp.ids $(TARGET_DIR)/sbin/lspnp $(TARGET_DIR)/sbin/setpnp;
74 rm -f $(TARGET_DIR)/sbin/pcinitrd
75 rm -f $(TARGET_DIR)/sbin/probe
Eric Andersenef9d12c2003-06-04 20:47:18 +000076 rm -f $(TARGET_DIR)/sbin/ide_info
77 rm -f $(TARGET_DIR)/sbin/scsi_info
78 rm -f $(TARGET_DIR)/sbin/ftl_check
79 rm -f $(TARGET_DIR)/sbin/ftl_format
80 rm -f $(TARGET_DIR)/usr/X11R6/bin/xcardinfo
81 rm -rf $(TARGET_DIR)/etc/sysconfig
Eric Andersen5d5cef02003-06-10 03:02:26 +000082 mkdir -p $(TARGET_DIR)/etc/default
Eric Andersenadd0cec2003-06-09 18:28:53 +000083 cp -f $(PCMCIA_DIR)/etc/pcmcia $(TARGET_DIR)/etc/default/
Eric Andersenfedfb7d2003-06-05 17:57:27 +000084 cp -f $(PCMCIA_DIR)/etc/rc.pcmcia $(TARGET_DIR)/etc/init.d/S30pcmcia
Eric Andersenef9d12c2003-06-04 20:47:18 +000085 rm -rf $(TARGET_DIR)/etc/pcmcia/cis
Eric Andersen39eb7da2003-02-04 10:35:13 +000086 chmod a+x $(TARGET_DIR)/etc/init.d/S30pcmcia
Eric Andersen7129da02003-01-18 21:27:22 +000087 chmod -R u+w $(TARGET_DIR)/etc/pcmcia/*
88
Eric Andersen12c383b2003-06-20 12:15:27 +000089# use busybox depmod.pl so we need the sources unpacked
90$(PCMCIA_DIR)/.modules.dep: $(BUSYBOX_DIR)/.configured $(TARGET_DIR)/lib/modules
91 [ -d $(TARGET_DIR)/lib/modules/$(LINUX_VERSION) ] && \
92 $(BUSYBOX_DIR)/examples/depmod.pl \
93 -b $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/ \
94 -k $(LINUX_DIR)/vmlinux \
95 -F $(LINUX_DIR)/System.map \
96 > $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)/modules.dep
97 touch $(PCMCIA_DIR)/.modules.dep
98
Eric Andersenee654b52004-10-05 07:10:07 +000099pcmcia: uclibc linux $(TARGET_DIR)/sbin/cardmgr $(PCMCIA_DIR)/.modules.dep
Eric Andersen7129da02003-01-18 21:27:22 +0000100
101pcmcia-clean:
102 rm -f $(TARGET_DIR)/sbin/cardmgr
103 -$(MAKE) -C $(PCMCIA_DIR) clean
104 rm -f $(PCMCIA_DIR)/.configured $(PCMCIA_DIR)/config.out
105
106pcmcia-dirclean:
107 rm -rf $(PCMCIA_DIR)
Eric Andersend06645d2005-02-10 03:06:39 +0000108#############################################################
109#
110# Toplevel Makefile options
111#
112#############################################################
113ifeq ($(strip $(BR2_PACKAGE_PCMCIA)),y)
114TARGETS+=pcmcia
115endif