2 # Copyright (C) 2006-2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
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
11 DEFAULT_PACKAGES
+=udevtrigger hotplug2
15 ifneq (,$(findstring x86
,$(BOARD
)))
18 ifneq (,$(findstring rdc
,$(BOARD
)))
21 ifneq (,$(findstring ppc
,$(BOARD
)))
25 KERNEL_MAKEOPTS
:= -C
$(LINUX_DIR
) \
26 CROSS_COMPILE
="$(KERNEL_CROSS)" \
27 ARCH
="$(LINUX_KARCH)" \
28 CONFIG_SHELL
="$(BASH)"
30 define Kernel
/Prepare
/Default
31 bzcat
$(DL_DIR
)/$(LINUX_SOURCE
) |
tar -C
$(KERNEL_BUILD_DIR
) $(TAR_OPTIONS
)
32 if
[ -d
$(GENERIC_PLATFORM_DIR
)/patches
]; then
$(PATCH
) $(LINUX_DIR
) $(GENERIC_PLATFORM_DIR
)/patches
; fi
33 if
[ -d .
/files
]; then
$(CP
) .
/files
/* $(LINUX_DIR
)/; fi
34 if
[ -d .
/patches
]; then
$(PATCH
) $(LINUX_DIR
) .
/patches
; fi
37 define Kernel
/Configure
/2.4
38 $(SED
) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR
)/arch
/mips
/Makefile
39 $(MAKE
) $(KERNEL_MAKEOPTS
) CC
="$(KERNEL_CC)" oldconfig
include/linux
/compile.h
include/linux
/version.h
40 $(MAKE
) $(KERNEL_MAKEOPTS
) dep
42 define Kernel
/Configure
/2.6
43 $(MAKE
) $(KERNEL_MAKEOPTS
) CC
="$(KERNEL_CC)" oldconfig prepare scripts
45 define Kernel
/Configure
/Default
46 @if
[ -f
"./config/profile-$(PROFILE)" ]; then \
47 $(SCRIPT_DIR
)/config.pl
'+' $(GENERIC_PLATFORM_DIR
)/config-template
'+' $(LINUX_CONFIG
) .
/config
/profile-
$(PROFILE
) > $(LINUX_DIR
)/.config
; \
49 $(SCRIPT_DIR
)/config.pl
'+' $(GENERIC_PLATFORM_DIR
)/config-template
$(LINUX_CONFIG
) > $(LINUX_DIR
)/.config
; \
51 $(call Kernel
/Configure
/$(KERNEL
))
52 rm -rf
$(KERNEL_BUILD_DIR
)/modules
53 @
rm -f
$(BUILD_DIR
)/linux
54 ln
-sf
$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
) $(BUILD_DIR
)/linux
57 define Kernel
/CompileModules
/Default
58 rm -f
$(LINUX_DIR
)/vmlinux
$(LINUX_DIR
)/System.map
59 $(MAKE
) -j
$(CONFIG_JLEVEL
) $(KERNEL_MAKEOPTS
) CC
="$(KERNEL_CC)" modules
63 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),y
)
64 define Kernel
/SetInitramfs
65 mv
$(LINUX_DIR
)/.config
$(LINUX_DIR
)/.config.old
66 grep
-v INITRAMFS
$(LINUX_DIR
)/.config.old
> $(LINUX_DIR
)/.config
67 echo
'CONFIG_INITRAMFS_SOURCE="../../root"' >> $(LINUX_DIR
)/.config
68 echo
'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR
)/.config
69 echo
'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR
)/.config
70 mkdir
-p
$(BUILD_DIR
)/root
/etc
/init.d
71 $(CP
) $(GENERIC_PLATFORM_DIR
)/files
/init
$(BUILD_DIR
)/root
/
74 define Kernel
/SetInitramfs
75 mv
$(LINUX_DIR
)/.config
$(LINUX_DIR
)/.config.old
76 grep
-v INITRAMFS
$(LINUX_DIR
)/.config.old
> $(LINUX_DIR
)/.config
77 rm -f
$(BUILD_DIR
)/root
/init
$(BUILD_DIR
)/root
/etc
/init.d
/S00initramfs
78 echo
'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR
)/.config
82 define Kernel
/CompileImage
/Default
83 $(call Kernel
/SetInitramfs
)
84 $(MAKE
) -j
$(CONFIG_JLEVEL
) $(KERNEL_MAKEOPTS
) CC
="$(KERNEL_CC)" $(KERNELNAME
)
85 $(KERNEL_CROSS
)objcopy
-O binary
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
$(LINUX_DIR
)/vmlinux
$(LINUX_KERNEL
)
86 $(KERNEL_CROSS
)objcopy
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
$(LINUX_DIR
)/vmlinux
$(KERNEL_BUILD_DIR
)/vmlinux.elf
89 define Kernel
/Clean
/Default
90 rm -f
$(LINUX_DIR
)/.linux-compile
91 rm -f
$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.configured
93 $(MAKE
) -C
$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
) clean