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-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
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
34LINUX_HAS_HEADERS_INSTALL:=y
35
36KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
37    ARCH=$(LINUX_KARCH) \
38    CC="$(KERNEL_CC)" \
39    CFLAGS="$(TARGET_CFLAGS)" \
40    CROSS_COMPILE=$(TARGET_CROSS) \
41    KBUILD_HAVE_NLS=no \
42    CONFIG_SHELL=$(BASH)
43
44define Host/Prepare/all
45    mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
46    $(KMAKE) \
47        INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
48        headers_install
49endef
50
51# XXX: the following is needed to build lzma-loader
52ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
53  define Host/Prepare/lzma
54    $(CP) \
55        $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
56        $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
57        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
58  endef
59endif
60
61define Host/Prepare/post/cris
62    $(CP) \
63        $(HOST_BUILD_DIR)/include/linux/user.h \
64        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/linux/
65    ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch-v10/arch \
66        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch
67    $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/user.h
68endef
69
70define Host/Prepare/post/ubicom32
71    $(CP) \
72        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
73        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
74        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
75        $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
76        $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
77endef
78
79define Host/Prepare/post/mips
80    $(call Host/Prepare/lzma)
81endef
82
83define Host/Prepare/post/mipsel
84    $(call Host/Prepare/lzma)
85endef
86
87define Host/Prepare
88    $(call Kernel/Prepare/Default)
89    ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
90    $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
91    yes '' | $(KMAKE) oldconfig
92    $(call Host/Prepare/all)
93    $(call Host/Prepare/post/$(ARCH))
94endef
95
96define Host/Configure
97endef
98
99define Host/Compile
100endef
101
102define Host/Install
103    $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
104endef
105
106define Host/Clean
107    rm -rf \
108        $(HOST_BUILD_DIR) \
109        $(BUILD_DIR_TOOLCHAIN)/linux \
110        $(BUILD_DIR_TOOLCHAIN)/linux-dev
111endef
112
113$(eval $(call HostBuild))
114

Archive Download this file



interactive