summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorUlf Samuelsson <ulf.samuelsson@atmel.com>2007-07-20 11:27:45 +0000
committerUlf Samuelsson <ulf.samuelsson@atmel.com>2007-07-20 11:27:45 +0000
commit12ceed63758014033043fbb48eb9a0e94d75e478 (patch)
tree6572dc5c25d1ff6b70e2f3dbb8fdde3a3251ae39 /target
parent91a999f3bab43d57fc2c7937d7307a5c1e5bc752 (diff)
Add experimental linux target option
Diffstat (limited to 'target')
-rw-r--r--target/Makefile.in11
-rw-r--r--target/linux-experimental/Makefile.in318
2 files changed, 328 insertions, 1 deletions
diff --git a/target/Makefile.in b/target/Makefile.in
index b951301b2..7b377667c 100644
--- a/target/Makefile.in
+++ b/target/Makefile.in
@@ -17,4 +17,13 @@ include target/*/*.mk
# kernel rules
# We already did add the kernel target to TARGETS and now just pull in the rules
# to actually build this target.
-include target/linux/Makefile.in
+
+ifeq ($(strip $(subst ",,$(BR2_PACKAGE_LINUX_EXPERIMENTAL_CONFIG))),n)
+#"))
+include target/linux/Makefile.in
+endif
+ifeq ($(strip $(subst ",,$(BR2_PACKAGE_LINUX_EXPERIMENTAL_CONFIG))),y)
+#"))
+include target/linux-experimental/Makefile.in
+endif
+
diff --git a/target/linux-experimental/Makefile.in b/target/linux-experimental/Makefile.in
new file mode 100644
index 000000000..6f37aa74c
--- /dev/null
+++ b/target/linux-experimental/Makefile.in
@@ -0,0 +1,318 @@
+#############################################################
+#
+# Linux kernel 2.6 target
+#
+#############################################################
+ifneq ($(filter $(TARGETS),linux26),)
+
+
+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:=$(strip $(subst ",, $(BR2_DOWNLOAD_LINUX26_VERSION)))
+# "))
+LINUX26_VERSION:=$(strip $(subst ",, $(BR2_LINUX26_VERSION)))
+# "))
+LINUX26_RC_PATCH:=$(strip $(subst ",, $(BR2_LINUX26_RC_PATCH)))
+# "))
+LINUX_BSP_PATCH:=$(strip $(subst ",, $(BR2_LINUX_BSP_ATMEL_PATCH)))
+# " ))
+MKIMAGE:=$(BUILD_DIR)/mkimage
+
+ifeq ($(DOWNLOAD_LINUX26_VERSION),)
+DOWNLOAD_LINUX26_VERSION=2.6.19.2
+endif
+# Version of Linux after applying any patches
+LINUX26_VERSION=$(DOWNLOAD_LINUX26_VERSION)
+
+
+else # ---------------------------------------------------
+
+# Define DOWNLOAD_LINUX26_VERSION unless defined
+ifeq ($(strip $(BR2_DOWNLOAD_LINUX26_VERSION)),)
+DOWNLOAD_LINUX26_VERSION=$(LINUX_HEADERS_VERSION)
+else
+DOWNLOAD_LINUX26_VERSION:=$(strip $(subst ",, $(BR2_DOWNLOAD_LINUX26_VERSION)))
+# "))
+endif
+
+
+# Define LINUX26_VERSION unless defined
+ifeq ($(strip $(BR2_LINUX26_VERSION)),)
+LINUX26_VERSION=$(LINUX_HEADERS_VERSION)
+else
+LINUX26_VERSION:=$(strip $(subst ",, $(BR2_LINUX26_VERSION)))
+# "))
+endif
+
+endif # ---------------------------------------------------
+
+# Handle case when we want to build using an "rc" patch
+# Example: to build 2.6.21-rc1 you need to:
+# * Download linux-2.6.20
+# * Apply patch-2.6.21-rc1
+
+LINUX26_SOURCE:=linux-$(DOWNLOAD_LINUX26_VERSION).tar.bz2
+LINUX26_SITE=http://ftp.kernel.org/pub/linux/kernel/v2.6
+LINUX26_BZCAT:=$(BZCAT)
+
+# Linux kernel binary
+LINUX26_FORMAT:=$(strip $(subst ",, $(BR2_LINUX26_FORMAT)))
+# " ))
+
+# Linux kernel configuration file
+ifeq ($(strip $(LINUX26_KCONFIG)),)
+LINUX26_KCONFIG=$(BR2_BOARD_PATH)/linux26.config
+endif
+
+# File name for the Linux kernel binary
+ifeq ($(strip $(LINUX26_KERNEL)),)
+#LINUX26_KERNEL=linux-kernel-$(LINUX26_VERSION)-$(KERNEL_ARCH)
+LINUX26_KERNEL:=$(BOARD_NAME)-linux-$(LINUX26_VERSION)-$(DATE).gz
+endif
+
+ifeq ($(strip $(LINUX26_BINLOC)),)
+LINUX26_BINLOC=$(LINUX26_FORMAT)
+endif
+
+# Put binary in root file system
+ifeq ($(strip $(BR2_LINUX_IN_ROOTFS)),y)
+ifeq ($(strip $(LINUX26_TARGET)),)
+LINUX26_TARGET:=$(TARGET_DIR)/boot/$(LINUX26_BINLOC)
+endif
+else
+LINUX26_TARGET:=$(BINARIES_DIR)/$(LINUX26_KERNEL)
+endif
+endif
+
+ifeq ($(strip $(LINUX26_BUILD_DIR)),)
+LINUX26_BUILD_DIR=$(PROJECT_BUILD_DIR)
+endif
+
+ifeq ($(strip $(BR2_LINUX26_DEFCONFIG)),y)
+LINUX26_DEFCONFIG=$(BOARD_NAME)_defconfig
+endif
+
+# Version of Linux AFTER patches
+LINUX26_DIR=$(LINUX26_BUILD_DIR)/linux-$(LINUX26_VERSION)
+
+# for packages that need it
+LINUX_VERSION=$(LINUX26_VERSION)
+LINUX_DIR=$(LINUX26_DIR)
+LINUX_KERNEL=$(LINUX26_KERNEL)
+
+# kernel patches
+ifeq ($(strip $(subst ",, $(LINUX26_PATCH_DIR))),)
+# ")))
+LINUX26_PATCH_DIR:=$(BR2_BOARD_PATH)/kernel-patches/
+endif
+PATCH_DIR=$(strip $(subst ",, $(LINUX26_PATCH_DIR)))
+# " ))
+
+LINUX26_MAKE_FLAGS = $(TARGET_CONFIGURE_OPTS) ARCH=$(KERNEL_ARCH) \
+ PATH=$(TARGET_PATH) INSTALL_MOD_PATH=$(TARGET_DIR) \
+ CROSS_COMPILE=$(KERNEL_CROSS)
+
+$(LINUX26_KCONFIG):
+ @if [ ! -f "$(LINUX26_KCONFIG)" ] ; then \
+ echo ""; \
+ echo "You should create a .config for your kernel"; \
+ echo "and install it as $(LINUX26_KCONFIG)"; \
+ echo ""; \
+ sleep 5; \
+ fi;
+
+# Check if we have a release candidate.
+# This makes life complex
+# To build linux-2.6.21-rc2 you need to:
+# * Download linux.2.6.20.tar.bz2
+# * Download patch-2.6.21-rc2.bz2
+# I:E you have to download the *previous* major version
+
+ifneq ($(LINUX26_RC_PATCH),)
+# We have a "release candidate"
+LINUX26_RC_PATCH_SOURCE:=$(PROJECT_BUILD_DIR)/linux-patch/$(LINUX26_RC_PATCH)
+
+# Create rule to download the patch
+$(LINUX26_RC_PATCH_SOURCE):
+ mkdir -p $(PROJECT_BUILD_DIR)/linux-patch/
+ $(WGET) -P $(PROJECT_BUILD_DIR)/linux-patch $(LINUX26_SITE)/$(LINUX26_RC_PATCH)
+# $(LINUX26_BZCAT) $(PROJECT_BUILD_DIR)/linux-patch/$(LINUX26_RC_PATCH).bz2
+else
+# We have a vanilla style linux kernel
+LINUX26_RC_PATCH_SOURCE:=
+endif
+
+ifneq ($(strip $(LINUX_HEADERS_SOURCE)),$(strip $(LINUX26_SOURCE)))
+$(DL_DIR)/$(LINUX26_SOURCE):
+ $(WGET) -P $(DL_DIR) $(LINUX26_SITE)/$(LINUX26_SOURCE)
+endif
+
+$(LINUX26_DIR)/.unpacked: $(DL_DIR)/$(LINUX26_SOURCE) $(LINUX26_RC_PATCH_SOURCE)
+ rm -rf $(LINUX26_DIR)
+ $(LINUX26_BZCAT) $(DL_DIR)/$(LINUX26_SOURCE) | tar -C $(LINUX26_BUILD_DIR) $(TAR_OPTIONS) -
+ifneq ($(DOWNLOAD_LINUX26_VERSION),$(LINUX26_VERSION))
+ # Rename the dir from the downloaded version to the AFTER patch version
+ mv -f $(LINUX26_BUILD_DIR)/linux-$(DOWNLOAD_LINUX26_VERSION) $(LINUX26_DIR)
+endif
+ifneq ($(LINUX26_RC_PATCH),)
+ -(cd $(LINUX26_DIR); $(LINUX26_BZCAT) $(LINUX26_RC_PATCH_SOURCE) | patch -p1)
+endif
+ -(cd $(TOOL_BUILD_DIR); ln -snf $(LINUX26_DIR) linux)
+ rm -f $(LINUX26_DIR)/.kernelrelease
+ echo $(LINUX26_VERSION) > $(LINUX26_DIR)/.kernelrelease
+ touch $@
+
+$(LINUX26_DIR)/.patched: $(LINUX26_DIR)/.unpacked
+ echo $(PATCH_DIR)
+ toolchain/patch-kernel.sh $(LINUX26_DIR) $(LINUX26_PATCH_DIR)
+ touch $@
+
+$(LINUX26_DIR)/.configured: $(LINUX26_DIR)/.patched $(LINUX26_KCONFIG)
+ -ls -l $(LINUX26_DIR)/.patched
+ -ls -l $(LINUX26_KCONFIG)
+ -ls -l $(LINUX26_DIR)/.configured
+ -ls -l $(LINUX26_DIR)/.unpacked
+ -ls -l $(DL_DIR)/$(LINUX26_SOURCE)
+ -ls -l $(LINUX26_RC_PATCH_SOURCE)
+ifeq ($(strip $(BR2_LINUX26_DEFCONFIG)),y)
+ make ARCH=$(ARCH) -C $(LINUX26_DIR) $(BOARD_NAME)_defconfig
+else
+ cp -df --preserve=mode,ownership $(LINUX26_KCONFIG) $(LINUX26_DIR)/.config
+endif
+ifeq ($(strip $(BR2_LINUX_CUSTOMIZE)),y)
+ make -C $(LINUX26_DIR) xconfig
+endif
+ $(SED) '/CONFIG_AEABI/d' $(LINUX26_DIR)/.config
+ifeq ($(BR2_ARM_EABI),y)
+ echo "CONFIG_AEABI=y" >> $(LINUX26_DIR)/.config
+ $(SED) '/CONFIG_OABI_COMPAT/d' $(LINUX26_DIR)/.config
+ echo "# CONFIG_OABI_COMPAT is not set" >> $(LINUX26_DIR)/.config
+else
+ echo "# CONFIG_AEABI is not set" >> $(LINUX26_DIR)/.config
+endif
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) oldconfig include/linux/version.h
+ touch $@
+
+$(LINUX26_DIR)/.depend_done: $(LINUX26_DIR)/.configured
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) prepare
+ touch $@
+
+$(LINUX26_DIR)/arch/$(ARCH)/boot/$(LINUX26_FORMAT): $(LINUX26_DIR)/vmlinux
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) $(LINUX26_FORMAT)
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) modules
+ touch -c $@
+
+$(LINUX26_DIR)/vmlinux: $(LINUX26_DIR)/.depend_done $(STAGING_DIR)/include/linux/version.h
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) vmlinux
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) modules
+ touch -c $@
+
+
+
+#-----------------------------------------------------------------------------------
+# Rule can be enabled by setting
+# LINUX26_TARGET:= $(TARGET_DIR)/boot/$(LINUX26_BINLOC)
+#
+$(TARGET_DIR)/boot/$(LINUX26_FORMAT): $(LINUX26_DIR)/$(LINUX26_FORMAT)
+ [ -d $(TARGET_DIR)/boot/ ] || mkdir $(TARGET_DIR)/boot
+ cp -a $(LINUX26_DIR)/$(LINUX26_FORMAT) $(LINUX26_DIR)/System.map $(TARGET_DIR)/boot/$(LINUX26_FORMAT)
+ touch -c $@
+
+#-----------------------------------------------------------------------------------
+# Rule can be enabled by setting
+# LINUX26_TARGET:= $(BINARIES_DIR)/$(LINUX26_KERNEL)
+# LINUX26_FORMAT:= vmlinux
+
+$(BINARIES_DIR)/$(LINUX26_KERNEL): $(LINUX26_DIR)/uImage
+ cp -dpf $(LINUX26_DIR)/uImage $(BINARIES_DIR)/$(LINUX26_KERNEL)
+ cp -dpf $(LINUX26_DIR)/uImage /tftpboot/$(LINUX26_KERNEL)
+ mkdir -p $(TARGET_DIR)/boot/
+ cp -dpf $(LINUX26_DIR)/.config $(TARGET_DIR)/boot/$(BOARD_NAME)-linux-$(LINUX26_VERSION).config
+ cp -dpf .config $(TARGET_DIR)/boot/$(BOARD_NAME)-buildroot.config
+ cp -dpf $(BUSYBOX_DIR)/.config $(TARGET_DIR)/boot/busybox.config
+
+$(PROJECT_BUILD_DIR)/linux.bin: $(LINUX26_DIR)/vmlinux
+ ${KERNEL_CROSS}objcopy -O binary -S $(LINUX26_DIR)/vmlinux $(PROJECT_BUILD_DIR)/linux.bin
+
+$(LINUX26_DIR)/uImage: $(LINUX26_DIR)/arch/$(ARCH)/boot/uImage
+ cp -dpf $(LINUX26_DIR)/arch/$(ARCH)/boot/uImage $(LINUX26_DIR)/uImage
+
+
+$(PROJECT_BUILD_DIR)/xxxx: $(PROJECT_BUILD_DIR)/linux.bin $(MKIMAGE)
+ gzip -v9 -c $(PROJECT_BUILD_DIR)/linux.bin > $(PROJECT_BUILD_DIR)/linux.bin.gz
+ $(MKIMAGE) -A $(ARCH) \
+ -O linux \
+ -C gzip \
+ -a 0x20008000 \
+ -e 0x20008000 \
+ -d $(PROJECT_BUILD_DIR)/linux.bin.gz \
+ $(LINUX26_DIR)/uImage
+ rm -f $(PROJECT_BUILD_DIR)/linux.bin.gz
+#-----------------------------------------------------------------------------------
+
+$(TARGET_DIR)/lib/modules/$(LINUX26_VERSION)/modules.dep: $(LINUX26_TARGET) $(TARGET_DIR)/sbin/modprobe $(LINUX26_DIR)/vmlinux
+ rm -rf $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION)
+ rm -f $(TARGET_DIR)/sbin/cardmgr
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) \
+ DEPMOD=$(STAGING_DIR)/bin/$(GNU_TARGET_NAME)-depmod26 \
+ INSTALL_MOD_PATH=$(TARGET_DIR) modules_install
+ (cd $(TARGET_DIR)/lib/modules; \
+ rm -f drivers; \
+ ln -s $(LINUX26_VERSION)/kernel/drivers .)
+ chmod a+x target/depmod.pl
+ target/depmod.pl \
+ -b $(TARGET_DIR)/lib/modules/$(DOWNLOAD_LINUX26_VERSION) \
+ -k $(LINUX26_DIR)/vmlinux \
+ -F $(LINUX26_DIR)/System.map \
+ > $(TARGET_DIR)/lib/modules/$(shell cat $(LINUX26_DIR)/include/config/kernel.release 2> /dev/null)/modules.dep
+ rm -f $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION)/build
+ touch -c $@
+
+$(STAGING_DIR)/include/linux/version.h: $(LINUX26_DIR)/.configured
+ mkdir -p $(STAGING_DIR)/include
+ tar -ch -C $(LINUX26_DIR)/include -f - linux | tar -xf - -C $(STAGING_DIR)/include/
+ tar -ch -C $(LINUX26_DIR)/include -f - asm | tar -xf - -C $(STAGING_DIR)/include/
+
+linux26-menuconfig: $(LINUX26_DIR)/.patched host-sed
+ [ -f $(LINUX26_DIR)/.config ] || cp $(LINUX26_KCONFIG) $(LINUX26_DIR)/.config
+ $(MAKE) $(LINUX26_MAKE_FLAGS) -C $(LINUX26_DIR) menuconfig
+ -[ -f $(LINUX26_DIR)/.config ] && touch $(LINUX26_DIR)/.configured
+
+linux26: cross-depmod26 $(TARGET_DIR)/lib/modules/$(LINUX26_VERSION)/modules.dep $(LINUX26_TARGET)
+
+linux26-source: $(DL_DIR)/$(LINUX26_SOURCE)
+
+# This has been renamed so we do _NOT_ by default run this on 'make clean'
+linux26clean:
+ rm -f $(LINUX26_TARGET)
+ rm -f $(PROJECT_BUILD_DIR)/linux.bin
+ rm -f $(LINUX26_DIR)/uImage
+ -$(MAKE) PATH=$(TARGET_PATH) -C $(LINUX26_DIR) clean
+
+linux26-dirclean:
+ rm -f $(LINUX26_TARGET)
+ rm -f $(PROJECT_BUILD_DIR)/linux.bin
+ rm -rf $(LINUX26_DIR)
+
+linux-update:
+ cp -dpf $(LINUX26_DIR)/.config $(LINUX26_KCONFIG)
+
+linux-test:
+ @echo "LINUX_HEADERS_VERSION" $(LINUX_HEADERS_VERSION)
+ @echo "BR2_PACKAGE_LINUX" $(BR2_PACKAGE_LINUX)
+ @echo "BR2_CUSTOM_DOWNLOAD_LINUX26_VERSION" $(BR2_CUSTOM_DOWNLOAD_LINUX26_VERSION)
+ @echo "BR2_CUSTOM_LINUX26_VERSION" $(BR2_CUSTOM_LINUX26_VERSION)
+ @echo "BR2_CUSTOM_LINUX26_RC_PATCH" $(BR2_CUSTOM_LINUX26_RC_PATCH)
+ @echo "BR2_LINUX_BSP_PATCH" $(BR2_LINUX_BSP_PATCH)
+ @echo "BR2_DOWNLOAD_LINUX26_VERSION" $(BR2_DOWNLOAD_LINUX26_VERSION)
+ @echo "BR2_LINUX26_VERSION" $(BR2_LINUX26_VERSION)
+ @echo "LINUX26_VERSION" $(LINUX26_VERSION)
+ @echo "BR2_LINUX26_RC_PATCH" $(BR2_LINUX26_RC_PATCH)
+ @echo "BR2_PACKAGE_LINUX26_KCONFIG" $(BR2_PACKAGE_LINUX_KCONFIG)
+ @echo "LINUX26_KCONFIG" $(LINUX26_KCONFIG)
+ @echo "BR2_LINUX_BIN_CUSTOM" $(BR2_LINUX_BIN_CUSTOM)
+ @echo "BR2_PACKAGE_LINUX_FORMAT" $(BR2_PACKAGE_LINUX_FORMAT)
+ @echo "BR2_LINUX_IN_ROOTFS" $(BR2_LINUX_IN_ROOTFS)
+ @echo "BR2_LINUX_2_6_22_1" $(BR2_LINUX_2_6_22_1)
+