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.
9 ifneq (,$(findstring x86
,$(BOARD
)))
12 ifneq (,$(findstring rdc
,$(BOARD
)))
15 ifneq (,$(findstring ppc
,$(BOARD
)))
18 ifneq (,$(findstring avr32
,$(BOARD
)))
22 KERNEL_MAKEOPTS
:= -C
$(LINUX_DIR
) \
23 CROSS_COMPILE
="$(KERNEL_CROSS)" \
24 ARCH
="$(LINUX_KARCH)" \
26 CONFIG_SHELL
="$(BASH)"
28 INITRAMFS_EXTRA_FILES ?
= $(GENERIC_PLATFORM_DIR
)/image
/initramfs-base-files.txt
31 KERNEL_MAKEOPTS
+= CC
="$(KERNEL_CC)"
35 Kernel
/Patch
:=$(Kernel
/Patch
/Default
)
36 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE
)),"")
37 define Kernel
/Prepare
/Default
38 bzcat
$(DL_DIR
)/$(LINUX_SOURCE
) |
$(TAR
) -C
$(KERNEL_BUILD_DIR
) $(TAR_OPTIONS
)
40 $(if
$(QUILT
),touch
$(LINUX_DIR
)/.quilt_used
)
43 define Kernel
/Prepare
/Default
44 mkdir
-p
$(KERNEL_BUILD_DIR
)
45 if
[ -d
$(LINUX_DIR
) ]; then \
48 ln
-s
$(CONFIG_EXTERNAL_KERNEL_TREE
) $(LINUX_DIR
)
52 define Kernel
/Configure
/2.4
53 $(SED
) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR
)/arch
/mips
/Makefile
54 $(MAKE
) $(KERNEL_MAKEOPTS
) oldconfig
include/linux
/compile.h
include/linux
/version.h
55 $(MAKE
) $(KERNEL_MAKEOPTS
) dep
57 define Kernel
/Configure
/2.6
58 -$(MAKE
) $(KERNEL_MAKEOPTS
) oldconfig prepare scripts
60 define Kernel
/Configure
/Default
61 $(LINUX_CONFCMD
) > $(LINUX_DIR
)/.config.target
62 $(SCRIPT_DIR
)/metadata.pl kconfig
$(TMP_DIR
)/.packageinfo
$(TOPDIR
)/.config
> $(LINUX_DIR
)/.config.
override
63 $(SCRIPT_DIR
)/kconfig.pl
'm+' $(LINUX_DIR
)/.config.target
$(LINUX_DIR
)/.config.
override > $(LINUX_DIR
)/.config
64 $(call Kernel
/Configure
/$(KERNEL
))
65 rm -rf
$(KERNEL_BUILD_DIR
)/modules
68 define Kernel
/CompileModules
/Default
69 rm -f
$(LINUX_DIR
)/vmlinux
$(LINUX_DIR
)/System.map
70 $(MAKE
) $(KERNEL_MAKEOPTS
) modules
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="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR
)/.config
79 echo
'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR
)/.config
80 echo
'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR
)/.config
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
91 define Kernel
/CompileImage
/Default
92 $(call Kernel
/SetInitramfs
)
93 $(MAKE
) $(KERNEL_MAKEOPTS
) $(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
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