fix issues with multiple ppp links (noticed by Stefano Rivera)
[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 $(SCRIPT_DIR)/config.pl '+' $(GENERIC_LINUX_CONFIG) \
50 $(if $(wildcard ./config/profile-$(PROFILE)),'+' $(LINUX_CONFIG) ./config/profile-$(PROFILE), $(LINUX_CONFIG)) \
51 > $(LINUX_DIR)/.config.target
52 $(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override
53 $(SCRIPT_DIR)/config.pl 'm+' $(LINUX_DIR)/.config.target $(LINUX_DIR)/.config.override >$(LINUX_DIR)/.config
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) $(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="$(TARGET_DIR)"' >> $(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 $(TARGET_DIR)/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) $(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.046067 seconds and 5 git commands to generate.