summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-11-11 23:11:02 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-11-11 23:11:02 +0000
commite158d8b6a7b3c883a8be74cb2327dda6374fc050 (patch)
tree8be2d6fbdc05c44bd84fbc88d3fb9c92c07bf179 /include
parentb95511065669c952e554ccbe8c8054bd166019e4 (diff)
make target/linux/* directories self-contained, use the selected kernel version for the toolchain, autogenerate menuconfig and makefile code for target selection
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5498 3c298f89-4303-0410-b956-a3cf2f4a3e73
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 3100ce416..ed961e35d 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 8420c8398..e491e489c 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 2611828a3..09aba4076 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 5636b0b6a..4e67e7324 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 eda7ca35a..f0db86026 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 614ab06df..7f0501e59 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 > $@