ath9k: kmod-ath9k has no extra menuconfig options, remove MENU:=1 (#8695)
[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
10 KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
11 CROSS_COMPILE="$(KERNEL_CROSS)" \
12 ARCH="$(LINUX_KARCH)" \
13 KBUILD_HAVE_NLS=no \
14 CONFIG_SHELL="$(BASH)"
15
16 ifdef CONFIG_STRIP_KERNEL_EXPORTS
17 KERNEL_MAKEOPTS += \
18 EXTRA_LDSFLAGS="-I$(KERNEL_BUILD_DIR) -include symtab.h"
19 endif
20
21 INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
22
23 ifneq (,$(KERNEL_CC))
24 KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
25 endif
26
27 # defined in quilt.mk
28 Kernel/Patch:=$(Kernel/Patch/Default)
29 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
30 ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
31 define Kernel/Prepare/Default
32 bzcat $(DL_DIR)/$(LINUX_SOURCE) | $(TAR) -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
33 $(Kernel/Patch)
34 touch $(LINUX_DIR)/.quilt_used
35 endef
36 else
37 ifeq ($(strip $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY)),"")
38 define Kernel/Prepare/Default
39 git clone $(CONFIG_KERNEL_GIT_CLONE_URI) $(LINUX_DIR)
40 endef
41 else
42 define Kernel/Prepare/Default
43 git clone --reference $(CONFIG_KERNEL_GIT_LOCAL_REPOSITORY) $(CONFIG_KERNEL_GIT_CLONE_URI) $(LINUX_DIR)
44 endef
45 endif
46 endif
47 else
48 define Kernel/Prepare/Default
49 mkdir -p $(KERNEL_BUILD_DIR)
50 if [ -d $(LINUX_DIR) ]; then \
51 rmdir $(LINUX_DIR); \
52 fi
53 ln -s $(CONFIG_EXTERNAL_KERNEL_TREE) $(LINUX_DIR)
54 endef
55 endif
56
57 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
58 define Kernel/SetInitramfs
59 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
60 grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
61 echo 'CONFIG_BLK_DEV_INITRD=y' >> $(LINUX_DIR)/.config
62 echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
63 echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
64 echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
65 echo "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE),CONFIG_INITRAMFS_COMPRESSION_NONE=y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set)" >> $(LINUX_DIR)/.config
66 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
67 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
68 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
69 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
70 endef
71 else
72 define Kernel/SetInitramfs
73 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
74 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
75 echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
76 endef
77 endif
78
79 define Kernel/Configure/Default
80 $(LINUX_CONFCMD) > $(LINUX_DIR)/.config.target
81 # copy CONFIG_KERNEL_* settings over to .config.target
82 awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' $(TOPDIR)/.config >> $(LINUX_DIR)/.config.target
83 echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $(LINUX_DIR)/.config.target
84 echo "# CONFIG_KALLSYMS_ALL is not set" >> $(LINUX_DIR)/.config.target
85 echo "# CONFIG_KPROBES is not set" >> $(LINUX_DIR)/.config.target
86 $(SED) 's,.*CONFIG_AEABI.*,$(if $(CONFIG_EABI_SUPPORT),CONFIG_AEABI=y,# CONFIG_AEABI is not set),' $(LINUX_DIR)/.config.target
87 $(if $(CONFIG_EABI_SUPPORT),echo '# CONFIG_OABI_COMPAT is not set' >> $(LINUX_DIR)/.config.target)
88 $(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override
89 $(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config
90 $(call Kernel/SetInitramfs)
91 -$(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
92 rm -rf $(KERNEL_BUILD_DIR)/modules
93 endef
94
95 define Kernel/CompileModules/Default
96 rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
97 +$(MAKE) $(KERNEL_MAKEOPTS) modules
98 endef
99
100 OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
101
102 define Kernel/CompileImage/Default
103 $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),,rm -f $(TARGET_DIR)/init)
104 +$(MAKE) $(KERNEL_MAKEOPTS) $(KERNELNAME)
105 $(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
106 $(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
107 endef
108
109 define Kernel/Clean/Default
110 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
111 rm -f $(LINUX_KERNEL)
112 $(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
113 endef
114
115
This page took 0.057384 seconds and 5 git commands to generate.