upgrade to linux 2.6.21.4
[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 # For target profile selection - the default set
9 DEFAULT_PACKAGES:=base-files libgcc uclibc bridge busybox dnsmasq dropbear iptables mtd ppp ppp-mod-pppoe mtd kmod-ipt-nathelper
10 ifneq ($(KERNEL),2.4)
11 DEFAULT_PACKAGES+=udevtrigger hotplug2
12 endif
13
14 KERNELNAME=
15 ifneq (,$(findstring x86,$(BOARD)))
16 KERNELNAME="bzImage"
17 endif
18 ifneq (,$(findstring rdc,$(BOARD)))
19 KERNELNAME="bzImage"
20 endif
21 ifneq (,$(findstring ppc,$(BOARD)))
22 KERNELNAME="uImage"
23 endif
24 ifneq (,$(findstring avr32,$(BOARD)))
25 KERNELNAME="uImage"
26 endif
27
28 KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
29 CROSS_COMPILE="$(KERNEL_CROSS)" \
30 ARCH="$(LINUX_KARCH)" \
31 CONFIG_SHELL="$(BASH)"
32
33 # defined in quilt.mk
34 Kernel/Patch:=$(Kernel/Patch/Default)
35 define Kernel/Prepare/Default
36 bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
37 $(Kernel/Patch)
38 endef
39
40 define Kernel/Configure/2.4
41 $(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
42 $(MAKE) $(KERNEL_MAKEOPTS) CC="$(KERNEL_CC)" oldconfig include/linux/compile.h include/linux/version.h
43 $(MAKE) $(KERNEL_MAKEOPTS) dep
44 endef
45 define Kernel/Configure/2.6
46 -$(MAKE) $(KERNEL_MAKEOPTS) CC="$(KERNEL_CC)" oldconfig prepare scripts
47 endef
48 define Kernel/Configure/Default
49 @if [ -f "./config/profile-$(PROFILE)" ]; then \
50 $(SCRIPT_DIR)/config.pl '+' $(GENERIC_PLATFORM_DIR)/config-template '+' $(LINUX_CONFIG) ./config/profile-$(PROFILE) > $(LINUX_DIR)/.config; \
51 else \
52 $(SCRIPT_DIR)/config.pl '+' $(GENERIC_PLATFORM_DIR)/config-template $(LINUX_CONFIG) > $(LINUX_DIR)/.config; \
53 fi
54 $(call Kernel/Configure/$(KERNEL))
55 rm -rf $(KERNEL_BUILD_DIR)/modules
56 @rm -f $(BUILD_DIR)/linux
57 ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
58 endef
59
60 define Kernel/CompileModules/Default
61 rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
62 $(MAKE) -j$(CONFIG_JLEVEL) $(KERNEL_MAKEOPTS) CC="$(KERNEL_CC)" modules
63 endef
64
65 ifeq ($(KERNEL),2.6)
66 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
67 define Kernel/SetInitramfs
68 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
69 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
70 echo 'CONFIG_INITRAMFS_SOURCE="../../root"' >> $(LINUX_DIR)/.config
71 echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config
72 echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config
73 endef
74 else
75 define Kernel/SetInitramfs
76 mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
77 grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
78 rm -f $(BUILD_DIR)/root/init
79 echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
80 endef
81 endif
82 endif
83 define Kernel/CompileImage/Default
84 $(call Kernel/SetInitramfs)
85 $(MAKE) -j$(CONFIG_JLEVEL) $(KERNEL_MAKEOPTS) CC="$(KERNEL_CC)" $(KERNELNAME)
86 $(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
87 $(KERNEL_CROSS)objcopy -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
88 endef
89
90 define Kernel/Clean/Default
91 rm -f $(LINUX_DIR)/.linux-compile
92 rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
93 rm -f $(LINUX_KERNEL)
94 $(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
95 endef
96
97
This page took 0.054563 seconds and 5 git commands to generate.