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-23 00:49:42 +00:00
|
|
|
-include $(INCLUDE_DIR)/modules-$(KERNEL).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-06-21 02:16:37 +00:00
|
|
|
KERNEL_IDIR:=$(KERNEL_BUILD_DIR)/kernel-ipkg
|
|
|
|
KERNEL_IPKG:=$(KERNEL_BUILD_DIR)/kernel_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk
|
2006-06-25 16:59:19 +00:00
|
|
|
TARGETS += $(KERNEL_IPKG)
|
2006-06-21 02:16:37 +00:00
|
|
|
INSTALL_TARGETS += $(KERNEL_IPKG)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
2006-10-10 13:41:00 +00:00
|
|
|
LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
|
|
|
|
-e 's/mipsel/mips/' \
|
|
|
|
-e 's/mipseb/mips/' \
|
|
|
|
-e 's/powerpc/ppc/' \
|
|
|
|
-e 's/sh[234]/sh/' \
|
|
|
|
-e 's/armeb/arm/' \
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2006-01-10 19:43:00 +00:00
|
|
|
$(TARGETS): $(PACKAGE_DIR)
|
|
|
|
|
|
|
|
$(PACKAGE_DIR):
|
2006-06-01 00:47:29 +00:00
|
|
|
mkdir -p $@
|
|
|
|
|
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-07-20 23:52:27 +00:00
|
|
|
$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.linux-compile pkg-install ramdisk-config
|
2006-08-17 07:20:08 +00:00
|
|
|
$(MAKE) -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-08-18 01:18:24 +00:00
|
|
|
$(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) modules
|
|
|
|
$(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
|
|
|
|
packages: $(TARGETS)
|
|
|
|
|
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 $@
|
|
|
|
|
|
|
|
$(KERNEL_IPKG):
|
|
|
|
rm -rf $(KERNEL_IDIR)
|
|
|
|
mkdir -p $(KERNEL_IDIR)/etc
|
|
|
|
$(SCRIPT_DIR)/make-ipkg-dir.sh $(KERNEL_IDIR) ../control/kernel.control $(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) $(ARCH)
|
|
|
|
if [ -f ./config/$(BOARD).modules ]; then \
|
|
|
|
cp ./config/$(BOARD).modules $(KERNEL_IDIR)/etc/modules; \
|
|
|
|
fi
|
2006-06-21 02:16:37 +00:00
|
|
|
$(IPKG_BUILD) $(KERNEL_IDIR) $(KERNEL_BUILD_DIR)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
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-05-31 23:29:05 +00:00
|
|
|
pkg-install: FORCE
|
2006-06-28 17:30:39 +00:00
|
|
|
@for pkg in $(INSTALL_TARGETS); do \
|
|
|
|
$(IPKG) install $$pkg || echo; \
|
|
|
|
done
|
2006-05-31 20:29:11 +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-07-20 23:52:27 +00:00
|
|
|
@mkdir -p $(LINUX_DIR) $(PACKAGE_DIR)
|
2006-01-10 19:43:00 +00:00
|
|
|
|
2006-07-20 23:52:27 +00:00
|
|
|
compile: prepare $(LINUX_DIR)/.linux-compile
|
2006-08-27 13:22:42 +00:00
|
|
|
@$(MAKE) packages
|
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-01-10 19:43:00 +00:00
|
|
|
rm -f $(TARGETS)
|
2006-06-26 01:55:47 +00:00
|
|
|
|