2006-06-08 02:59:04 +03:00
|
|
|
LINUX_SOURCE:=$(LINUX_NAME).tar.bz2
|
2006-02-10 00:21:44 +02: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 21:43:00 +02:00
|
|
|
http://www.kernel.org/pub/linux/kernel/v$(KERNEL) \
|
|
|
|
http://www.de.kernel.org/pub/linux/kernel/v$(KERNEL)
|
|
|
|
|
|
|
|
KERNEL_IDIR:=$(LINUX_BUILD_DIR)/kernel-ipkg
|
|
|
|
|
|
|
|
$(TARGETS): $(PACKAGE_DIR)
|
|
|
|
|
2006-06-01 03:47:29 +03:00
|
|
|
$(LINUX_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
|
2006-01-10 21:43:00 +02:00
|
|
|
$(PACKAGE_DIR):
|
2006-06-01 03:47:29 +03:00
|
|
|
mkdir -p $@
|
|
|
|
|
2006-01-10 21:43:00 +02:00
|
|
|
$(DL_DIR)/$(LINUX_SOURCE):
|
|
|
|
-mkdir -p $(DL_DIR)
|
2006-05-10 23:32:22 +03:00
|
|
|
$(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
|
2006-01-10 21:43:00 +02:00
|
|
|
|
|
|
|
$(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
|
|
|
|
-mkdir -p $(LINUX_BUILD_DIR)
|
|
|
|
bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(LINUX_BUILD_DIR) $(TAR_OPTIONS) -
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
ifeq ($(KERNEL),2.4)
|
|
|
|
$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
|
|
|
|
$(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" \
|
|
|
|
$(LINUX_DIR)/Makefile \
|
|
|
|
$(LINUX_DIR)/arch/*/Makefile
|
|
|
|
$(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
|
2006-05-10 23:32:22 +03:00
|
|
|
$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_KARCH) oldconfig include/linux/compile.h include/linux/version.h
|
2006-01-10 21:43:00 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(LINUX_DIR)/.depend_done: $(LINUX_DIR)/.configured
|
2006-05-10 23:32:22 +03:00
|
|
|
$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) dep
|
2006-01-10 21:43:00 +02:00
|
|
|
touch $@
|
|
|
|
|
|
|
|
$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.depend_done
|
|
|
|
else
|
|
|
|
$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
|
2006-05-10 23:32:22 +03:00
|
|
|
$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) oldconfig prepare scripts
|
2006-01-10 21:43:00 +02:00
|
|
|
touch $@
|
|
|
|
endif
|
|
|
|
|
2006-06-08 02:59:04 +03: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
|
|
|
|
|
|
|
|
$(LINUX_DIR)/vmlinux: $(STAMP_DIR)/.linux-compile pkg-install ramdisk-config
|
2006-05-10 23:32:22 +03:00
|
|
|
$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH=$(TARGET_PATH)
|
2006-01-10 21:43:00 +02:00
|
|
|
|
|
|
|
$(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
|
2006-05-10 23:32:22 +03:00
|
|
|
$(TARGET_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
|
2006-01-10 21:43:00 +02:00
|
|
|
touch -c $(LINUX_KERNEL)
|
|
|
|
|
2006-01-14 01:15:16 +02:00
|
|
|
$(LINUX_DIR)/.modules_done:
|
2006-01-10 21:43:00 +02:00
|
|
|
rm -rf $(LINUX_BUILD_DIR)/modules
|
2006-05-10 23:32:22 +03:00
|
|
|
$(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" ARCH=$(LINUX_KARCH) PATH="$(TARGET_PATH)" modules
|
|
|
|
$(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" DEPMOD=true INSTALL_MOD_PATH=$(LINUX_BUILD_DIR)/modules modules_install
|
2006-01-10 21:43:00 +02:00
|
|
|
touch $(LINUX_DIR)/.modules_done
|
|
|
|
|
2006-01-14 01:15:16 +02:00
|
|
|
$(STAMP_DIR)/.linux-compile:
|
2006-05-10 23:32:22 +03:00
|
|
|
@$(MAKE) $(LINUX_DIR)/.modules_done $(TARGETS) $(KERNEL_IPKG)
|
|
|
|
ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
|
2006-01-10 21:43:00 +02: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-05-10 23:32:22 +03:00
|
|
|
$(IPKG_BUILD) $(KERNEL_IDIR) $(LINUX_BUILD_DIR)
|
2006-01-10 21:43:00 +02:00
|
|
|
|
2006-06-01 03:47:29 +03:00
|
|
|
$(BUILD_DIR)/kernel.mk: $(LINUX_DIR) FORCE
|
2006-05-31 15:33:06 +03:00
|
|
|
echo "BOARD:=$(BOARD)" > $@
|
2006-06-08 02:59:04 +03:00
|
|
|
echo "LINUX_NAME:=$(LINUX_NAME)" >> $@
|
2006-05-31 15:33:06 +03:00
|
|
|
echo "LINUX_VERSION:=$(LINUX_VERSION)" >> $@
|
|
|
|
echo "LINUX_RELEASE:=$(LINUX_RELEASE)" >> $@
|
|
|
|
|
2006-06-01 02:29:05 +03:00
|
|
|
pkg-install: FORCE
|
2006-05-31 23:29:11 +03:00
|
|
|
@{ [ "$(INSTALL_TARGETS)" != "" ] && $(IPKG) install $(INSTALL_TARGETS) || true; }
|
|
|
|
|
2006-01-10 21:43:00 +02:00
|
|
|
source: $(DL_DIR)/$(LINUX_SOURCE)
|
2006-05-31 15:33:06 +03:00
|
|
|
prepare: $(BUILD_DIR)/kernel.mk
|
2006-01-14 01:15:16 +02:00
|
|
|
@mkdir -p $(STAMP_DIR) $(PACKAGE_DIR)
|
2006-05-10 23:32:22 +03:00
|
|
|
@$(MAKE) $(LINUX_DIR)/.configured
|
2006-01-10 21:43:00 +02:00
|
|
|
|
2006-01-14 01:15:16 +02:00
|
|
|
compile: prepare $(STAMP_DIR)/.linux-compile
|
|
|
|
|
2006-05-31 15:38:39 +03:00
|
|
|
install: compile $(LINUX_KERNEL)
|
2006-01-10 21:43:00 +02:00
|
|
|
|
2006-06-01 02:29:05 +03:00
|
|
|
mostlyclean: FORCE
|
2006-01-10 21:43:00 +02:00
|
|
|
rm -f $(STAMP_DIR)/.linux-compile
|
|
|
|
rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.modules_done
|
|
|
|
rm -f $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)/.drivers-unpacked
|
2006-05-10 23:32:22 +03:00
|
|
|
$(MAKE) -C $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) clean
|
2006-01-14 01:15:16 +02:00
|
|
|
rm -f $(LINUX_KERNEL)
|
2006-01-10 21:43:00 +02:00
|
|
|
|
2006-06-01 02:29:05 +03:00
|
|
|
rebuild: FORCE
|
2006-01-10 21:43:00 +02:00
|
|
|
-$(MAKE) mostlyclean
|
2006-05-30 22:38:38 +03:00
|
|
|
if [ -f $(LINUX_KERNEL) ]; then \
|
|
|
|
$(MAKE) clean; \
|
|
|
|
fi
|
|
|
|
$(MAKE) compile $(MAKE_TRACE)
|
2006-01-10 21:43:00 +02:00
|
|
|
|
2006-06-01 02:29:05 +03:00
|
|
|
clean: FORCE
|
2006-01-10 21:43:00 +02:00
|
|
|
rm -f $(STAMP_DIR)/.linux-compile
|
|
|
|
rm -rf $(LINUX_BUILD_DIR)
|
|
|
|
rm -f $(TARGETS)
|