summaryrefslogtreecommitdiff
path: root/target/linux/Makefile.in
diff options
context:
space:
mode:
authorUlf Samuelsson <ulf.samuelsson@atmel.com>2007-08-24 05:36:46 +0000
committerUlf Samuelsson <ulf.samuelsson@atmel.com>2007-08-24 05:36:46 +0000
commit60eb97a42fe0cf8ebad55a6213e2399b4201e3ec (patch)
treeae28e87c4a82ddcbe963bfbd8f99dbfd85fe74be /target/linux/Makefile.in
parent85f54fbe2115d99ad74d0b60b3172fcad9264278 (diff)
This patch allows each project to have a private linux build.
Split build of kernel headers and kernel image into two source trees. Kernel headers are built in $(TOOL_BUILD_DIR) Kernel build is in $(PROJECT_BUILD_DIR) Make sure that kernel patches are applied to the kernel tree in $(PROJECT_BUILD_DIR) Add board specific patches, if available.
Diffstat (limited to 'target/linux/Makefile.in')
-rw-r--r--target/linux/Makefile.in71
1 files changed, 52 insertions, 19 deletions
diff --git a/target/linux/Makefile.in b/target/linux/Makefile.in
index e83bfd53c..948dd3ea2 100644
--- a/target/linux/Makefile.in
+++ b/target/linux/Makefile.in
@@ -6,49 +6,54 @@
ifneq ($(filter $(TARGETS),linux26),)
+ifeq ($(DOWNLOAD_LINUX26_VERSION),)
+# User did not define linux version, try using headers
ifeq ($(LINUX_HEADERS_VERSION),)
-# Version of Linux to download and then apply patches to
-# XXX: andersee, i do not understand why we need this (BF)
-DOWNLOAD_LINUX26_VERSION=2.6.19.2
+# We did not have headers (this is for real???)
+# Version of linuc before patches
+DOWNLOAD_LINUX26_VERSION=2.6.22.1
# Version of Linux after applying any patches
-LINUX26_VERSION=2.6.19.2
+LINUX26_VERSION=2.6.22.1
else
+# OK, we have headers, use them...
DOWNLOAD_LINUX26_VERSION=$(LINUX_HEADERS_VERSION)
LINUX26_VERSION=$(LINUX_HEADERS_VERSION)
endif
+endif
LINUX26_SOURCE=linux-$(DOWNLOAD_LINUX26_VERSION).tar.bz2
LINUX26_BZCAT:=$(BZCAT)
LINUX26_SITE=http://ftp.kernel.org/pub/linux/kernel/v2.6
-#LINUX26_FORMAT=vmlinux
-#LINUX26_BINLOC=$(LINUX26_FORMAT)
+ifeq ($(BOARD_PATH),)
+BOARD_PATH:=$(strip $(subst ",,$(BR2_BOARD_PATH)))
+#"))
+endif
# Linux kernel configuration file
# Has to be set by the target/device
# If it is not set by the target/device, then pick the one from .config
-# LINUX26_KCONFIG=$(BR2_BOARD_PATH)/linux26.config
ifndef LINUX26_KCONFIG
ifneq ($(strip $(subst ",,$(BR2_PACKAGE_LINUX_KCONFIG))),)
LINUX26_KCONFIG=$(strip $(subst ",,$(BR2_PACKAGE_LINUX_KCONFIG)))
#"))
#"))
+else
+# LINUX26_KCONFIG=$(BOARD_PATH)/linux26.config
endif
endif
+
ifndef LINUX26_FORMAT
ifneq ($(strip $(subst ",,$(BR2_PACKAGE_LINUX_FORMAT))),)
LINUX26_FORMAT=$(strip $(subst ",,$(BR2_PACKAGE_LINUX_FORMAT)))
#"))
#"))
+else
+LINUX26_FORMAT=zImage
endif
endif
# Has to be set by the target/device
-# LINUX26_FORMAT=bzImage
-ifndef LINUX26_FORMAT
-LINUX26_FORMAT=zImage
-endif
-# Has to be set by the target/device
ifndef LINUX26_BINLOC
# default:
LINUX26_BINLOC=arch/$(KERNEL_ARCH)/boot/$(LINUX26_FORMAT)
@@ -60,15 +65,20 @@ LINUX26_KERNEL=$(BINARIES_DIR)/linux-kernel-$(LINUX26_VERSION)-$(KERNEL_ARCH)
endif
# Version of Linux AFTER patches
-LINUX26_DIR=$(BUILD_DIR)/linux-$(LINUX26_VERSION)
+LINUX26_DIR=$(PROJECT_BUILD_DIR)/linux-$(LINUX26_VERSION)
# for packages that need it
-LINUX_VERSION:=$(LINUX_VERSION)
+LINUX_VERSION:=$(LINUX26_VERSION)
LINUX_DIR=$(LINUX26_DIR)
LINUX_KERNEL=$(LINUX26_KERNEL)
# kernel patches
-LINUX26_PATCH_DIR=$(BR2_BOARD_PATH)/kernel-patches/
+ifeq ($(strip $(LINUX26_PATCH_DIR)),)
+ifneq ($(BOARD_PATH),)
+LINUX26_PATCH_DIR:=$(BOARD_PATH)/kernel-patches/
+#"))
+endif
+endif
__LINUX26_NO_PIC=-fPIC -fpic -DPIC
LINUX26_MAKE_FLAGS = HOSTCC="$(HOSTCC)" HOSTCFLAGS=$(HOSTCFLAGS) \
ARCH=$(KERNEL_ARCH) \
@@ -88,20 +98,43 @@ $(LINUX26_KCONFIG):
ifneq ($(strip $(LINUX26_VERSION)),$(strip $(LINUX_HEADERS_VERSION)))
$(DL_DIR)/$(LINUX26_SOURCE):
$(WGET) -P $(DL_DIR) $(LINUX26_SITE)/$(LINUX26_SOURCE)
+endif # ($(LINUX26_VERSION),$(LINUX_HEADERS_VERSION))
$(LINUX26_DIR)/.unpacked: $(DL_DIR)/$(LINUX26_SOURCE)
rm -rf $(LINUX26_DIR)
- $(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
+ @echo "*** Unpacking kernel source"
+ $(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C $(PROJECT_BUILD_DIR) $(TAR_OPTIONS) -
ifneq ($(DOWNLOAD_LINUX26_VERSION),$(LINUX26_VERSION))
# Rename the dir from the downloaded version to the AFTER patch version
- mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION) $(LINUX26_DIR)
+ mv -f $(PROJECT_BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION) $(LINUX26_DIR)
endif
touch $@
$(LINUX26_DIR)/.patched: $(LINUX26_DIR)/.unpacked
- toolchain/patch-kernel.sh $(LINUX26_DIR) $(LINUX26_PATCH_DIR) \*.patch
+ toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers \
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+ifeq ($(BR2_KERNEL_HEADERS_IPMI),y)
+ toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers/ipmi \
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_KERNEL_HEADERS_LZMA),y)
+ toolchain/patch-kernel.sh $(LINUX26_DIR) toolchain/kernel-headers/lzma \
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_KERNEL_HEADERS_PATCH_DIR),y)
+ toolchain/patch-kernel.sh $(LINUX26_DIR) $(KERNEL_HEADERS_PATCH_DIR) \
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifeq ($(BR2_PACKAGE_OPENSWAN),y)
+ toolchain/patch-kernel.sh $(LINUX_HEADERS_UNPACK_DIR) package/openswan \
+ linux-$(LINUX26_VERSION)-\*.patch{,.gz,.bz2}
+endif
+ifneq ($(LINUX26_PATCH_DIR),)
+ if [ -d $(LINUX26_PATCH_DIR) ] ; then \
+ toolchain/patch-kernel.sh $(LINUX26_DIR) $(LINUX26_PATCH_DIR) linux-$(LINUX26_VERSION)\*.patch ; \
+ fi
+endif
touch $@
-endif # ($(LINUX26_VERSION),$(LINUX_HEADERS_VERSION))
$(LINUX26_DIR)/.configured: $(LINUX26_DIR)/.patched $(LINUX26_KCONFIG)
cp -dpf $(LINUX26_KCONFIG) $(LINUX26_DIR)/.config