kernel 2.6.38: add a few missing config symbols
[openwrt.git] / include / kernel-defaults.mk
1 #
2 # Copyright (C) 2006-2011 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 KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
9 CROSS_COMPILE="$(KERNEL_CROSS)" \
10 ARCH="$(LINUX_KARCH)" \
11 KBUILD_HAVE_NLS=no \
12 CONFIG_SHELL="$(BASH)"
13
14 ifdef CONFIG_STRIP_KERNEL_EXPORTS
15 KERNEL_MAKEOPTS += \
16 EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h"
17 endif
18
19 INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
20
21 ifneq (,$(KERNEL_CC))
22 KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
23 endif
24
25 # defined in quilt.mk
26 Kernel/Patch:=$(Kernel/Patch/Default)
27 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
28 ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
29 define Kernel/Prepare/Default
30 bzcat $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
31 $(Kernel/Patch)
32 touch $(LINUX_DIR)/.quilt_used
33 endef
34 else
35 ifeq ($(strip $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY)),"")
36 define Kernel/Prepare/Default
37 git clone $(CONFIG_KERNEL_GIT_CLONE_URI) $(LINUX_DIR)
38 endef
39 else
40 define Kernel/Prepare/Default
41 git clone --reference $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY) $(CONFIG_KERNEL_GIT_CLONE_URI) $(LINUX_DIR)
42 endef
43 endif
44 endif
45 else
46 define Kernel/Prepare/Default
47 mkdir -p $(KERNEL_BUILD_DIR)
48 if [ -d $(LINUX_DIR) ]; then \
49 rmdir $(LINUX_DIR); \
50 fi
51 ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
52 endef
53 endif
54
55 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
56 define Kernel/SetInitramfs
57 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
58 grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
59 echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
60 echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
61 echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
62 echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
63 echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(LINUX_DIR)/.config
64 echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),CONFIG_INITRAMFS_COMPRESSION_GZIP=y\nCONFIG_RD_GZIP=y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n# CONFIG_RD_GZIP is not set)" >> $(LINUX_DIR)/.config
65 echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),CONFIG_INITRAMFS_COMPRESSION_BZIP2=y\nCONFIG_RD_BZIP2=y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n# CONFIG_RD_BZIP2 is not set)" >> $(LINUX_DIR)/.config
66 echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),CONFIG_INITRAMFS_COMPRESSION_LZMA=y\nCONFIG_RD_LZMA=y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n# CONFIG_RD_LZMA is not set)" >> $(LINUX_DIR)/.config
67 echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),CONFIG_INITRAMFS_COMPRESSION_LZO=y\nCONFIG_RD_LZO=y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n# CONFIG_RD_LZO is not set)" >> $(LINUX_DIR)/.config
68 echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(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
78 define Kernel/Configure/Default
79 $(LINUX_CONFCMD) > $(LINUX_DIR)/.config.target
80 # copy CONFIG_KERNEL_* settings over to .config.target
81 awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(TOPDIR)/.config >> $(LINUX_DIR)/.config.target
82 echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target
83 echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_DIR)/.config.target
84 echo "# CONFIG_KPROBES is not set" >> $(LINUX_DIR)/.config.target
85 $(SED) 's,.*CONFIG_AEABI.*,$(if $(CONFIG_EABI_SUPPORT),CONFIG_AEABI=y,# CONFIG_AEABI is not set),' $(LINUX_DIR)/.config.target
86 $(if $(CONFIG_EABI_SUPPORT),echo '# CONFIG_OABI_COMPAT is not set' >> $(LINUX_DIR)/.config.target)
87 $(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override
88 $(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config
89 $(call Kernel/SetInitramfs)
90 -$(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
91 rm -rf $(KERNEL_BUILD_DIR)/modules
92 endef
93
94 define Kernel/CompileModules/Default
95 rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
96 +$(MAKE) $(KERNEL_MAKEOPTS) modules
97 endef
98
99 OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
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 $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
105 $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -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.04576 seconds and 5 git commands to generate.