8f8124ffbdce51be3521426960da65019f92645f
[openwrt.git] / openwrt / package / linux / linux-2.4 / linux.mk
1 #############################################################
2 # $Id$
3 #
4 # Linux 2.4 kernel target for the OpenWRT project
5 #
6 # patches are sorted by numbers
7 # 0xx needed patches for board, cpu, filesystem
8 # 1xx addon patches for new features (netfilter, ebtables, cifs,..)
9 # 2xx compile fixes, driver fixes
10 #
11 #############################################################
12
13 LINUX_FORMAT=zImage
14 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
15 -e 's/mipsel/mips/' \
16 -e 's/powerpc/ppc/' \
17 -e 's/sh[234]/sh/' \
18 )
19
20 LINUX_BINARY_DRIVER_SITE=http://openwrt.org/downloads/
21 LINUX_SOURCE=linux-$(LINUX_VERSION).tar.bz2
22 LINUX_KCONFIG=./linux-2.4/linux.config
23 LINUX_PATCHES=./linux-2.4/patches
24 LINUX_BINLOC=arch/$(LINUX_KARCH)/bcm947xx/compressed/piggy
25 # Used by pcmcia-cs and others
26 LINUX_SOURCE_DIR=$(LINUX_DIR)-$(LINUX_VERSION)
27
28 # proprietary driver, extracted from asus GPL sourcetree GPL_1941.zip
29 LINUX_BINARY_WL_DRIVER=kernel-binary-wl-0.3.tar.gz
30 LINUX_BINARY_WL_MD5SUM=cc45df670bcfb4e74a709b9d7beba636
31 LINUX_ET_DRIVER=kernel-source-et-0.7.tar.gz
32 LINUX_ET_MD5SUM=f2277895f52eae26ae37065685507031
33
34 TARGET_MODULES_DIR=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
35
36 $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER):
37 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_BINARY_WL_DRIVER) $(LINUX_BINARY_WL_MD5SUM) $(LINUX_BINARY_DRIVER_SITE)
38
39 $(DL_DIR)/$(LINUX_ET_DRIVER):
40 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_ET_DRIVER) $(LINUX_ET_MD5SUM) $(LINUX_BINARY_DRIVER_SITE)
41
42 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE) $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) $(DL_DIR)/$(LINUX_ET_DRIVER)
43 -mkdir -p $(BUILD_DIR)
44 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
45 ln -sf $(LINUX_DIR)-$(LINUX_VERSION) $(LINUX_DIR)
46 zcat $(DL_DIR)/$(LINUX_BINARY_WL_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
47 zcat $(DL_DIR)/$(LINUX_ET_DRIVER) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
48 touch $(LINUX_DIR)/.unpacked
49
50 $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
51 # copy binary wlan driver
52 mkdir $(LINUX_DIR)/drivers/net/{et,wl}
53 cp -a $(BUILD_DIR)/wl/*.o $(LINUX_DIR)/drivers/net/wl
54 # copy proprietary et source
55 cp -a $(BUILD_DIR)/et/* $(LINUX_DIR)/drivers/net/et
56 mkdir -p $(LINUX_DIR)/arch/mips/bcm947xx/include/
57 cp -a $(BUILD_DIR)/et/*.h $(LINUX_DIR)/arch/mips/bcm947xx/include/
58 $(PATCH) $(LINUX_DIR) $(LINUX_PATCHES)
59 touch $(LINUX_DIR)/.patched
60
61 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
62 -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
63 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
64 $(LINUX_DIR)/Makefile \
65 $(LINUX_DIR)/arch/mips/Makefile
66 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
67 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/version.h
68 touch $(LINUX_DIR)/.configured
69
70 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
71 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) dep
72 touch $(LINUX_DIR)/.depend_done
73
74 $(LINUX_DIR)/$(LINUX_BINLOC): $(LINUX_DIR)/.depend_done
75 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) CFLAGS_KERNEL="-fno-delayed-branch " $(LINUX_FORMAT)
76
77 $(LINUX_KERNEL): $(LINUX_DIR)/$(LINUX_BINLOC)
78 cp -fa $< $@
79 touch -c $(LINUX_KERNEL)
80
81 $(LINUX_IMAGE): $(LINUX_KERNEL)
82 cat $^ | $(BUILD_DIR)/lzma/lzma e -si -so -eos > $@ || (rm -f $@ && false)
83
84 $(LINUX_DIR)/.modules_done: $(LINUX_KERNEL) $(LINUX_IMAGE)
85 rm -rf $(BUILD_DIR)/modules
86 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH) CFLAGS_KERNEL="-fno-delayed-branch " modules
87 $(MAKE) -C $(LINUX_DIR) DEPMOD=true INSTALL_MOD_PATH=$(BUILD_DIR)/modules modules_install
88 touch $(LINUX_DIR)/.modules_done
89
90 $(STAGING_DIR)/include/linux/version.h: $(LINUX_DIR)/.configured
91 mkdir -p $(STAGING_DIR)/include
92 tar -ch -C $(LINUX_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
93 tar -ch -C $(LINUX_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
94
95 $(TARGET_MODULES_DIR):
96 -mkdir -p $(TARGET_MODULES_DIR)
97
98 linux: $(LINUX_DIR)/.modules_done $(TARGET_MODULES_DIR)
99
100 linux-source: $(DL_DIR)/$(LINUX_SOURCE)
101
102 # This has been renamed so we do _NOT_ by default run this on 'make clean'
103 linuxclean: clean
104 rm -f $(LINUX_KERNEL) $(LINUX_IMAGE)
105 -$(MAKE) -C $(LINUX_DIR) clean
106
107 linux-dirclean:
108 rm -f $(BUILD_DIR)/openwrt-kmodules.tar.bz2
109 rm -rf $(LINUX_DIR)-$(LINUX_VERSION)
110 rm -rf $(LINUX_DIR)
111 rm -rf $(BUILD_DIR)/modules
112 rm -rf $(BUILD_DIR)/wl
113 rm -rf $(BUILD_DIR)/et
114
This page took 0.045238 seconds and 3 git commands to generate.