add option to turn off dynamic dhcp closes #2694
[openwrt.git] / include / kernel-defaults.mk
1 #
2 # Copyright (C) 2006-2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 KERNELNAME=
9 ifneq (,$(findstring x86,$(BOARD)))
10 KERNELNAME="bzImage"
11 endif
12 ifneq (,$(findstring rdc,$(BOARD)))
13 KERNELNAME="bzImage"
14 endif
15 ifneq (,$(findstring ppc,$(BOARD)))
16 KERNELNAME="uImage"
17 endif
18 ifneq (,$(findstring avr32,$(BOARD)))
19 KERNELNAME="uImage"
20 endif
21
22 KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
23 CROSS_COMPILE="$(KERNEL_CROSS)" \
24 ARCH="$(LINUX_KARCH)" \
25 CONFIG_SHELL="$(BASH)"
26
27 INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
28
29 ifneq (,$(KERNEL_CC))
30 KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
31 endif
32
33 # defined in quilt.mk
34 Kernel/Patch:=$(Kernel/Patch/Default)
35 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
36 define Kernel/Prepare/Default
37 bzcat $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
38 $(Kernel/Patch)
39 $(if $(QUILT),touch $(LINUX_DIR)/.quilt_used)
40 endef
41 else
42 define Kernel/Prepare/Default
43 mkdir -p $(KERNEL_BUILD_DIR)
44 if [ -d $(LINUX_DIR) ]; then \
45 rmdir $(LINUX_DIR); \
46 fi
47 ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
48 endef
49 endif
50
51 define Kernel/Configure/2.4
52 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
53 $(MAKE) $(KERNEL_MAKEOPTS) oldconfig include/linux/compile.h include/linux/version.h
54 $(MAKE) $(KERNEL_MAKEOPTS) dep
55 endef
56 define Kernel/Configure/2.6
57 -$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
58 endef
59 define Kernel/Configure/Default
60 $(LINUX_CONFCMD) > $(LINUX_DIR)/.config.target
61 $(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override
62 $(SCRIPT_DIR)/kconfig.pl 'm+' $(LINUX_DIR)/.config.target $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config
63 $(call Kernel/Configure/$(KERNEL))
64 rm -rf $(KERNEL_BUILD_DIR)/modules
65 endef
66
67 define Kernel/CompileModules/Default
68 rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
69 $(MAKE) $(KERNEL_MAKEOPTS) modules
70 endef
71
72 ifeq ($(KERNEL),2.6)
73 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
74 define Kernel/SetInitramfs
75 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
76 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
77 echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
78 echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
79 echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
80 endef
81 else
82 define Kernel/SetInitramfs
83 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
84 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
85 rm -f $(TARGET_DIR)/init
86 echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
87 endef
88 endif
89 endif
90 define Kernel/CompileImage/Default
91 $(call Kernel/SetInitramfs)
92 $(MAKE) $(KERNEL_MAKEOPTS) $(KERNELNAME)
93 $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
94 $(KERNEL_CROSS)objcopy -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
95 endef
96
97 define Kernel/Clean/Default
98 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
99 rm -f $(LINUX_KERNEL)
100 $(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
101 endef
102
103
This page took 0.057024 seconds and 5 git commands to generate.