remove some debugging junk (#492)
[openwrt.git] / target / linux / kernel.mk
1 LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
2 LINUX_SITE=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
3 http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
4 http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
5 http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
6
7 KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
8
9 $(TARGETS): $(PACKAGE_DIR)
10
11 $(PACKAGE_DIR):
12 mkdir -p $(PACKAGE_DIR)
13
14 $(DL_DIR)/$(LINUX_SOURCE):
15 -mkdir -p $(DL_DIR)
16 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
17
18 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
19 -mkdir -p $(LINUX_BUILD_DIR)
20 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
21 touch $@
22
23 ifeq ($(KERNEL),2.4)
24 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
25 $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
26 $(LINUX_DIR)/Makefile \
27 $(LINUX_DIR)/arch/*/Makefile
28 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
29 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/compile.h include/linux/version.h
30 touch $@
31
32 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
33 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) dep
34 touch $@
35
36 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
37 else
38 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
39 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) oldconfig prepare scripts
40 touch $@
41 endif
42
43 $(LINUX_DIR)/vmlinux: $(STAMP_DIR)/.linux-compile FORCE
44 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH)
45
46 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
47 $(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
48 touch -c $(LINUX_KERNEL)
49
50 $(LINUX_DIR)/.modules_done:
51 rm -rf $(LINUX_BUILD_DIR)/modules
52 $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH="$(TARGET_PATH)" modules
53 $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install
54 touch $(LINUX_DIR)/.modules_done
55
56 $(STAMP_DIR)/.linux-compile:
57 @$(MAKE) $(LINUX_DIR)/.modules_done $(TARGETS) $(KERNEL_IPKG)
58 ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
59 touch $@
60
61 $(KERNEL_IPKG):
62 rm -rf $(KERNEL_IDIR)
63 mkdir -p $(KERNEL_IDIR)/etc
64 $(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH)
65 if [ -f ./config/$(BOARD).modules ]; then \
66 cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
67 fi
68 $(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR)
69
70 $(BUILD_DIR)/kernel.mk: FORCE
71 echo "BOARD:=$(BOARD)" > $@
72 echo "LINUX_VERSION:=$(LINUX_VERSION)" >> $@
73 echo "LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@
74
75 source: $(DL_DIR)/$(LINUX_SOURCE)
76 prepare: $(BUILD_DIR)/kernel.mk
77 @mkdir -p $(STAMP_DIR) $(PACKAGE_DIR)
78 @$(MAKE) $(LINUX_DIR)/.configured
79
80 compile: prepare $(STAMP_DIR)/.linux-compile
81
82 install: compile $(LINUX_KERNEL)
83
84 mostlyclean:
85 rm -f $(STAMP_DIR)/.linux-compile
86 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
87 rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
88 $(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean
89 rm -f $(LINUX_KERNEL)
90
91 rebuild:
92 -$(MAKE) mostlyclean
93 if [ -f $(LINUX_KERNEL) ]; then \
94 $(MAKE) clean; \
95 fi
96 $(MAKE) compile $(MAKE_TRACE)
97
98 clean:
99 rm -f $(STAMP_DIR)/.linux-compile
100 rm -rf $(LINUX_BUILD_DIR)
101 rm -f $(TARGETS)
102
This page took 0.056779 seconds and 5 git commands to generate.