update openvpn to rc20
[openwrt.git] / package / linux / linux.mk
1 #############################################################
2 # $Id$
3 #
4 # Linux kernel target for the OpenWRT project
5 #
6 # patches are sorted by numbers
7 # 000 patch between linux-2.4.29 and linux-mips-cvs
8 # 0xx linksys patches
9 # 1xx OpenWRT patches (diag,compressed,..)
10 # 2xx fixes for 2.4.29 integration (wl driver)
11 # 3xx kernel feature patches (squashfs,jffs2 compression,..)
12 # 4xx patches needed to integrate feature patches
13 #
14 #############################################################
15
16 LINUX_FORMAT=zImage
17 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
18 -e 's/mipsel/mips/' \
19 -e 's/powerpc/ppc/' \
20 -e 's/sh[234]/sh/' \
21 )
22
23 LINUX_BINARY_DRIVER_SITE=http://openwrt.openbsd-geek.de
24 LINUX_SOURCE=linux-$(LINUX_VERSION).tar.bz2
25 LINUX_KCONFIG=./linux.config
26 LINUX_PATCHES=./kernel-patches
27 LINUX_KERNEL_SOURCE=./kernel-source
28 LINUX_BINLOC=arch/$(LINUX_KARCH)/brcm-boards/bcm947xx/compressed/piggy
29 # Used by pcmcia-cs and others
30 LINUX_SOURCE_DIR=$(LINUX_DIR)-$(LINUX_VERSION)
31
32 # binary driver extracted from linksys firmware GPL sourcetree WRT54GS_3_37_2_1109_US
33 LINUX_BINARY_WL_DRIVER=kernel-binary-wl-0.1.tar.gz
34 LINUX_BINARY_WL_MD5SUM=1b57ba129ad80c7f1702d0be1422cfba
35 LINUX_BINARY_ET_DRIVER=kernel-binary-et-0.2.tar.gz
36 LINUX_BINARY_ET_MD5SUM=d657f929bceee926bc28821d753d945c
37
38 TARGET_MODULES_DIR=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
39
40 $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER):
41 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_BINARY_WL_DRIVER) $(LINUX_BINARY_WL_MD5SUM) $(LINUX_BINARY_DRIVER_SITE)
42
43 $(DL_DIR)/$(LINUX_BINARY_ET_DRIVER):
44 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_BINARY_ET_DRIVER) $(LINUX_BINARY_ET_MD5SUM) $(LINUX_BINARY_DRIVER_SITE)
45
46 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) $(DL_DIR)/$(LINUX_BINARY_ET_DRIVER)
47 -mkdir -p $(BUILD_DIR)
48 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
49 ln -sf $(LINUX_DIR)-$(LINUX_VERSION) $(LINUX_DIR)
50 # extract wlan and lan binary only driver
51 zcat $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
52 zcat $(DL_DIR)/$(LINUX_BINARY_ET_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
53 touch $(LINUX_DIR)/.unpacked
54
55 $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
56 $(PATCH) $(LINUX_DIR) $(LINUX_PATCHES)
57 # copy kernel source which is maintained in openwrt via cvs
58 cp -a $(LINUX_KERNEL_SOURCE)/* $(LINUX_DIR)
59 # copy binary drivers
60 cp -a $(BUILD_DIR)/wl/*.o $(LINUX_DIR)/drivers/net/wl
61 cp -a $(BUILD_DIR)/et/*.o $(LINUX_DIR)/drivers/net/et
62 $(SED) 's/@expr length/@-expr length/' $(LINUX_DIR)/Makefile
63 touch $(LINUX_DIR)/.patched
64
65 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
66 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
67 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
68 $(LINUX_DIR)/Makefile \
69 $(LINUX_DIR)/arch/mips/Makefile
70 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
71 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h
72 touch $(LINUX_DIR)/.configured
73
74 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
75 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) dep
76 touch $(LINUX_DIR)/.depend_done
77
78 $(LINUX_DIR)/$(LINUX_BINLOC): $(LINUX_DIR)/.depend_done
79 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) $(LINUX_FORMAT)
80
81 $(LINUX_KERNEL): $(LINUX_DIR)/$(LINUX_BINLOC)
82 cp -fa $(LINUX_DIR)/$(LINUX_BINLOC) $(LINUX_KERNEL)
83 touch -c $(LINUX_KERNEL)
84
85 $(LINUX_DIR)/.modules_done: $(LINUX_KERNEL)
86 rm -rf $(BUILD_DIR)/modules
87 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) modules
88 $(MAKE) -C $(LINUX_DIR) DEPMOD=true INSTALL_MOD_PATH=$(BUILD_DIR)/modules modules_install
89 touch $(LINUX_DIR)/.modules_done
90
91 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
92 mkdir -p $(STAGING_DIR)/include
93 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
94 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
95
96 $(TARGET_MODULES_DIR):
97 -mkdir -p $(TARGET_MODULES_DIR)
98 cp $(LINUX_DIR)/drivers/net/diag/diag.o $(TARGET_MODULES_DIR)
99
100 linux: $(LINUX_DIR)/.modules_done $(TARGET_MODULES_DIR)
101
102 linux-source: $(DL_DIR)/$(LINUX_SOURCE)
103
104 # This has been renamed so we do _NOT_ by default run this on 'make clean'
105 linuxclean: clean
106 rm -f $(LINUX_KERNEL)
107 -$(MAKE) -C $(LINUX_DIR) clean
108
109 linux-dirclean:
110 rm -f $(BUILD_DIR)/openwrt-kmodules.tar.bz2
111 rm -rf $(LINUX_DIR)-$(LINUX_VERSION)
112 rm -rf $(LINUX_DIR)
113 rm -rf $(BUILD_DIR)/modules
114 rm -rf $(BUILD_DIR)/wl
115 rm -rf $(BUILD_DIR)/et
116
This page took 0.063885 seconds and 5 git commands to generate.