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