summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2006-11-11 23:11:02 +0000
committerFelix Fietkau <nbd@openwrt.org>2006-11-11 23:11:02 +0000
commitcf4e7af392186e57f213053a898c62cd9400b692 (patch)
tree1f8a2d1023ef2469dbd0e2040599b3c69807cf92 /include
parent312802199b7cc09dde5ed867745f4c1baa3c5204 (diff)
downloadmtk-20170518-cf4e7af392186e57f213053a898c62cd9400b692.zip
mtk-20170518-cf4e7af392186e57f213053a898c62cd9400b692.tar.gz
mtk-20170518-cf4e7af392186e57f213053a898c62cd9400b692.tar.bz2
make target/linux/* directories self-contained, use the selected kernel version for the toolchain, autogenerate menuconfig and makefile code for target selection
SVN-Revision: 5498
Diffstat (limited to 'include')
-rw-r--r--include/host.mk4
-rw-r--r--include/kernel-build.mk50
-rw-r--r--include/kernel.mk30
-rw-r--r--include/package.mk9
-rw-r--r--include/prereq.mk11
-rw-r--r--include/target.mk26
6 files changed, 49 insertions, 81 deletions
diff --git a/include/host.mk b/include/host.mk
index 3100ce4..ed961e3 100644
--- a/include/host.mk
+++ b/include/host.mk
@@ -5,11 +5,11 @@
# See /LICENSE for more information.
#
-include $(TOPDIR)/.host.mk
+include $(TMP_DIR)/.host.mk
export TAR
-$(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host.mk
+$(TMP_DIR)/.host.mk: $(INCLUDE_DIR)/host.mk
@( \
HOST_OS=`uname`; \
case "$$HOST_OS" in \
diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 8420c83..e491e48 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -6,15 +6,16 @@
#
KERNEL_BUILD:=1
+ifeq ($(DUMP),1)
+ all: dumpinfo
+else
+ all: compile
+endif
+KERNEL:=2.$(word 2,$(subst ., ,$(strip $(LINUX_VERSION))))
+
include $(INCLUDE_DIR)/host.mk
include $(INCLUDE_DIR)/kernel.mk
-LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
-LINUX_SITE:=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
- http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
- http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
- http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
-
LINUX_CONFIG:=./config
ifneq (,$(findstring uml,$(BOARD)))
@@ -149,28 +150,37 @@ define BuildKernel
endef
endef
+$(eval $(call shexport,Target/Description))
+
+ifeq ($(DUMP),1)
+ dumpinfo:
+ @echo 'Target: $(BOARD)-$(KERNEL)'
+ @echo 'Target-Name: $(BOARDNAME) [$(KERNEL)]'
+ @echo 'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'
+ @echo 'Target-Arch: $(ARCH)'
+ @echo 'Target-Features: $(FEATURES)'
+ @echo 'Linux-Version: $(LINUX_VERSION)'
+ @echo 'Linux-Release: $(LINUX_RELEASE)'
+ @echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'
+ @echo 'Target-Description:'
+ @echo "$$$(call shvar,Target/Description)"
+ @echo '@@'
+else
+ download: $(DL_DIR)/$(LINUX_SOURCE)
+ prepare: $(LINUX_DIR)/.configured $(TMP_DIR)/.kernel.mk
+ compile: $(LINUX_DIR)/.modules
+ install: $(LINUX_DIR)/.image
-download: $(DL_DIR)/$(LINUX_SOURCE)
-prepare: $(LINUX_DIR)/.configured $(TOPDIR)/.kernel.mk
-compile: $(LINUX_DIR)/.modules
-install: $(LINUX_DIR)/.image
-
-clean: FORCE
+ clean: FORCE
rm -f $(STAMP_DIR)/.linux-compile
rm -rf $(KERNEL_BUILD_DIR)
-rebuild: FORCE
+ rebuild: FORCE
@$(MAKE) mostlyclean
@if [ -f $(LINUX_KERNEL) ]; then \
$(MAKE) clean; \
fi
@$(MAKE) compile
-
-$(TOPDIR)/.kernel.mk: Makefile
- echo "CONFIG_BOARD:=$(BOARD)" > $@
- echo "CONFIG_KERNEL:=$(KERNEL)" >> $@
- echo "CONFIG_LINUX_VERSION:=$(LINUX_VERSION)" >> $@
- echo "CONFIG_LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@
- echo "CONFIG_LINUX_KARCH:=$(LINUX_KARCH)" >> $@
+endif
diff --git a/include/kernel.mk b/include/kernel.mk
index 2611828..09aba40 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -4,29 +4,14 @@
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
+
ifeq ($(DUMP),1)
- KERNEL:=<KERNEL>
- BOARD:=<BOARD>
- LINUX_VERSION:=<LINUX_VERSION>
+ KERNEL?=<KERNEL>
+ BOARD?=<BOARD>
+ LINUX_VERSION?=<LINUX_VERSION>
else
-
- include $(TOPDIR)/.kernel.mk
include $(INCLUDE_DIR)/target.mk
- # check to see if .kernel.mk matches target.mk
- ifeq ($(CONFIG_BOARD)-$(CONFIG_KERNEL),$(BOARD)-$(KERNEL))
- LINUX_VERSION:=$(CONFIG_LINUX_VERSION)
- LINUX_RELEASE:=$(CONFIG_LINUX_RELEASE)
- LINUX_KARCH:=$(CONFIG_LINUX_KARCH)
- else
- ifneq ($(KERNEL_BUILD),1)
- # oops, old .kernel.config; rebuild it (hiding the misleading errors this produces)
- $(warning rebuilding .kernel.mk)
- $(TOPDIR)/.kernel.mk: FORCE
- @$(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL) $@ &>/dev/null
- endif
- endif
-
ifeq ($(KERNEL),2.6)
LINUX_KMOD_SUFFIX=ko
else
@@ -49,6 +34,13 @@ else
TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/$(MODULES_SUBDIR)
LINUX_KERNEL:=$(KERNEL_BUILD_DIR)/vmlinux
+
+ LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
+ LINUX_SITE:=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
+ http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
+ http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
+ http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
+
endif
diff --git a/include/package.mk b/include/package.mk
index 5636b0b..4e67e73 100644
--- a/include/package.mk
+++ b/include/package.mk
@@ -16,15 +16,6 @@ include $(INCLUDE_DIR)/unpack.mk
export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
-define shvar
-V_$(subst .,_,$(subst -,_,$(subst /,_,$(1))))
-endef
-
-define shexport
-$(call shvar,$(1))=$$(call $(1))
-export $(call shvar,$(1))
-endef
-
define Build/DefaultTargets
ifeq ($(DUMP),)
ifeq ($(CONFIG_AUTOREBUILD),y)
diff --git a/include/prereq.mk b/include/prereq.mk
index eda7ca3..f0db860 100644
--- a/include/prereq.mk
+++ b/include/prereq.mk
@@ -5,28 +5,23 @@
# See /LICENSE for more information.
#
-$(TMP_DIR):
- mkdir -p $@
-
prereq:
if [ -f $(TMP_DIR)/.prereq-error ]; then \
echo; \
cat $(TMP_DIR)/.prereq-error; \
+ rm -f $(TMP_DIR)/.prereq-error; \
echo; \
- rm -rf $(TMP_DIR); \
false; \
fi
- rm -rf $(TMP_DIR)
- mkdir -p $(TMP_DIR)
-.SILENT: $(TMP_DIR) prereq
+.SILENT: prereq
define Require
export PREREQ_CHECK=1
ifeq ($$(CHECK_$(1)),)
prereq: prereq-$(1)
- prereq-$(1): $(TMP_DIR) FORCE
+ prereq-$(1): FORCE
echo -n "Checking '$(1)'... "
if $(NO_TRACE_MAKE) -f $(firstword $(MAKEFILE_LIST)) check-$(1) >/dev/null 2>/dev/null; then \
echo 'ok.'; \
diff --git a/include/target.mk b/include/target.mk
index 614ab06..7f0501e 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -4,29 +4,9 @@
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
-define kernel_template
-ifeq ($(CONFIG_LINUX_$(3)),y)
-KERNEL:=$(1)
-BOARD:=$(2)
-endif
-endef
-$(eval $(call kernel_template,2.4,brcm,2_4_BRCM))
-$(eval $(call kernel_template,2.4,ar7,2_4_AR7))
-$(eval $(call kernel_template,2.6,brcm,2_6_BRCM))
-$(eval $(call kernel_template,2.6,brcm63xx,2_6_BRCM63XX))
-$(eval $(call kernel_template,2.6,rb532,2_6_RB532))
-$(eval $(call kernel_template,2.6,rdc,2_6_RDC))
-$(eval $(call kernel_template,2.6,x86,2_6_X86))
-$(eval $(call kernel_template,2.6,uml,2_6_UML))
-$(eval $(call kernel_template,2.4,ar531x,2_4_AR531X))
-$(eval $(call kernel_template,2.6,aruba,2_6_ARUBA))
-$(eval $(call kernel_template,2.6,au1000,2_6_AU1000))
-$(eval $(call kernel_template,2.6,ixp4xx,2_6_IXP4XX))
-$(eval $(call kernel_template,2.6,magicbox,2_6_MAGICBOX))
-$(eval $(call kernel_template,2.6,sibyte,2_6_SIBYTE))
-
-export BOARD
-export KERNEL
+include $(TMP_DIR)/.target.mk
+$(TMP_DIR)/.target.mk:
+ $(SCRIPT_DIR)/gen_target_mk.pl < $(TMP_DIR)/.targetinfo > $@