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)" \
25 CONFIG_SHELL
="$(BASH)"
27 INITRAMFS_EXTRA_FILES ?
= $(GENERIC_PLATFORM_DIR
)/image
/initramfs-base-files.txt
30 KERNEL_MAKEOPTS
+= CC
="$(KERNEL_CC)"
34 Kernel
/Patch
:=$(Kernel
/Patch
/Default
)
35 define Kernel
/Prepare
/Default
36 bzcat
$(DL_DIR
)/$(LINUX_SOURCE
) |
$(TAR
) -C
$(KERNEL_BUILD_DIR
) $(TAR_OPTIONS
)
38 $(if
$(QUILT
),touch
$(LINUX_DIR
)/.quilt_used
)
41 define Kernel
/Configure
/2.4
42 $(SED
) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR
)/arch
/mips
/Makefile
43 $(MAKE
) $(KERNEL_MAKEOPTS
) oldconfig
include/linux
/compile.h
include/linux
/version.h
44 $(MAKE
) $(KERNEL_MAKEOPTS
) dep
46 define Kernel
/Configure
/2.6
47 -$(MAKE
) $(KERNEL_MAKEOPTS
) oldconfig prepare scripts
49 define Kernel
/Configure
/Default
50 $(LINUX_CONFCMD
) > $(LINUX_DIR
)/.config.target
51 $(SCRIPT_DIR
)/metadata.pl kconfig
$(TMP_DIR
)/.packageinfo
$(TOPDIR
)/.config
> $(LINUX_DIR
)/.config.
override
52 $(SCRIPT_DIR
)/kconfig.pl
'm+' $(LINUX_DIR
)/.config.target
$(LINUX_DIR
)/.config.
override > $(LINUX_DIR
)/.config
53 $(call Kernel
/Configure
/$(KERNEL
))
54 rm -rf
$(KERNEL_BUILD_DIR
)/modules
57 define Kernel
/CompileModules
/Default
58 rm -f
$(LINUX_DIR
)/vmlinux
$(LINUX_DIR
)/System.map
59 $(MAKE
) $(KERNEL_MAKEOPTS
) 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="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR
)/.config
68 echo
'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR
)/.config
69 echo
'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR
)/.config
72 define Kernel
/SetInitramfs
73 mv
$(LINUX_DIR
)/.config
$(LINUX_DIR
)/.config.old
74 grep
-v INITRAMFS
$(LINUX_DIR
)/.config.old
> $(LINUX_DIR
)/.config
75 rm -f
$(TARGET_DIR
)/init
76 echo
'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR
)/.config
80 define Kernel
/CompileImage
/Default
81 $(call Kernel
/SetInitramfs
)
82 $(MAKE
) $(KERNEL_MAKEOPTS
) $(KERNELNAME
)
83 $(KERNEL_CROSS
)objcopy
-O binary
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
$(LINUX_DIR
)/vmlinux
$(LINUX_KERNEL
)
84 $(KERNEL_CROSS
)objcopy
-R .reginfo
-R .note
-R .comment
-R .mdebug
-S
$(LINUX_DIR
)/vmlinux
$(KERNEL_BUILD_DIR
)/vmlinux.elf
87 define Kernel
/Clean
/Default
88 rm -f
$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
)/.configured
90 $(MAKE
) -C
$(KERNEL_BUILD_DIR
)/linux-
$(LINUX_VERSION
) clean