remove bluetooth from ar7 config
[openwrt.git] / include / kernel-build.mk
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 KERNEL_BUILD:=1
8
9 include $(INCLUDE_DIR)/host.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
13 LINUX_SITE=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
14 http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
15 http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
16 http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
17
18 ifneq (,$(findstring uml,$(BOARD)))
19 LINUX_KARCH:=um
20 else
21 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
22 -e 's/mipsel/mips/' \
23 -e 's/mipseb/mips/' \
24 -e 's/powerpc/ppc/' \
25 -e 's/sh[234]/sh/' \
26 -e 's/armeb/arm/' \
27 )
28 endif
29
30 KERNELNAME=
31 ifneq (,$(findstring x86,$(BOARD)))
32 KERNELNAME="bzImage"
33 endif
34 ifneq (,$(findstring ppc,$(BOARD)))
35 KERNELNAME="uImage"
36 endif
37
38
39 $(DL_DIR)/$(LINUX_SOURCE):
40 -mkdir -p $(DL_DIR)
41 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
42
43 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
44 -mkdir -p $(KERNEL_BUILD_DIR)
45 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
46 touch $@
47
48 ifeq ($(KERNEL),2.4)
49 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched $(LINUX_DIR)/.config
50 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
51 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) oldconfig include/linux/compile.h include/linux/version.h
52 touch $@
53
54 $(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
55 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) dep
56 touch $@
57
58 $(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
59 else
60 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
61 $(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) oldconfig prepare scripts
62 touch $@
63 endif
64
65 ramdisk-config: $(LINUX_DIR)/.configured FORCE
66 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
67 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
68 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
69 echo 'CONFIG_INITRAMFS_SOURCE="../../root"' >> $(LINUX_DIR)/.config
70 echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config
71 echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config
72 mkdir -p $(BUILD_DIR)/root/etc/init.d
73 $(CP) ../generic-2.6/files/init $(BUILD_DIR)/root/
74 else
75 rm -f $(BUILD_DIR)/root/init $(BUILD_DIR)/root/etc/init.d/S00initramfs
76 echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
77 endif
78
79 $(LINUX_DIR)/vmlinux: ramdisk-config
80 $(MAKE) -j$(CONFIG_JLEVEL) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) $(KERNELNAME)
81
82 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
83 $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
84 touch -c $(LINUX_KERNEL)
85
86 $(LINUX_DIR)/.modules_done: $(LINUX_DIR)/.config
87 rm -rf $(KERNEL_BUILD_DIR)/modules
88 $(MAKE) -j$(CONFIG_JLEVEL) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) modules
89 $(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) DEPMOD=true INSTALL_MOD_PATH=$(KERNEL_BUILD_DIR)/modules modules_install
90 touch $(LINUX_DIR)/.modules_done
91
92 $(LINUX_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
93 @rm -f $(BUILD_DIR)/linux
94 ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
95 touch $@
96
97 $(TOPDIR)/.kernel.mk: $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL)/Makefile
98 echo "CONFIG_BOARD:=$(BOARD)" > $@
99 echo "CONFIG_KERNEL:=$(KERNEL)" >> $@
100 echo "CONFIG_LINUX_VERSION:=$(LINUX_VERSION)" >> $@
101 echo "CONFIG_LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@
102 echo "CONFIG_LINUX_KARCH:=$(LINUX_KARCH)" >> $@
103
104 download: $(DL_DIR)/$(LINUX_SOURCE)
105 prepare: $(LINUX_DIR)/.configured
106 @mkdir -p $(LINUX_DIR)
107
108 compile: prepare $(LINUX_DIR)/.linux-compile
109 install: compile $(LINUX_KERNEL)
110
111 mostlyclean: FORCE
112 rm -f $(LINUX_DIR)/.linux-compile
113 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
114 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
115 $(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
116 rm -f $(LINUX_KERNEL)
117
118 rebuild: FORCE
119 -$(MAKE) mostlyclean
120 if [ -f $(LINUX_KERNEL) ]; then \
121 $(MAKE) clean; \
122 fi
123 $(MAKE) compile $(MAKE_TRACE)
124
125 clean: FORCE
126 rm -f $(STAMP_DIR)/.linux-compile
127 rm -rf $(KERNEL_BUILD_DIR)
128
This page took 0.050595 seconds and 5 git commands to generate.