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