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