firewall: don't clear the mangle table at startup or stop - it doesn't use it and...
[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 avr32,$(BOARD)))
16 KERNELNAME="uImage"
17 endif
18
19 KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
20 CROSS_COMPILE="$(KERNEL_CROSS)" \
21 ARCH="$(LINUX_KARCH)" \
22 KBUILD_HAVE_NLS=no \
23 CONFIG_SHELL="$(BASH)"
24
25 INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
26
27 ifneq (,$(KERNEL_CC))
28 KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
29 endif
30
31 # defined in quilt.mk
32 Kernel/Patch:=$(Kernel/Patch/Default)
33 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
34 ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
35 define Kernel/Prepare/Default
36 bzcat $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
37 $(Kernel/Patch)
38 touch $(LINUX_DIR)/.quilt_used
39 endef
40 else
41 ifeq ($(strip $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY)),"")
42 define Kernel/Prepare/Default
43 git clone $(CONFIG_KERNEL_GIT_CLONE_URI) $(LINUX_DIR)
44 endef
45 else
46 define Kernel/Prepare/Default
47 git clone --reference $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY) $(CONFIG_KERNEL_GIT_CLONE_URI) $(LINUX_DIR)
48 endef
49 endif
50 endif
51 else
52 define Kernel/Prepare/Default
53 mkdir -p $(KERNEL_BUILD_DIR)
54 if [ -d $(LINUX_DIR) ]; then \
55 rmdir $(LINUX_DIR); \
56 fi
57 ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
58 endef
59 endif
60
61 ifeq ($(KERNEL),2.6)
62 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
63 define Kernel/SetInitramfs
64 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
65 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
66 echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
67 echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
68 echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
69 endef
70 else
71 define Kernel/SetInitramfs
72 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
73 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
74 echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
75 endef
76 endif
77 endif
78
79 define Kernel/Configure/2.4
80 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
81 $(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) oldconfig include/linux/compile.h include/linux/version.h
82 $(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) dep
83 endef
84 define Kernel/Configure/2.6
85 -$(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
86 endef
87 define Kernel/Configure/Default
88 $(LINUX_CONFCMD) > $(LINUX_DIR)/.config.target
89 $(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override
90 $(SCRIPT_DIR)/kconfig.pl 'm+' $(LINUX_DIR)/.config.target $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config
91 $(call Kernel/SetInitramfs)
92 $(call Kernel/Configure/$(KERNEL))
93 rm -rf $(KERNEL_BUILD_DIR)/modules
94 endef
95
96 define Kernel/CompileModules/Default
97 rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
98 +$(MAKE) $(KERNEL_MAKEOPTS) modules
99 endef
100
101 define Kernel/CompileImage/Default
102 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),,rm -f $(TARGET_DIR)/init)
103 +$(MAKE) $(KERNEL_MAKEOPTS) $(KERNELNAME)
104 $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
105 $(KERNEL_CROSS)objcopy -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
106 endef
107
108 define Kernel/Clean/Default
109 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
110 rm -f $(LINUX_KERNEL)
111 $(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
112 endef
113
114
This page took 0.042571 seconds and 5 git commands to generate.