Root/toolchain/kernel-headers/Makefile

1#
2# Copyright (C) 2006-2009 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7include $(TOPDIR)/rules.mk
8
9KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
10BUILD_DIR := $(KERNEL_BUILD_DIR)
11
12override QUILT:=
13override HOST_QUILT:=
14
15include $(INCLUDE_DIR)/kernel.mk
16
17PKG_NAME:=linux
18PKG_VERSION:=$(LINUX_VERSION)
19PKG_SOURCE:=$(LINUX_SOURCE)
20PKG_SOURCE_URL:=$(LINUX_SITE)
21HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
22PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
23LINUX_DIR := $(HOST_BUILD_DIR)
24FILES_DIR :=
25PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
26
27include $(INCLUDE_DIR)/toolchain-build.mk
28include $(INCLUDE_DIR)/kernel-defaults.mk
29
30ifeq ($(strip $(BOARD)),uml)
31  LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
32endif
33
34HOST_EXTRACFLAGS=
35
36LINUX_HAS_HEADERS_INSTALL:=y
37
38KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
39    HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
40    ARCH=$(LINUX_KARCH) \
41    CC="$(KERNEL_CC)" \
42    CFLAGS="$(TARGET_CFLAGS)" \
43    CROSS_COMPILE=$(TARGET_CROSS) \
44    KBUILD_HAVE_NLS=no \
45    CONFIG_SHELL=$(BASH)
46
47define Host/Configure/all
48    mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
49    $(KMAKE) \
50        INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
51        headers_install
52endef
53
54# XXX: the following is needed to build lzma-loader
55ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
56  define Host/Configure/lzma
57    $(CP) \
58        $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
59        $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
60        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
61  endef
62endif
63
64define Host/Configure/post/cris
65    $(CP) \
66        $(HOST_BUILD_DIR)/include/linux/user.h \
67        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/linux/
68    ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch-v10/arch \
69        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch
70    $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/user.h
71endef
72
73define Host/Configure/post/ubicom32
74    $(CP) \
75        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
76        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
77        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
78        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
79        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
80endef
81
82define Host/Configure/post/mips
83    $(call Host/Configure/lzma)
84endef
85
86define Host/Configure/post/mipsel
87    $(call Host/Configure/lzma)
88endef
89
90define Host/Prepare
91    $(call Kernel/Prepare/Default)
92    ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
93    $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
94endef
95
96define Host/Configure
97    env
98    yes '' | $(KMAKE) oldconfig
99    $(call Host/Configure/all)
100    $(call Host/Configure/post/$(ARCH))
101endef
102
103define Host/Compile
104endef
105
106define Host/Install
107    $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
108endef
109
110define Host/Clean
111    rm -rf \
112        $(HOST_BUILD_DIR) \
113        $(BUILD_DIR_TOOLCHAIN)/linux \
114        $(BUILD_DIR_TOOLCHAIN)/linux-dev
115endef
116
117$(eval $(call HostBuild))
118

Archive Download this file



interactive