2006-06-27 00:35:46 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2006-10-10 23:04:46 +00:00
|
|
|
include $(INCLUDE_DIR)/host.mk
|
2006-06-21 02:16:37 +00:00
|
|
|
|
|
|
|
LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
|
2006-02-09 22:21:44 +00:00
|
|
|
LINUX_SITE=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
|
|
|
|
http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
|
2006-01-10 19:43:00 +00:00
|
|
|
http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
|
|
|
|
http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
|
|
|
|
|
2006-10-18 13:16:44 +00:00
|
|
|
ifneq (,$(findstring uml,$(BOARD)))
|
|
|
|
LINUX_KARCH:=um
|
|
|
|
else
|
|
|
|
LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
|
2006-10-10 13:41:00 +00:00
|
|
|
-e 's/mipsel/mips/' \
|
|
|
|
-e 's/mipseb/mips/' \
|
|
|
|
-e 's/powerpc/ppc/' \
|
|
|
|
-e 's/sh[234]/sh/' \
|
|
|
|
-e 's/armeb/arm/' \
|
2006-10-18 13:16:44 +00:00
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
KERNELNAME=
|
|
|
|
ifneq (,$(findstring x86,$(BOARD)))
|
|
|
|
KERNELNAME="bzImage"
|
|
|
|
endif
|
|
|
|
ifneq (,$(findstring ppc,$(BOARD)))
|
|
|
|
KERNELNAME="uImage"
|
|
|
|
endif
|
2006-10-10 13:41:00 +00:00
|
|
|
|
|
|
|
|
2006-01-10 19:43:00 +00:00
|
|
|
$(DL_DIR)/$(LINUX_SOURCE):
|
|
|
|
-mkdir -p $(DL_DIR)
|
2006-05-10 20:32:22 +00:00
|
|
|
$(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
|
|
|
$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
|
2006-06-21 02:16:37 +00:00
|
|
|
-mkdir -p $(KERNEL_BUILD_DIR)
|
2006-10-14 14:51:48 +00:00
|
|
|
bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(KERNEL_BUILD_DIR) $(TAR_OPTIONS)
|
2006-01-10 19:43:00 +00:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
ifeq ($(KERNEL),2.4)
|
|
|
|
$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
|
|
|
|
$(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
|
2006-08-10 11:16:46 +00:00
|
|
|
$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) oldconfig include/linux/compile.h include/linux/version.h
|
2006-01-10 19:43:00 +00:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
|
2006-05-10 20:32:22 +00:00
|
|
|
$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) dep
|
2006-01-10 19:43:00 +00:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
|
|
|
|
else
|
|
|
|
$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
|
2006-08-10 11:16:46 +00:00
|
|
|
$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) oldconfig prepare scripts
|
2006-01-10 19:43:00 +00:00
|
|
|
touch $@
|
|
|
|
endif
|
|
|
|
|
2006-06-07 23:59:04 +00:00
|
|
|
ramdisk-config: $(LINUX_DIR)/.configured FORCE
|
|
|
|
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
|
|
|
|
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
|
|
|
|
ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
|
|
|
echo 'CONFIG_INITRAMFS_SOURCE="../../root"' >> $(LINUX_DIR)/.config
|
|
|
|
echo 'CONFIG_INITRAMFS_ROOT_UID=0' >> $(LINUX_DIR)/.config
|
|
|
|
echo 'CONFIG_INITRAMFS_ROOT_GID=0' >> $(LINUX_DIR)/.config
|
|
|
|
mkdir -p $(BUILD_DIR)/root/etc/init.d
|
|
|
|
$(CP) ../generic-2.6/files/init $(BUILD_DIR)/root/
|
|
|
|
else
|
|
|
|
rm -f $(BUILD_DIR)/root/init $(BUILD_DIR)/root/etc/init.d/S00initramfs
|
|
|
|
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
|
|
|
|
endif
|
|
|
|
|
2006-10-19 04:35:29 +00:00
|
|
|
$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.linux-compile ramdisk-config
|
2006-10-18 19:00:05 +00:00
|
|
|
$(MAKE) -j$(CONFIG_JLEVEL) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) $(KERNELNAME)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
|
|
|
$(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
|
2006-08-04 11:59:52 +00:00
|
|
|
$(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
|
2006-01-10 19:43:00 +00:00
|
|
|
touch -c $(LINUX_KERNEL)
|
|
|
|
|
2006-01-13 23:15:16 +00:00
|
|
|
$(LINUX_DIR)/.modules_done:
|
2006-06-21 02:16:37 +00:00
|
|
|
rm -rf $(KERNEL_BUILD_DIR)/modules
|
2006-10-18 19:00:05 +00:00
|
|
|
$(MAKE) -j$(CONFIG_JLEVEL) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) modules
|
2006-08-18 01:18:24 +00:00
|
|
|
$(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) DEPMOD=true INSTALL_MOD_PATH=$(KERNEL_BUILD_DIR)/modules modules_install
|
2006-01-10 19:43:00 +00:00
|
|
|
touch $(LINUX_DIR)/.modules_done
|
|
|
|
|
2006-06-25 16:59:19 +00:00
|
|
|
modules: $(LINUX_DIR)/.modules_done
|
|
|
|
|
2006-07-20 23:52:27 +00:00
|
|
|
$(LINUX_DIR)/.linux-compile:
|
2006-08-05 00:55:41 +00:00
|
|
|
@rm -f $(BUILD_DIR)/linux
|
2006-07-20 23:52:27 +00:00
|
|
|
ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
|
2006-06-25 16:59:19 +00:00
|
|
|
@$(MAKE) modules
|
2006-01-10 19:43:00 +00:00
|
|
|
touch $@
|
|
|
|
|
2006-08-16 00:35:30 +00:00
|
|
|
$(TOPDIR)/.kernel.mk: $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL)/Makefile
|
|
|
|
echo "CONFIG_BOARD:=$(BOARD)" > $@
|
|
|
|
echo "CONFIG_KERNEL:=$(KERNEL)" >> $@
|
|
|
|
echo "CONFIG_LINUX_VERSION:=$(LINUX_VERSION)" >> $@
|
|
|
|
echo "CONFIG_LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@
|
2006-10-10 13:41:00 +00:00
|
|
|
echo "CONFIG_LINUX_KARCH:=$(LINUX_KARCH)" >> $@
|
2006-05-31 12:33:06 +00:00
|
|
|
|
2006-07-21 17:00:14 +00:00
|
|
|
download: $(DL_DIR)/$(LINUX_SOURCE)
|
2006-06-23 22:10:43 +00:00
|
|
|
prepare: $(LINUX_DIR)/.configured
|
2006-10-19 04:35:29 +00:00
|
|
|
@mkdir -p $(LINUX_DIR)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
2006-07-20 23:52:27 +00:00
|
|
|
compile: prepare $(LINUX_DIR)/.linux-compile
|
2006-01-13 23:15:16 +00:00
|
|
|
|
2006-05-31 12:38:39 +00:00
|
|
|
install: compile $(LINUX_KERNEL)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
2006-05-31 23:29:05 +00:00
|
|
|
mostlyclean: FORCE
|
2006-07-20 23:52:27 +00:00
|
|
|
rm -f $(LINUX_DIR)/.linux-compile
|
2006-06-21 02:16:37 +00:00
|
|
|
rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
|
|
|
|
rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
|
|
|
|
$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
|
2006-01-13 23:15:16 +00:00
|
|
|
rm -f $(LINUX_KERNEL)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
2006-05-31 23:29:05 +00:00
|
|
|
rebuild: FORCE
|
2006-01-10 19:43:00 +00:00
|
|
|
-$(MAKE) mostlyclean
|
2006-05-30 19:38:38 +00:00
|
|
|
if [ -f $(LINUX_KERNEL) ]; then \
|
|
|
|
$(MAKE) clean; \
|
|
|
|
fi
|
|
|
|
$(MAKE) compile $(MAKE_TRACE)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
2006-05-31 23:29:05 +00:00
|
|
|
clean: FORCE
|
2006-01-10 19:43:00 +00:00
|
|
|
rm -f $(STAMP_DIR)/.linux-compile
|
2006-06-21 02:16:37 +00:00
|
|
|
rm -rf $(KERNEL_BUILD_DIR)
|
2006-06-26 01:55:47 +00:00
|
|
|
|